#include <bits/stdc++.h>
using namespace std;
const int MAX = 1100100;
long long N, l, r;
long long L[MAX], R[MAX], d, sol;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  for (int I = 0; I < N; I++) {
    cin >> L[I] >> R[I];
    l += L[I];
    r += R[I];
  }
  d = abs(l - r);
  for (int I = 0; I < N; I++) {
    l += +R[I] - L[I];
    r += -R[I] + L[I];
    if (abs(l - r) > d) {
      d = abs(l - r);
      sol = I + 1;
    }
    l -= +R[I] - L[I];
    r -= -R[I] + L[I];
  }
  cout << sol << endl;
}
