#include <bits/stdc++.h>
using namespace std;
long long int n, l[222222], r[222222], mx = 0, k, q, ll, rr, ll1, rr1, ans,
                                       ans1;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    ll = ll + l[i];
    rr = rr + r[i];
  }
  k = ll - rr;
  for (int i = 1; i <= n; i++) {
    q = k - l[i] * 2 + r[i] * 2;
    if (abs(q) > abs(k) && abs(q) > mx) {
      mx = abs(q);
      ans1 = i;
    }
  }
  cout << ans1;
  return 0;
}
