#include<iostream>
using namespace std;
int main()
{
int i,j,st,ast,a[7],n,temp,key;
for(i=0;i<7;i++)
{
cin>>st>>ast;
n=st+ast;
a[i]=n;
}
temp=0;
for(j=0;j<7;j++)
{
if(a[j]>temp)
{
temp=a[j];
key=j;
}
}
if(a[key]>=8)cout<<key+1;
if(a[key]<8)cout<<"0";
return 0;
}
100分但是#12没过