#include <bits/stdc++.h>
using namespace std;
long long Rnumbs, Lnumbs;
int L[100001], R[100001];
int n;
bool loop() {
  Lnumbs = 0;
  Rnumbs = 0;
  for (int i = 1; i <= n; i++) {
    cin >> L[i] >> R[i];
    Lnumbs += L[i];
    Rnumbs += R[i];
  }
  int k = 0;
  long long maxs = abs(Lnumbs - Rnumbs);
  for (int i = 1; i <= n; i++) {
    if (maxs < abs((Lnumbs - L[i] + R[i]) - (Rnumbs - R[i] + L[i]))) {
      k = i;
      maxs = abs((Lnumbs - L[i] + R[i]) - (Rnumbs - R[i] + L[i]));
    }
  }
  cout << k << endl;
  return true;
}
int main() {
  cin.tie(0);
  cin.sync_with_stdio(false);
  while (cin >> n) loop();
  return 0;
}
