#include <bits/stdc++.h>
using namespace std;
int l[100100], r[100100], a[100100];
int main() {
  int n, lsum, rsum, x, m, f;
  while (~scanf("%d", &n)) {
    lsum = 0;
    rsum = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d%d", &l[i], &r[i]);
      lsum += l[i];
      rsum += r[i];
    }
    m = abs(lsum - rsum);
    f = 0;
    for (int i = 1; i <= n; i++) {
      lsum = lsum - l[i] + r[i];
      rsum = rsum - r[i] + l[i];
      if (abs(lsum - rsum) > m) {
        f = 1;
        m = abs(lsum - rsum);
        x = i;
      }
      lsum = lsum - r[i] + l[i];
      rsum = rsum - l[i] + r[i];
    }
    if (f)
      cout << x << endl;
    else
      cout << 0 << endl;
  }
  return 0;
}
