#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, i, j, k = 0, l = 0, t = 0, c, x = 0, y = 0;
  cin >> n;
  long long a[n + 5], b[n + 5];
  for (i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    x += a[i];
    y += b[i];
  }
  long long mx = abs(x - y);
  for (i = 1; i <= n; i++) {
    t = x - a[i] + b[i];
    l = y - b[i] + a[i];
    if (abs(t - l) > mx) {
      k = i;
      mx = abs(t - l);
    }
  }
  cout << k << endl;
}
