#include <bits/stdc++.h>
using namespace std;
int arr[10000000], brr[10000000];
int main() {
  int n, i, j, k, l, t, r, e = 0;
  ;
  int mi = 1;
  cin >> n;
  long long sum = 0, rum = 0, d, m;
  for (i = 0; i < n; i++) {
    cin >> arr[i] >> brr[i];
    sum += arr[i];
    rum += brr[i];
  }
  long long mx = abs(sum - rum);
  for (i = 0; i < n; i++) {
    d = sum - arr[i];
    d += brr[i];
    m = rum - brr[i];
    m += arr[i];
    if (abs(d - m) > mx) {
      e = i + 1;
      mx = abs(d - m);
    }
  }
  cout << e << endl;
  return 0;
}
