#include <bits/stdc++.h>
using namespace std;
int main() {
  int s[100005], n, a, b, k;
  cin >> n;
  long long l = 0;
  long long r = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    s[i] = a - b;
    l += a;
    r += b;
  }
  int ans = abs(l - r);
  k = -1;
  for (int i = 0; i < n; i++) {
    long long ll = l - s[i];
    long long rr = r + s[i];
    if (abs(ll - rr) > ans) {
      ans = abs(ll - rr);
      k = i;
    }
  }
  printf("%d\n", k + 1);
  return 0;
}
