#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *a = new int[n];
  int *b = new int[n];
  int c[100005];
  int maxi = -5000, mini = 5000;
  int res = 0, min_ind, max_ind;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    c[i] = a[i] - b[i];
    if (maxi < c[i]) {
      maxi = c[i];
      max_ind = i;
    }
    if (mini > c[i]) {
      mini = c[i];
      min_ind = i;
    }
    res += c[i];
  }
  if (maxi <= 0 || mini >= 0) {
    cout << 0;
  } else {
    if (abs(res - 2 * mini) > abs(res - 2 * maxi)) {
      cout << min_ind + 1;
    } else {
      cout << max_ind + 1;
    }
  }
  delete[] a;
  delete[] b;
  return 0;
}
