#include <bits/stdc++.h>
using namespace std;
int main() {
  int long long ar[100001], br[100001];
  int long long m1 = 0, m2 = 0, n, mx, mn, pos = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ar[i] >> br[i];
    m1 += ar[i];
    m2 += br[i];
  }
  mx = max(m1, m2);
  mn = min(m1, m2);
  int long long v = mx - mn;
  for (int i = 0; i < n; i++) {
    if (ar[i] > br[i]) {
      if (mx == m2) {
        int long long xx = mx + ar[i] - br[i];
        int long long yy = mn + br[i] - ar[i];
        if (v < xx - yy) {
          v = xx - yy;
          pos = i + 1;
        }
      } else {
        int long long xx = mx + br[i] - ar[i];
        int long long yy = mn + ar[i] - br[i];
        if (xx > yy)
          xx = xx - yy;
        else
          xx = yy - xx;
        if (v < xx) {
          v = xx;
          pos = i + 1;
        }
      }
    } else {
      if (mx == m1) {
        int long long yy = mn + ar[i] - br[i];
        int long long xx = mx + br[i] - ar[i];
        if (v < xx - yy) {
          v = xx - yy;
          pos = i + 1;
        }
      } else {
        int long long xx = mx + ar[i] - br[i];
        int long long yy = mn + br[i] - ar[i];
        if (xx > yy)
          xx = xx - yy;
        else
          xx = yy - xx;
        if (v < xx) {
          v = xx;
          pos = i + 1;
        }
      }
    }
  }
  if (pos != -1)
    cout << pos;
  else
    cout << "0";
  return 0;
}
