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