#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> l(n), r(n);
  int sml = 0, smr = 0;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    sml += l[i];
    smr += r[i];
  }
  int mxb = abs(sml - smr);
  int col = 0;
  for (int i = 0; i < n; i++) {
    if (abs(sml - l[i] + r[i] - (smr - r[i] + l[i])) > mxb) {
      col = i + 1;
      mxb = abs(sml - l[i] + r[i] - (smr - r[i] + l[i]));
    }
  }
  cout << col << endl;
}
