#include <bits/stdc++.h>
using namespace std;
int L[100100], R[100100];
int main(void) {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) scanf("%d%d", &L[i], &R[i]);
    int sumL = 0, sumR = 0;
    for (int i = 0; i < n; i++) sumL += L[i], sumR += R[i];
    int mn = abs(sumL - sumR), ans = -1;
    for (int i = 0; i < n; i++) {
      int LL = sumL - L[i] + R[i];
      int RR = sumR - R[i] + L[i];
      if (mn < abs(LL - RR)) {
        mn = abs(LL - RR);
        ans = i;
      }
    }
    printf("%d\n", ans + 1);
  }
}
