#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, INF = INT_MAX;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> l(n), r(n);
  int L = 0, R = 0;
  for (int i = 0; i < n; ++i) {
    cin >> l[i] >> r[i];
    L += l[i];
    R += r[i];
  }
  int ans = abs(L - R), pos = -1;
  for (int i = 0; i < n; ++i) {
    int ll = L - l[i] + r[i];
    int rr = R - r[i] + l[i];
    if (abs(ll - rr) > ans) {
      ans = abs(ll - rr);
      pos = i;
    }
  }
  cout << (pos != -1 ? pos + 1 : 0);
  return 0;
}
