#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> arr[100009];
int main() {
  int n;
  scanf("%d", &n);
  long long L = 0, R = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
    L += arr[i].first;
    R += arr[i].second;
  }
  long long mx = ((L - R) > 0 ? (L - R) : (-(L - R)));
  int ind = -1;
  for (int i = 0; i < n; i++) {
    long long l = arr[i].first, r = arr[i].second;
    long long l1 = L - l + r, r1 = R - r + l;
    long long mx1 = ((l1 - r1) > 0 ? (l1 - r1) : (-(l1 - r1)));
    if (mx < mx1) {
      mx = mx1;
      ind = i;
    }
  }
  if (ind != -1)
    cout << ind + 1 << endl;
  else
    cout << "0\n";
  return 0;
}
