#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr1[n];
  int arr2[n];
  int diff[n];
  long long sum1 = 0;
  long long sum2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr1[i];
    cin >> arr2[i];
    diff[i] = arr1[i] - arr2[i];
    sum1 += arr1[i];
    sum2 += arr2[i];
  }
  int maxdiff = abs(sum1 - sum2);
  int index = 0;
  for (int i = 0; i < n; i++) {
    if (abs((sum1 - arr1[i] + arr2[i]) - (sum2 - arr2[i] + arr1[i])) >
        maxdiff) {
      maxdiff = abs((sum1 - arr1[i] + arr2[i]) - (sum2 - arr2[i] + arr1[i]));
      index = i + 1;
    }
  }
  cout << index << endl;
  return 0;
}
