#include <bits/stdc++.h>
using namespace std;
const int maxi = 100010;
int main() {
  int n;
  cin >> n;
  int left, right;
  left = right = 0;
  int arr[maxi];
  int brr[maxi];
  for (int i = 0; i < n; i++) {
    cin >> arr[i] >> brr[i];
    left += arr[i];
    right += brr[i];
  }
  int diff = abs(left - right);
  int max_id = 0;
  for (int i = 0; i < n; i++) {
    int l = (left - arr[i]) + brr[i];
    int r = (right - brr[i]) + arr[i];
    if (abs(l - r) > diff) {
      diff = abs(l - r);
      max_id = i + 1;
    }
  }
  cout << max_id << endl;
  return 0;
}
