#include <bits/stdc++.h>
int abss(int a);
int main() {
  int size;
  scanf("%d", &size);
  int colunm[size + 10][2];
  int i;
  int left = 0, right = 0;
  for (i = 1; i <= size; i++) {
    scanf("%d %d", &colunm[i][0], &colunm[i][1]);
    left += colunm[i][0];
    right += colunm[i][1];
  }
  int abs = abss(left - right);
  int max = 0, temp, flag = 0;
  for (i = 1; i <= size; i++) {
    int tLeft = left;
    int tRight = right;
    tLeft = tLeft - colunm[i][0] + colunm[i][1];
    tRight = tRight - colunm[i][1] + colunm[i][0];
    int tAbs = abss(tLeft - tRight);
    temp = tAbs - abs;
    if (temp > max) {
      max = temp;
      flag = i;
    }
  }
  printf("%d", flag);
  return 0;
}
int abss(int a) {
  if (a > 0)
    return a;
  else
    return -a;
}
