#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
int n, L[N], R[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> L[i] >> R[i];
  ll l = accumulate(L + 1, L + n + 1, 0ll);
  ll r = accumulate(R + 1, R + n + 1, 0ll);
  ll res = llabs(l - r);
  int index = 0;
  for (int i = 1; i <= n; i++) {
    ll curl = l - L[i] + R[i], curr = r - R[i] + L[i];
    if (llabs(curl - curr) > res) res = llabs(curl - curr), index = i;
  }
  cout << index;
  return 0;
}
