#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int lc, rc;
  lc = 0;
  rc = 0;
  vector<pair<int, int> > values(n);
  for (int i = 0; i < n; i++) {
    cin >> values[i].first;
    cin >> values[i].second;
    lc = lc + values[i].first;
    rc = rc + values[i].second;
  }
  int beauty = abs(lc - rc);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int lctemp = lc + values[i].second - values[i].first;
    int rctemp = rc + values[i].first - values[i].second;
    int tempbeauty = abs(lctemp - rctemp);
    if (tempbeauty > beauty) {
      beauty = tempbeauty;
      ans = i + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
