#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long ans = 0;
  long long total;
  long long tleft = 0;
  long long tright = 0;
  vector<pair<long long, long long> > soldier;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    soldier.push_back(make_pair(a, b));
    tleft += a;
    tright += b;
  }
  total = abs(tleft - tright);
  for (long long i = 0; i < n; i++) {
    tleft -= soldier[i].first;
    tleft += soldier[i].second;
    tright -= soldier[i].second;
    tright += soldier[i].first;
    if (total < abs(tleft - tright)) {
      total = abs(tleft - tright);
      ans = i + 1;
    }
    tleft += soldier[i].first;
    tleft -= soldier[i].second;
    tright += soldier[i].second;
    tright -= soldier[i].first;
  }
  cout << ans << endl;
}
