#include <bits/stdc++.h>
using namespace std;
int a[101000], b[101000];
int main() {
  int n;
  scanf("%d", &n);
  int suma = 0, sumb = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", a + i, b + i);
    suma += a[i];
    sumb += b[i];
  }
  int id = 0;
  int ma = abs(suma - sumb);
  for (int i = 0; i < n; i++) {
    if (abs(suma + b[i] - a[i] - (sumb - b[i] + a[i])) > ma) {
      ma = abs(suma - sumb + 2 * b[i] - 2 * a[i]);
      id = i + 1;
    }
    if (abs(sumb + a[i] - b[i] - (suma - a[i] + b[i])) > ma) {
      ma = abs(sumb + a[i] - b[i] - (suma - a[i] + b[i]));
      id = i + 1;
    }
  }
  printf("%d\n", id);
  return 0;
}
