#include <bits/stdc++.h>
using namespace std;
int ans(vector<pair<int, int> > v, int n) {
  int lsum = 0, rsum = 0, ns, a;
  for (int i = 0; i < n; i++) {
    lsum += v[i].first;
    rsum += v[i].second;
  }
  ns = abs(lsum - rsum);
  int msum = ns;
  bool flag = false;
  for (int i = 0; i < n; i++) {
    if (msum < abs(lsum - 2 * v[i].first - rsum + 2 * v[i].second)) {
      flag = true;
      msum = abs(lsum - 2 * v[i].first - rsum + 2 * v[i].second);
      a = i;
    }
  }
  if (flag)
    return a + 1;
  else
    return 0;
}
int main() {
  int n, l, r;
  cin >> n;
  vector<pair<int, int> > v;
  v.clear();
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    v.push_back(make_pair(l, r));
  }
  cout << ans(v, n);
  return 0;
}
