#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int li[n], ri[n];
  int l = 0, r = 0;
  for (int i = 0; i < n; i++) {
    cin >> li[i] >> ri[i];
    l += li[i];
    r += ri[i];
  }
  int index = 0;
  int beaut = abs(l - r);
  for (int i = 0; i < n; i++) {
    if (abs(l - r - 2 * li[i] + 2 * ri[i]) > beaut) {
      index = i + 1;
      beaut = abs(l - r - 2 * li[i] + 2 * ri[i]);
    }
  }
  cout << index;
  return 0;
}
