#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long l[n], r[n], L = 0, R = 0;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    L += l[i];
    R += r[i];
  }
  long long LT = L, RT = R, mx = abs(L - R), c = 0;
  for (int i = 0; i < n; i++) {
    L -= l[i];
    L += r[i];
    R -= r[i];
    R += l[i];
    if (abs(L - R) > mx) {
      mx = abs(L - R);
      c = i + 1;
    }
    L = LT;
    R = RT;
  }
  cout << c;
}
