#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
pair<pair<int, int>, int> val[maxn];
long long res = 0;
long long resind = 0;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> val[i].first.first >> val[i].first.second;
    sum += val[i].first.first;
    sum -= val[i].first.second;
  }
  if (res < abs(sum)) {
    res = abs(sum);
    resind = 0;
  }
  for (int i = 0; i < n; i++) {
    sum -= val[i].first.first;
    sum += val[i].first.second;
    sum += val[i].first.second;
    sum -= val[i].first.first;
    if (res < abs(sum)) {
      res = abs(sum);
      resind = i + 1;
    }
    sum -= val[i].first.second;
    sum += val[i].first.first;
    sum += val[i].first.first;
    sum -= val[i].first.second;
  }
  cout << resind;
}
