#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r = 0, l = 0, num = -1, a[100000], b[100000], max;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    l += a[i];
    r += b[i];
  }
  max = abs(l - r);
  for (int i = 0; i < n; i++) {
    if (max < abs((l - a[i] + b[i]) - (r - b[i] + a[i]))) {
      num = i;
      max = abs((l - a[i] + b[i]) - (r - b[i] + a[i]));
    }
  }
  cout << ++num;
  return 0;
}
