#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> l(n), r(n);
  int ret = 0, mx = 0;
  int L = 0, R = 0;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    L += l[i];
    R += r[i];
  }
  mx = abs(L - R);
  for (int i = 0; i < n; i++) {
    L = L - l[i] + r[i];
    R = R - r[i] + l[i];
    int cur = abs(L - R);
    if (cur > mx) {
      ret = i + 1;
      mx = cur;
    }
    L = L - r[i] + l[i];
    R = R - l[i] + r[i];
  }
  cout << ret << endl;
  return 0;
}
