#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> p[1000010];
int main() {
  long long n, i, suml = 0, sumr = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
    suml += p[i].first;
    sumr += p[i].second;
  }
  long long diff = abs(suml - sumr);
  long long viv = 0;
  for (i = 0; i < n; i++) {
    long long left = suml;
    long long right = sumr;
    left -= p[i].first;
    left += p[i].second;
    right -= p[i].second;
    right += p[i].first;
    if (abs(left - right) > diff) {
      viv = i + 1;
      diff = abs(left - right);
    }
  }
  cout << viv;
}
