#include <bits/stdc++.h>
int aa[(100000 + 5)];
int abs(int x) { return x > 0 ? x : -x; }
int main() {
  int n;
  while (~scanf("%d", &n)) {
    int x, y, tmp;
    int sum = 0, pos = -1;
    for (int i = 0; i < n; i++)
      scanf("%d%d", &x, &y), sum += x - y, aa[i] = x - y;
    tmp = abs(sum);
    for (int i = 0; i < n; i++)
      if (tmp < abs(sum - 2 * aa[i])) tmp = abs(sum - 2 * aa[i]), pos = i;
    printf("%d\n", pos + 1);
  }
  return 0;
}
