#include <bits/stdc++.h>
using namespace std;
int dr[] = {0, 1, -1, 0, 1, -1, -1, 1};
int dc[] = {-1, 0, 0, 1, 1, 1, -1, -1};
int l[100020];
int r[100020];
int main() {
  int sumL = 0, sumR = 0;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &l[i], &r[i]);
    sumL += l[i];
    sumR += r[i];
  }
  int ans = abs(sumL - sumR);
  int a, b;
  int pos = -1;
  for (int i = 0; i < n; i++) {
    a = sumL - l[i] + r[i];
    b = sumR - r[i] + l[i];
    if (abs(a - b) > ans) {
      ans = abs(a - b);
      pos = i + 1;
    }
  }
  if (pos == -1) pos = 0;
  cout << pos << endl;
  return 0;
}
