#include <bits/stdc++.h>
using namespace std;
bool sizes(string a, string b) { return a.size() < b.size(); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n = 0, m = 0, mn = 1000000000007, d = 0, mx = 0, h = 0, l = 0,
            w = 0, r = 0, k = 0, j = 0, i = 0, ans;
  cin >> n;
  vector<int> a, b;
  for (int i = 0; i < n; i++) {
    cin >> d >> m;
    a.push_back(d);
    b.push_back(m);
    h += d;
    k += m;
  }
  d = abs(h - k);
  for (int i = 0; i < n; i++) {
    m = abs(((h - a[i]) + b[i]) - ((k - b[i]) + a[i]));
    if (m > d) {
      d = m;
      l = i + 1;
    }
  }
  cout << l << endl;
}
