#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10;
int SL[MAXN], SR[MAXN];
int A[MAXN][2], n;
int main() {
  while (~scanf("%d", &n)) {
    SL[0] = SR[0] = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d%d", &A[i][0], &A[i][1]);
      SL[i] = A[i][0] + SL[i - 1];
      SR[i] = A[i][1] + SR[i - 1];
    }
    int maxn = abs(SL[n] - SR[n]);
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      int _SL = SL[n] - A[i][0] + A[i][1];
      int _SR = SR[n] - A[i][1] + A[i][0];
      int _ans = abs(_SL - _SR);
      if (maxn < _ans) {
        maxn = _ans;
        ans = i;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
