#include <bits/stdc++.h>
using namespace std;
int l[100009], r[100009];
int sum1 = 0, sum2 = 0;
int suml1[100009], suml2[100009], sumr1[100009], sumr2[100009];
int main() {
  int n;
  cin >> n;
  suml1[0] = 0;
  sumr1[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    suml1[i] = suml1[i - 1] + l[i];
    sumr1[i] = sumr1[i - 1] + r[i];
    sum1 += l[i];
    sum2 += r[i];
  }
  for (int i = 1; i <= n; i++) {
    suml2[i] = sum1 - suml1[i];
    sumr2[i] = sum2 - sumr1[i];
  }
  int res = abs(sum1 - sum2);
  int kq = 0;
  for (int i = 1; i <= n; i++) {
    if (res < abs((suml1[i] + suml2[i] - l[i] + r[i]) -
                  (sumr1[i] + sumr2[i] - r[i] + l[i]))) {
      res = abs((suml1[i] + suml2[i] - l[i] + r[i]) -
                (sumr1[i] + sumr2[i] - r[i] + l[i]));
      kq = i;
    }
  }
  cout << kq;
}
