#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, left[100000], right[100000], left_sum = 0, right_sum = 0,
                                                index, temp = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> left[i] >> right[i];
    left_sum += left[i];
    right_sum += right[i];
  }
  long long int left_tem, right_tem, res1, com = 0;
  int flag = 0;
  res1 = abs(left_sum - right_sum);
  for (int i = 0; i < n; i++) {
    left_tem = left_sum - left[i] + right[i];
    right_tem = right_sum - right[i] + left[i];
    if (abs(left_tem - right_tem) > com) {
      com = abs(left_tem - right_tem);
      index = i;
    }
  }
  if (com < res1)
    cout << 0 << endl;
  else
    cout << index + 1 << endl;
  return 0;
}
