#include <bits/stdc++.h>
using namespace std;
int l[100005];
int r[100005];
int main() {
#pragma warning(disable : 4996)
  int n, sl = 0, sr = 0, a, a1;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    sl += l[i];
    sr += r[i];
  }
  a = abs(sl - sr);
  a1 = 0;
  for (int i = 1; i <= n; i++) {
    if (abs(sl - l[i] + r[i] - (sr - r[i] + l[i])) > a) {
      a = abs(sl - l[i] + r[i] - (sr - r[i] + l[i]));
      a1 = i;
    }
  }
  cout << a1;
  return 0;
}
