#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l[100001], r[100001];
  cin >> n;
  long long int maxl = 0, maxr = 0;
  int diff = 0, ind = -1;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    maxl += l[i];
    maxr += r[i];
  }
  for (int a = 0; a < n; a++) {
    if ((l[a] - r[a] > diff || (l[a] - r[a] == diff && l[a] - r[a] != 0)) &&
        maxl - l[a] < maxr - r[a]) {
      diff = l[a] - r[a];
      ind = a;
    } else if ((r[a] - l[a] > diff ||
                (r[a] - l[a] == diff && r[a] - l[a] != 0)) &&
               maxl - l[a] > maxr - r[a]) {
      diff = r[a] - l[a];
      ind = a;
    }
  }
  if (ind == (-1)) {
    cout << "0";
  } else {
    cout << ind + 1;
  }
  return 0;
}
