#include <bits/stdc++.h>
using namespace std;
int l[100005], r[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int lft = 0;
  int rgt = 0;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    lft += l[i];
    rgt += r[i];
  }
  l[0] = r[0] = 0;
  int ind = 0;
  for (int i = 1; i <= n; i++) {
    if (abs(lft - rgt - 2 * l[ind] + 2 * r[ind]) <
        abs(lft - rgt - 2 * l[i] + 2 * r[i])) {
      ind = i;
    }
  }
  cout << ind << endl;
}
