#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, L = 0, R = 0;
  cin >> n;
  vector<vector<int> > lr;
  vector<int> xd;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    xd.push_back(l);
    xd.push_back(r);
    lr.push_back(xd);
    xd.clear();
    L = L + l;
    R = R + r;
  }
  int max = abs(L - R);
  int index = -1;
  for (int i = 0; i < lr.size(); i++) {
    L += lr[i][1] - lr[i][0];
    R += lr[i][0] - lr[i][1];
    if (abs(L - R) > max) {
      max = abs(L - R);
      index = i;
    }
    L += lr[i][0] - lr[i][1];
    R += lr[i][1] - lr[i][0];
  }
  cout << index + 1 << endl;
  return 0;
}
