#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int l, r;
} TSave;
const int N = 1000001;
TSave a[N];
int main() {
  int n;
  long long L = 0, R = 0;
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    L += a[i].l;
    R += a[i].r;
  }
  int ans = 0;
  long long mL = L, mR = R;
  for (int i = (0); i < (n); i++) {
    long long tL = L - a[i].l + a[i].r, tR = R - a[i].r + a[i].l;
    if (llabs(tL - tR) > llabs(mL - mR)) {
      mL = tL;
      mR = tR;
      ans = i + 1;
    }
  }
  printf("%d", ans);
  return 0;
}
