#include <bits/stdc++.h>
using namespace std;
const int big = 1e5 + 7;
int l[big], r[big], record[big];
int main() {
  int n, num = 0, p = 0, q = 0, large, temp;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &l[i], &r[i]);
    p += l[i];
    q += r[i];
  }
  large = p - q;
  if (large < 0) large = -large;
  record[num++] = 0;
  for (int i = 1; i <= n; i++) {
    p += (r[i] - l[i]);
    q += (l[i] - r[i]);
    temp = p - q;
    if (temp < 0) temp = -temp;
    if (temp == large)
      record[num++] = i;
    else if (temp > large) {
      large = abs(p - q);
      num = 0;
      record[num++] = i;
    }
    p += (l[i] - r[i]);
    q += (r[i] - l[i]);
  }
  printf("%d", record[0]);
  return 0;
}
