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