#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
int main() {
  int n, s1 = 0, s2 = 0, max, col = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x, y;
    cin >> x >> y;
    s2 += y;
    s1 += x;
    a[i] = x;
    b[i] = y;
  }
  max = abs(s1 - s2);
  for (int i = 1; i <= n; ++i) {
    int x = s1 - a[i] + b[i];
    int y = s2 + a[i] - b[i];
    if (abs(x - y) > max) {
      max = abs(x - y);
      col = i;
    }
  }
  cout << col;
  return 0;
}
