#include <bits/stdc++.h>
using namespace std;
int L[100001], R[100001];
int main() {
  int n, i, l = 0, r = 0, x, k, ret = 0, val;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", L + i, R + i);
    l += L[i];
    r += R[i];
  }
  x = l - r;
  val = (int)abs(x);
  for (i = 1; i <= n; i++) {
    k = x - (L[i] - R[i]) + (R[i] - L[i]);
    k = (int)abs(k);
    if (k > val) {
      ret = i;
      val = k;
    }
  }
  printf("%d", ret);
  return 0;
}
