#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m, count = 0, c = 0, L = 0, R = 0, result = 0, l1, r1;
  int a[100002], b[100002];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    L = L + a[i];
    R = R + b[i];
  }
  result = abs(L - R);
  for (i = 0; i < n; i++) {
    l1 = L - a[i] + b[i];
    r1 = R - b[i] + a[i];
    c = abs(l1 - r1);
    if (c > result) {
      result = c;
      count = i + 1;
    }
  }
  cout << count;
}
