import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;

void main() {
  int N = readln().chomp.to!int;
  int Lsum = 0;
  int Rsum = 0;
  int[] L = new int[](N);
  int[] R = new int[](N);
  foreach (i; iota(N)) {
    auto input = readln().split.map!(to!int);
    Lsum += input[0];
    Rsum += input[1];
    L[i] = input[0];
    R[i] = input[1];
  }
  int max_b = abs(Lsum-Rsum);
  int max_i = 0;
  foreach (i; iota(N)) {
    if (max_b < abs((Lsum-L[i]+R[i])-(Rsum-R[i]+L[i]))) {
      max_b = abs((Lsum-L[i]+R[i])-(Rsum-R[i]+L[i]));
      max_i = i+1;
    }
  }

  writeln(max_i);
}
