#include <bits/stdc++.h>
using namespace std;
long long L = 0, R = 0;
long long l[100005], r[100005];
long long Beauty(long long l, long long r) {
  return abs(L - R - 2 * l + 2 * r);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    L += l[i];
    R += r[i];
  }
  int res = -1;
  long long Ans = abs(L - R);
  for (int i = 0; i < n; i++) {
    if (Beauty(l[i], r[i]) > Ans) res = i, Ans = Beauty(l[i], r[i]);
  }
  if (res == -1)
    cout << 0;
  else
    cout << res + 1;
}
