#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int dis[100005];
  int l, r, sum;
  while (~scanf("%d", &n)) {
    sum = 0;
    int flagr = 1, flagl = 1;
    for (int i = 1; i <= n; i++) {
      scanf("%d%d", &l, &r);
      dis[i] = r - l;
      sum += dis[i];
      if (dis[i] > 0) {
        flagl = 0;
      } else if (dis[i] < 0)
        flagr = 0;
    }
    if (flagr + flagl == 1) {
      printf("0\n");
    } else {
      int flag = 0;
      int maxn = -1;
      for (int i = 1; i <= n; i++) {
        int ans = abs(sum - 2 * dis[i]);
        if (ans > maxn) {
          flag = i;
          maxn = ans;
        }
      }
      printf("%d\n", flag);
    }
  }
  return 0;
}
