#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[100005];
int main() {
  int n, s1, s2;
  s1 = s2 = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &arr[i].first, &arr[i].second);
    s1 += arr[i].first;
    s2 += arr[i].second;
  }
  int bt = abs(s1 - s2);
  int ans = 0, z;
  for (int i = 0; i < n; i++) {
    z = abs(((s1 - arr[i].first + arr[i].second) -
             (s2 - arr[i].second + arr[i].first)));
    if (z > bt) {
      bt = z;
      ans = i + 1;
    }
  }
  printf("%d\n", ans);
}
