#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int l[maxn], r[maxn], a[maxn];
int cmp(int a, int b) { return a < b; }
int main() {
  int n, L = 0, R = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    L += l[i];
    R += r[i];
  }
  int index, max1 = abs(L - R), flag = 0;
  for (int i = 1; i <= n; i++) {
    L = L - l[i] + r[i];
    R = R - r[i] + l[i];
    if (abs(L - R) > max1) {
      flag = 1;
      max1 = abs(L - R);
      index = i;
    }
    L = L - r[i] + l[i];
    R = R - l[i] + r[i];
  }
  if (flag)
    cout << index << endl;
  else
    cout << 0 << endl;
  return 0;
}
