#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
int N, L[100111], R[100111];
int main() {
  scanf("%d", &N);
  for (int i = 0, i_len = (N); i < i_len; ++i) scanf("%d%d", L + i, R + i);
  int sum = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i) sum += L[i] - R[i];
  int cost = abs(sum), pos = 0;
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    int tmp = sum + 2 * (R[i] - L[i]);
    if (abs(tmp) > cost) {
      cost = abs(tmp);
      pos = i + 1;
    }
  }
  printf("%d\n", pos);
  return 0;
}
