#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
int n;
int rows[N][2];
int L = 0;
int R = 0;
int main() {
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d\n", &rows[i][0], &rows[i][1]);
    L += rows[i][0];
    R += rows[i][1];
  }
  int beauty = abs(L - R);
  int maxBeauty = beauty;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int cur =
        abs((L - rows[i][0] + rows[i][1]) - (R - rows[i][1] + rows[i][0]));
    if (cur > maxBeauty) {
      ans = i + 1;
      maxBeauty = cur;
    }
  }
  cout << ans << endl;
}
