#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, b, index = 0, maxneg = 0, maxpos = 0, maxnegi = 0, maxposi = 0,
            totalpos = 0, totalneg = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    int diff = a - b;
    if (diff > 0) {
      totalpos += diff;
      if (diff > maxpos) {
        maxposi = i;
        maxpos = diff;
      }
    } else if (diff < 0) {
      totalneg += diff;
      if (diff < maxneg) {
        maxnegi = i;
        maxneg = diff;
      }
    } else
      continue;
    if (totalpos - maxpos >= maxneg - totalneg)
      index = maxnegi;
    else if (totalpos - maxpos < maxneg - totalneg)
      index = maxposi;
  }
  cout << index;
  return 0;
}
