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