#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n], b[n];
  long long int l = 0, r = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    l += a[i];
    r += b[i];
  }
  long long int sum = (abs(l - r));
  long long int t = 0;
  for (long long int i = 0; i < n; i++) {
    long long int j = l - a[i] + b[i];
    long long int k = r - b[i] + a[i];
    if (abs(j - k) > sum) {
      t = i + 1;
      sum = abs(j - k);
    }
  }
  cout << t << endl;
}
