#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[100001][2];
  cin >> n;
  int i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < 2; j++) cin >> a[i][j];
  }
  int lsum = 0, rsum = 0;
  for (i = 0; i < n; i++) {
    lsum += a[i][0];
    rsum += a[i][1];
  }
  int templ, tempr, beauty, maxb, col = 0;
  maxb = abs(lsum - rsum);
  for (i = 0; i < n; i++) {
    templ = lsum;
    tempr = rsum;
    templ -= a[i][0];
    templ += a[i][1];
    tempr -= a[i][1];
    tempr += a[i][0];
    beauty = abs(templ - tempr);
    if (beauty > maxb) {
      maxb = beauty;
      col = i + 1;
    }
  }
  cout << col << endl;
  return 0;
}
