#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, max = 0, min = 0, min_c = 0, max_c = 0, sum_l = 0, sum_r = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    sum_l += l;
    sum_r += r;
    if (i == 0) max = l - r;
    if (max < (l - r)) {
      max = l - r;
      max_c = i;
    }
    if (i == 0) min = l - r;
    if (min > l - r) {
      min_c = i;
      min = l - r;
    }
  }
  int inc = abs(sum_l - sum_r + abs(2 * min));
  int axc = abs(sum_l - sum_r - 2 * max);
  if (inc > axc && abs(sum_l - sum_r) < inc)
    cout << min_c + 1;
  else if (inc <= axc && abs(sum_l - sum_r) < axc)
    cout << max_c + 1;
  else
    cout << "0";
  return 0;
}
