#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, lsum = 0, l[100000], r[100000], rsum = 0, diffmax = INT_MIN,
                   flag, ind, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    lsum = lsum + l[i];
    rsum = rsum + r[i];
  }
  diffmax = abs(lsum - rsum);
  flag = 0;
  for (i = 0; i < n; i++) {
    if (abs((lsum + r[i] - l[i]) - (rsum + l[i] - r[i])) > diffmax) {
      diffmax = abs((lsum + r[i] - l[i]) - (rsum + l[i] - r[i]));
      ind = i + 1;
      flag = 1;
    }
  }
  if (!flag)
    cout << 0 << endl;
  else
    cout << ind << endl;
  return 0;
}
