#include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 100 + 10;
int n;
long long l[N], r[N], L, R, maxi = 0, x;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    L += l[i];
    R += r[i];
  }
  maxi = abs(L - R);
  for (int i = 0; i < n; i++)
    if (abs(L - l[i] + r[i] - (R - r[i] + l[i])) > maxi) {
      maxi = abs(L - l[i] + r[i] - (R - r[i] + l[i]));
      x = i + 1;
    }
  cout << x << '\n';
  return 0;
}
