#include <bits/stdc++.h>
using namespace std;
int l[100000], r[100000];
int main() {
  long long(n);
  scanf("%lld", &n);
  for (long long i = 0; i < (n); ++i) scanf("%d %d", l + i, r + i);
  long long suml = 0, sumr = 0;
  for (int i = 0; i < n; ++i) {
    suml += l[i];
    sumr += r[i];
  }
  long long best = abs(suml - sumr);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (abs((suml - l[i] + r[i]) - (sumr - r[i] + l[i])) > best) {
      best = abs((suml - l[i] + r[i]) - (sumr - r[i] + l[i]));
      ans = i + 1;
    }
  }
  printf("%d\n", ans);
}
