#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[200000][2] = {};
  int n, m = 0, q = 0, l = 0, k = 0, p2 = 0, s1 = 0, s2 = 0, p1 = 0, r = 0,
         b = 0, num11 = 0, num12 = 0, num21 = 0, num22 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    r += a[i][0];
    b += a[i][1];
    if (a[i][0] > a[i][1]) {
      m++;
      l = a[i][0] - a[i][1];
      if (s1 < l) {
        s1 = l;
        p1 = i;
        num11 = a[i][0];
        num12 = a[i][1];
      }
    } else if (a[i][0] < a[i][1]) {
      q++;
      k = a[i][1] - a[i][0];
      if (s2 < k) {
        s2 = k;
        p2 = i;
        num22 = a[i][1];
        num21 = a[i][0];
      }
    }
  }
  if (m == 0 || q == 0)
    cout << "0";
  else if (abs(r - 2 * num11 + 2 * num12 - b) >=
           abs(b - 2 * num22 + 2 * num21 - r)) {
    cout << p1 + 1;
  } else {
    cout << p2 + 1;
  }
}
