#include <bits/stdc++.h>
using namespace std;
int main() {
  long long l = 0, r = 0, n;
  cin >> n;
  vector<pair<long long, long long> > v(n);
  vector<long long> t(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i].first >> v[i].second;
    t[i] = v[i].first - v[i].second;
    l += v[i].first;
    r += v[i].second;
  }
  long long maxx = abs(l - r), maxi = -1;
  for (int i = 0; i < n; ++i) {
    if (maxx < abs(l - r - 2 * t[i])) {
      maxx = abs(l - r - 2 * t[i]);
      maxi = i;
    }
  }
  cout << maxi + 1 << endl;
}
