#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, flag, i, L = 0, R = 0, a = 0;
  cin >> n;
  int l[n], r[n], result[n];
  for (i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    L += l[i];
    R += r[i];
  }
  int max = abs(L - R);
  for (int i = 1; i <= n; i++) {
    result[i] = abs((L - l[i] + r[i]) - (R - r[i] + l[i]));
    if (max < result[i]) {
      max = result[i];
      a = i;
    }
  }
  cout << a;
  return 0;
}
