#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001, inf = 100000000, infn = -100000000;
struct parade {
  int dif, ind;
};
bool caca(parade a, parade b) {
  if (a.dif < b.dif)
    return true;
  else
    return false;
}
int n, l, r, totl, totr, tot, d, ans, pos;
parade row[MAXN];
int main() {
  while (cin >> n) {
    totl = 0;
    totr = 0;
    for (int i = 0; i < (int)(n); i++) {
      cin >> l >> r;
      row[i].dif = l - r;
      row[i].ind = i + 1;
      totl += l;
      totr += r;
    }
    tot = totl - totr;
    ans = abs(tot);
    pos = 0;
    for (int i = 0; i < (int)(n); i++) {
      d = tot - 2 * row[i].dif;
      if (ans < abs(d)) {
        ans = abs(d);
        pos = row[i].ind;
      }
    }
    cout << pos << endl;
  }
  return 0;
}
