import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner reader=new Scanner(System.in);
int time[][]=new int[7][2];
for (int i=0;i<7;i++){
time [i][0]=reader.nextInt();
time [i][1]=reader.nextInt();
}
int count=0;
int most=time [0][0];
int k=0;
for (int i=0;i<7;i++){
int j=time [i][0]+time [i][1];
if (j>8){
count++;
}
if(j>most){
most=j;
k=i;
}
}
if(count==0){
System.out.println(0);
}else {
System.out.println(k+1);
}
}
}