#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<int, int>> columns;
  int n, l, r, ltot = 0, rtot = 0;
  pair<int, int> best;
  cin >> n;
  for (int i = 0; i != n; ++i) {
    cin >> l >> r;
    ltot += l;
    rtot += r;
    columns.push_back(make_pair(l, r));
  }
  best = make_pair(0, abs(ltot - rtot));
  for (int i = 0; i != n; ++i) {
    if (abs(rtot - ltot + 2 * columns[i].first - 2 * columns[i].second) >
        best.second) {
      best = make_pair(i + 1, abs(rtot - ltot + 2 * columns[i].first -
                                  2 * columns[i].second));
    }
  }
  cout << best.first << endl;
  int asd;
  cin >> asd;
  return 0;
}
