#include<bits/stdc++.h> using namespace std; int s,i,x,y; int main() { for(i=1;i<=7;++i) { cin>>x>>y; if(x+y>8&&s==0) s=i; } cout<<s; return 0; }