#include <bits/stdc++.h>
using namespace std;
long int abc(long int x) {
  if (x < 0)
    return -x;
  else
    return x;
}
int main() {
  long int n, a, b, suma = 0, sumb = 0, maxa = 0, maxb = 0, na = 0, nb = 0,
                    ans1, ans2, ans3;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    suma += a;
    sumb += b;
    if (b - a > maxa) {
      maxa = b - a;
      na = i + 1;
    }
    if (a - b > maxb) {
      maxb = a - b;
      nb = i + 1;
    }
  }
  ans1 = abc(suma - sumb);
  ans2 = abc(suma + maxa * 2 - sumb);
  ans3 = abc(sumb + maxb * 2 - suma);
  if ((ans1 > ans2) && (ans1 > ans3))
    cout << 0;
  else if (ans2 > ans3)
    cout << na;
  else
    cout << nb;
  return 0;
}
