#include <bits/stdc++.h>
using namespace std;
int main() {
  int numberOfColumns;
  pair<int, int> column;
  int indexColumn = -1;
  int maximum = 0;
  long totalLeft = 0;
  long totalRight = 0;
  vector<pair<int, pair<int, int>>> columns;
  cin >> numberOfColumns;
  for (int i = 1; i <= numberOfColumns; ++i) {
    cin >> column.first >> column.second;
    totalLeft += column.first;
    totalRight += column.second;
    columns.push_back(make_pair(abs(column.first - column.second), column));
  }
  long beauty = abs(totalLeft - totalRight);
  for (int i = 0; i < numberOfColumns; ++i) {
    long newBeauty =
        abs((totalLeft - columns[i].second.first + columns[i].second.second) -
            (totalRight - columns[i].second.second + columns[i].second.first));
    if (beauty < newBeauty && maximum < newBeauty) {
      maximum = newBeauty;
      indexColumn = i + 1;
    }
  }
  indexColumn != -1 ? cout << indexColumn : cout << 0;
  return 0;
}
