#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, l[100002], r[100002], d[100002], s = 0, max, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    d[i] = l[i] - r[i];
    s += d[i];
  }
  max = -1;
  m = s;
  for (int i = 0; i < n; i++) {
    if (abs(-2 * d[i] + s) > abs(m)) {
      max = i;
      m = -2 * d[i] + s;
    }
  }
  cout << max + 1;
}
