#include <bits/stdc++.h>
using namespace std;
const int MYDD = 1103 + 1e5;
int main() {
  int n, l[MYDD], r[MYDD], sl = 0, sr = 0;
  scanf("%d", &n);
  for (int j = 0; j < n; j++) {
    scanf("%d %d", &l[j], &r[j]);
    sl += l[j];
    sr += r[j];
  }
  int maxk = abs(sl - sr), ans = 0;
  for (int j = 0; j < n; j++) {
    int ki = abs((sl - l[j] + r[j]) - (sr - r[j] + l[j]));
    if (ki > maxk) {
      maxk = ki;
      ans = j + 1;
    }
  }
  printf("%d\n", ans);
}
