#include <bits/stdc++.h>
const int Maxn = 1e5;
int a[Maxn + 5], b[Maxn + 5], c[Maxn + 5];
int n, sum1, sum2;
int x, cont;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    sum1 += a[i];
    sum2 += b[i];
  }
  x = abs(sum1 - sum2);
  for (int i = 1; i <= n; i++)
    if (abs((sum1 - a[i] + b[i]) - (sum2 + a[i] - b[i])) > x) {
      x = abs((sum1 - a[i] + b[i]) - (sum2 + a[i] - b[i]));
      cont = i;
    }
  printf("%d\n", cont);
}
