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