#include <bits/stdc++.h>
using namespace std;
bool vovel(char c) {
  return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'Y';
}
vector<pair<long long int, long long int>> v;
int main() {
  long long int N, L, R;
  long long int cntL = 0, cntR = 0;
  cin >> N;
  for (long long int i = (0); i < (N); ++i) {
    cin >> L >> R;
    v.push_back(make_pair(L, R));
    cntL += L;
    cntR += R;
  }
  long long int res = abs(cntL - cntR);
  long long int mybest = res;
  long long int imp = 0;
  for (long long int i = (0); i < (N); ++i) {
    long long int x = (abs((cntL - v[i].first + v[i].second) -
                           (cntR - v[i].second + v[i].first)));
    if (x > res) {
      if (x > mybest) {
        mybest = x;
        imp = i + 1;
      }
    }
  }
  cout << imp << endl;
  return 0;
}
