#include <iostream>
#include <string>
using namespacestd;
int getInt(string s) {
if (s[0] =='-') {
return0;
}
int ret =0;
for (int i =0; i < s.length(); ++ i) {
ret = ret * 10 + s[i] -'0';
}
return ret;
}
int main(int argc,const char * argv[]) {
string a[4];
while (cin >> a[0] >> a[1] >> a[2] >> a[3]) {
int max =-1, ret = 0, tmp =0;
for (int i =0; i < 4; ++ i) {
if (a[i].length()<4) {
tmp = getInt(a[i]);
if (tmp <=150 && tmp >= 0 && tmp > max) {
max = tmp;
ret = i + 1;
}
}
}
cout << ret;
}
}