#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long N = 1e5 + 7;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
long long n;
long long r, l;
long long cnt, ans, pos;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  long long arr[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i] >> b[i];
    l += arr[i];
    r += b[i];
  }
  cnt = abs(l - r);
  for (int i = 0; i < n; i++) {
    ans = abs(l - r + 2 * b[i] - 2 * arr[i]);
    if (ans > cnt) cnt = ans, pos = i + 1;
  }
  cout << pos << endl;
  return 0;
}
