#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  long long int left = 0, right = 0;
  int part1[n], part2[n], row = 0;
  for (int i = 0; i < n; i++) {
    cin >> part1[i] >> part2[i];
    left += part1[i];
    right += part2[i];
  }
  long long int maxSum = abs(left - right);
  for (int i = 0; i < n; i++) {
    long long int left2 = left - part1[i];
    long long int right2 = right - part2[i];
    left2 += part2[i];
    right2 += part1[i];
    if (abs(left2 - right2) > maxSum) {
      maxSum = abs(left2 - right2);
      row = i + 1;
    }
  }
  cout << row << '\n';
  return 0;
}
