#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    vector<pair<long long, long long>> cl;
    long long la = 0;
    long long ra = 0;
    long long mx = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      long long l, r;
      in >> l >> r;
      cl.push_back({l, r});
      la += l;
      ra += r;
    }
    mx = max(abs(la - ra), 0LL);
    for (int i = 0; i < n; i++) {
      long long l = cl[i].first;
      long long r = cl[i].second;
      long long ta = la - l + r;
      long long tr = ra - r + l;
      if (abs(ta - tr) > mx) {
        mx = abs(ta - tr);
        ans = i + 1;
      }
    }
    out << ans;
  }
};
void solve(std::istream& in, std::ostream& out) {
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  istream& in = cin;
  ostream& out = cout;
  solve(in, out);
  return 0;
}
