#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l = 0, r = 0, k = 0, x = -1;
  cin >> n;
  int a[n][3];
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    l += a[i][0];
    r += a[i][1];
  }
  k = abs(l - r);
  for (int i = 0; i < n; i++) {
    a[i][2] = abs((l - a[i][0] + a[i][1]) - (r - a[i][1] + a[i][0]));
    if (k < a[i][2]) k = a[i][2], x = i;
  }
  cout << x + 1 << endl;
  return 0;
}
