#include <bits/stdc++.h>
using namespace std;
long long exp(long long b, long long e) {
  if (b == 1 || e == 0) return 1;
  if (e == 1) return b % 1000000007;
  if (e == 2) return (b * b) % 1000000007;
  return ((e % 2 == 0)
              ? exp(exp(b, e / 2), 2) % 1000000007
              : (b * (exp(exp(b, e / 2), 2) % 1000000007)) % 1000000007);
}
long long gcd(long long a, long long b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
int l[100005], r[100005];
int main() {
  int n, i, j, k = 0, L = 0, R = 0;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> l[i] >> r[i];
    R += r[i];
    L += l[i];
  }
  k = (((L - R) > 0) ? (L - R) : (-1) * (L - R));
  int idx = -1;
  for (i = 0; i < n; ++i) {
    j = 2 * (r[i] - l[i]);
    if (k < (((L - R + j) > 0) ? (L - R + j) : (-1) * (L - R + j))) {
      k = (((L - R + j) > 0) ? (L - R + j) : (-1) * (L - R + j));
      idx = i;
    }
  }
  cout << idx + 1 << endl;
  return 0;
}
