// https://www.luogu.com.cn/problem/P1085
#include <iostream>
using namespace std;
int main() {
int a, b, c, i, d = 0, r;
for (i = 1; i <= 7; i++) {
cin >> a >> b;
c = a + b;
if (c >= 8 && d == 0) {
r = i;
d = c;
}
else if (c > d) {
r = i;
d = c;
}
}
cout << r;
return 0;
}