#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int l[n], r[n];
  int suml = 0, sumr = 0;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    suml += l[i];
    sumr += r[i];
  }
  int bty = abs(suml - sumr);
  int mbty, key = 0, tbty = bty;
  for (int i = 0; i < n; i++) {
    int templ = suml, tempr = sumr;
    templ = templ - l[i] + r[i];
    tempr = tempr - r[i] + l[i];
    mbty = abs(templ - tempr);
    if (mbty > tbty) {
      key = i + 1;
      tbty = mbty;
    }
  }
  cout << key << endl;
  return 0;
}
