#include <bits/stdc++.h>
int a[100000][2];
int main(void) {
  int n, i, j, temp, A = 0, B = 0, max = 0, flag = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++)
    for (j = 0; j < 2; j++) {
      scanf("%d", &a[i][j]);
    }
  for (i = 0; i < n; i++) {
    A += a[i][0];
    B += a[i][1];
  }
  for (i = 0; i < n; i++) {
    if (fabs(A - B) < fabs(A - B - 2 * a[i][0] + 2 * a[i][1]) &&
        fabs(A - B - 2 * a[i][0] + 2 * a[i][1]) > max) {
      temp = i + 1;
      max = fabs(A - B - 2 * a[i][0] + 2 * a[i][1]);
      flag = 1;
    }
  }
  printf("%d\n", temp);
}
