#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r = 0, l = 0;
  vector<int> d;
  cin >> n;
  d.resize(n);
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    l += x;
    r += y;
    d[i] = x - y;
  }
  int maxx = abs(r - l), n_max = -1;
  for (int i = 0; i < n; ++i) {
    int dl = l - d[i], dr = r + d[i];
    if (abs(dr - dl) > maxx) {
      maxx = abs(dr - dl);
      n_max = i + 1;
    }
  }
  if (n_max == -1)
    cout << 0 << endl;
  else
    cout << n_max;
  return 0;
}
