#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> arr[100001];
int main() {
  long long n, tl = 0, tr = 0, s = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i].first >> arr[i].second;
    tl += arr[i].first, tr += arr[i].second;
  }
  for (int i = 1; i <= n; i++) {
    if (abs(tl - tr) < abs(tl - tr - 2 * arr[i].first + 2 * arr[i].second +
                           2 * arr[s].first - 2 * arr[s].second))
      tl = tl - arr[i].first + arr[i].second + arr[s].first - arr[s].second,
      tr = tr + arr[i].first - arr[i].second - arr[s].first + arr[s].second,
      s = i;
  }
  cout << s;
  return 0;
}
