#include <bits/stdc++.h>
using namespace std;
void swapArray(int array1[], int element1, int array2[], int element2) {
  int temp;
  temp = array1[element1];
  array1[element1] = array2[element2];
  array2[element2] = temp;
}
int main() {
  int n;
  cin >> n;
  int* l = new int[n];
  int* r = new int[n];
  int max = 0, L = 0, R = 0, res = 0, end = 0;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
    cin >> r[i];
    L = L + l[i];
    R = R + r[i];
  }
  int constl = L, constr = R;
  max = abs(L - R);
  for (int i = 0; i < n; i++) {
    L = L - l[i] + r[i];
    R = R - r[i] + l[i];
    res = abs(L - R);
    if (res > max) {
      max = res;
      end = i + 1;
    }
    L = constl;
    R = constr;
  }
  cout << end;
}
