#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, n1 = 1, n2 = 1;
  scanf("%d", &n);
  scanf("%d %d", &a, &b);
  a -= b;
  int mn = a, mx = a, sum = a;
  for (int i = 2; i <= n; i++) {
    scanf("%d %d", &a, &b);
    a -= b;
    if (a < mn) {
      mn = a;
      n1 = i;
    }
    if (a > mx) {
      mx = a;
      n2 = i;
    }
    sum += a;
  }
  int t = abs(sum), no = 0;
  if (abs(sum - 2 * mn) > t) {
    t = abs(sum - 2 * mn);
    no = n1;
  }
  if (abs(sum - 2 * mx) > t) {
    t = abs(sum - 2 * mn);
    no = n2;
  }
  printf("%d\n", no);
  return 0;
}
