#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> arr[100000 + 5];
int main() {
  cin >> n;
  int L = 0, R = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i].first >> arr[i].second;
    L += arr[i].first;
    R += arr[i].second;
  }
  int ans = abs(L - R);
  int id = 0;
  for (int i = 1; i <= n; i++) {
    if (ans < abs(L - R + 2 * (arr[i].second - arr[i].first))) {
      ans = abs(L - R + 2 * (arr[i].second - arr[i].first));
      id = i;
    }
  }
  cout << id << endl;
}
