Very soon there will be a parade of victory over alien invaders in Berland. Unfortunately, all soldiers died in the war and now the army consists of entirely new recruits, many of whom do not even know from which leg they should begin to march. The civilian population also poorly understands from which leg recruits begin to march, so it is only important how many soldiers march in step.

There will be n columns participating in the parade, the i-th column consists of l_{i} soldiers, who start to march from left leg, and r_{i} soldiers, who start to march from right leg.

The beauty of the parade is calculated by the following formula: if L is the total number of soldiers on the parade who start to march from the left leg, and R is the total number of soldiers on the parade who start to march from the right leg, so the beauty will equal |L - R|.

No more than once you can choose one column and tell all the soldiers in this column to switch starting leg, i.e. everyone in this columns who starts the march from left leg will now start it from right leg, and vice versa. Formally, you can pick no more than one index i and swap values l_{i} and r_{i}. 

Find the index of the column, such that switching the starting leg for soldiers in it will maximize the the beauty of the parade, or determine, that no such operation can increase the current beauty.


-----Input-----

The first line contains single integer n (1 ≤ n ≤ 10^5) — the number of columns. 

The next n lines contain the pairs of integers l_{i} and r_{i} (1 ≤ l_{i}, r_{i} ≤ 500) — the number of soldiers in the i-th column which start to march from the left or the right leg respectively.


-----Output-----

Print single integer k — the number of the column in which soldiers need to change the leg from which they start to march, or 0 if the maximum beauty is already reached.

Consider that columns are numbered from 1 to n in the order they are given in the input data.

If there are several answers, print any of them.


-----Examples-----
Input
3
5 6
8 9
10 3

Output
3

Input
2
6 5
5 6

Output
1

Input
6
5 9
1 3
4 8
4 5
23 54
12 32

Output
0



-----Note-----

In the first example if you don't give the order to change the leg, the number of soldiers, who start to march from the left leg, would equal 5 + 8 + 10 = 23, and from the right leg — 6 + 9 + 3 = 18. In this case the beauty of the parade will equal |23 - 18| = 5.

If you give the order to change the leg to the third column, so the number of soldiers, who march from the left leg, will equal 5 + 8 + 3 = 16, and who march from the right leg — 6 + 9 + 10 = 25. In this case the beauty equals |16 - 25| = 9.

It is impossible to reach greater beauty by giving another orders. Thus, the maximum beauty that can be achieved is 9.

Difficulty: interview

Starter code:

Solutions:
3

n = int(input())
l = []
r = []
for i in range(n):
    a, b = list(map(int, input().split()))
    l.append(a)
    r.append(b)

L = sum(l)
R = sum(r)
mx = abs(L - R)
k = 0
for i in range(n):
    Lp = L - l[i] + r[i]
    Rp = R - r[i] + l[i]
    if abs(Lp - Rp) > mx:
        mx = abs(Lp - Rp)
        k = i + 1

print(k)


read = lambda: list(map(int, input().split()))
n = int(input())
l, r = [0] * n, [0] * n
L = R = 0
for i in range(n):
    l[i], r[i] = read()
    L += l[i]
    R += r[i]
Max = abs(L - R)
ans = 0
for i in range(n):
    cur = abs((L - l[i] + r[i]) - (R - r[i] + l[i]))
    if cur > Max:
        Max = cur
        ans = i + 1
print(ans)


#!/usr/bin/env python3


def main():
    try:
        while True:
            n = int(input())
            left = [0] * n
            right = [0] * n
            for i in range(n):
                left[i], right[i] = list(map(int, input().split()))
            ls = sum(left)
            rs = sum(right)
            best = abs(ls - rs)
            result = -1
            for i, (cl, cr) in enumerate(zip(left, right)):
                cur = abs((ls - cl + cr) - (rs - cr + cl))
                if cur > best:
                    best = cur
                    result = i

            print(result + 1)

    except EOFError:
        pass


main()


# You lost the game.

n = int(input())
C = [list(map(int, input().split())) for i in range(n)]

L = sum([C[i][0] for i in range(n)])
R = sum([C[i][1] for i in range(n)])

if 1:
    ml = 0
    mr = 0
    ind1 = -1
    ind2 = -1
    for i in range(n):
        if C[i][1]-C[i][0] > ml:
            ml = C[i][1]-C[i][0]
            ind1 = i
        elif C[i][0]-C[i][1] > mr:
            mr = C[i][0]-C[i][1]
            ind2 = i

D = abs(L-R)
D1 = abs((L+C[ind1][1]-C[ind1][0]) - (R+C[ind1][0]-C[ind1][1]))
D2 = abs((L+C[ind2][1]-C[ind2][0]) - (R+C[ind2][0]-C[ind2][1]))

if D1 > D2 and D2 > D:
    print(1+ind1)
elif D2 > D1 and D1 > D:
    print(1+ind2)
elif D2 > D:
    print(1+ind2)
elif D1 > D:
    print(1+ind1)
else:
    print(0)


n = int(input())
L, R = 0, 0
a = []
for i in range(n):
    li, ri = map(int, input().split())
    a.append([li, ri])
    L += li
    R += ri
ans = abs(L - R)
ansi = 0
for i in range(n):
    l1 = L - a[i][0] + a[i][1]
    r1 = R - a[i][1] + a[i][0]
    if abs(l1 - r1) > ans:
        ans = abs(l1 - r1)
        ansi = i + 1
print(ansi)

n = int(input())
L, R = 0, 0
a = []
for i in range(n):
    l, r = map(int, input().split())
    L += l
    R += r
    a.append([l, r])
ans = [L, R, 0]
for i in range(n):
    nL = L - a[i][0] + a[i][1]
    nR = R - a[i][1] + a[i][0]
    #print(abs(ans[0] - ans[1]), abs(nL - nR))
    if abs(ans[0] - ans[1]) < abs(nL - nR):
        ans = [nL, nR, i + 1]
print(ans[2]) 

n = int(input())
lrr = []
rrr = []
ls = 0
rs = 0
for i in range(n):
    a,b = map(int,input().split())
    lrr.append(a)
    rrr.append(b)
    ls += a
    rs += b

mx = abs(ls-rs)
mxi = 0

for i in range(n):
    k = abs((ls-lrr[i]+rrr[i])-(rs-rrr[i]+lrr[i]))
    if(mx<k):
        mx = k
        mxi = i+1
print(mxi)

n = int(input())
l = []
r = []
for i in range(n):
        li, ri = list(map(int, input().split(' ')))
        l.append(li)
        r.append(ri)
L = sum(l)
R = sum(r)
beauty = abs(L - R)
best = -1
for i in range(n):
        LL = L - l[i] + r[i]
        RR = R - r[i] + l[i]
        pos_beauty = abs(LL - RR)
        if pos_beauty > beauty:
                beauty = pos_beauty
                best = i
print(best + 1)


n = int(input())
coloms = [[None, None] for i in range(n)]
for i in range(n):
    coloms[i][0], coloms[i][1] = list(map(int, input().split()))
left_men = sum([t[0] for t in coloms])
right_men = sum([t[1] for t in coloms])
beauty = abs(left_men - right_men)
first = beauty
ans = 0
for i in range(n):
    colom = coloms[i]
    new_beauty = abs((left_men - colom[0] + colom[1]) - (right_men - colom[1] + colom[0]))
    if new_beauty > beauty:
        ans = i + 1
        beauty = new_beauty
print(ans)


n = int(input())
a = []
sl = 0
sr = 0
for i in range(n):
    q,w = list(map(int,input().split()))
    a+=[(q,w)]
    sl +=q
    sr+=w
cur = abs(sr-sl)
m = 0
for i in range(n):
    if abs((sl-a[i][0]+a[i][1]) - (sr-a[i][1]+a[i][0])) > cur:
        cur = abs((sl-a[i][0]+a[i][1]) - (sr-a[i][1]+a[i][0]))
        m = i+1
print(m)
        


n = int(input())
a = [0] * n
R = 0
L = 0
for i in range(n):
    a[i] = list(map(int, input().split()))
    R += a[i][1]
    L += a[i][0]

m = abs(L - R)
ans = 0
for i in range(n):
    b = abs((L - a[i][0] + a[i][1]) - (R - a[i][1] + a[i][0]))
    if b > m:
        ans = i + 1
        m = b

print(ans)


n = int(input())

cols = []

for i in range(n):
	cols.append(list(map(int, input().split())))


left = 0
right = 0

for col in cols:
	left += col[0]
	right += col[1]

best = -1
max_raze = abs(right - left)

for i in range(n):
	_sleft = left - cols[i][0] + cols[i][1]
	_sright = right - cols[i][1] + cols[i][0]

	if abs(_sleft - _sright) > max_raze:
		best = i
		max_raze = abs(_sleft - _sright)

print(best + 1)



n = int(input())
left = []
right = []
R = 0
L = 0
for i in range(n):
    a, b = map(int, input().split())
    left.append(a)
    L += a
    R += b
    right.append(b)
base = abs(L - R)
m = base
cur = -1
for i in range(n):
    L1 = L - left[i] + right[i]
    R1 = R - right[i] + left[i]
    curm = abs(L1 - R1)
    if curm > m:
        m = curm
        cur = i
print(cur + 1)

n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
    l[i]=l[i][0]-l[i][1]
ans=0
su=sum(l)
ma=abs(su)
for i in range(n):
    if abs(su-l[i]-l[i])>ma: ma=abs(su-l[i]-l[i]); ans=i+1
print(ans)

n = int(input())
l = []
r = []
suml  = 0
sumr  = 0
for i in range(n):
    a, b = input().split(' ')
    l.append(int(a))
    r.append(int(b))
    suml += int(a)
    sumr += int(b)
diff = abs(suml-sumr)
index = -1
for i in range(n):
    if abs((suml-l[i]+r[i])-(sumr-r[i]+l[i])) > diff:
        diff = abs((suml-l[i]+r[i])-(sumr-r[i]+l[i]))
        index = i
print(index+1)

n = int(input())
l = list([tuple(map(int, input().split())) for x in range(n)])
p, q = list(map(sum, list(zip(*l))))

o = abs(p - q)
a, ai = o, 0

for i in range(n):
	u, v = l[i]
	p += v - u
	q += u - v
	if abs(p - q) > a:
		a, ai = abs(p - q), i + 1
	p -= v - u
	q -= u - v

print(ai)


import sys

fin = sys.stdin
fout = sys.stdout
results = []
n = int(fin.readline())
columns = [0] * n
allL = 0
allR = 0
for i in range(n):
    l, r = list(map(int, fin.readline().split()))
    columns[i] = (l, r)
    allL += l
    allR += r
results.append((abs(allL - allR), -1))
for i in range(n):
    tempL = allL
    tempR = allR
    tempL -= columns[i][0]
    tempR -= columns[i][1]
    tempL += columns[i][1]
    tempR += columns[i][0]
    results.append((abs(tempL - tempR), i))
mR = results[0][0]
mN = results[0][1]
for result in results:
    if result[0] > mR:
        mR = result[0]
        mN = result[1]
fout.write(str(mN + 1))


from copy import deepcopy

def f(n, m):
    return abs(n - m)

n = int(input())
mas = []
L = 0
R = 0
for i in range(n):
    l, r = map(int, input().split())
    mas.append((l, r))
    L += l
    R += r
sum = f(L, R)
old = deepcopy(sum)
new = deepcopy(old)
#print(L, R)
for i in range(n):
    L -= mas[i][0]
    R -= mas[i][1]
    L += mas[i][1]
    R += mas[i][0]
    #print(L, R)
    if f(L, R) > new:
        ans = i
        new = f(L, R)
    L -= mas[i][1]
    R -= mas[i][0]
    L += mas[i][0]
    R += mas[i][1]
if new - old == 0:
    print(0)
else:
    print(ans + 1)

from sys import stdin as fin
# fin = open("cfr378b.in")

n = int(fin.readline())
# k, r = map(int, fin.readline().split())
# line = tuple(fin.readline().strip())
# line = fin.readline().strip()
# cols = (tuple(map(int, fin.readline().strip().split())) for i in range(n))
l, r = [None] * n, [None] * n
ls = rs = 0
for i in range(n):
    l[i], r[i] = map(int, fin.readline().strip().split())
    ls += l[i]
    rs += r[i]

maxv = abs(ls - rs)
maxi = None
for i in range(n):
    nabs = abs((ls - l[i] + r[i]) - (rs - r[i] + l[i]))
    if nabs > maxv:
        maxv = nabs
        maxi = i

print(maxi + 1 if maxi is not None else 0)

n = int(input())
a = [0] * n
l = 0
r = 0
for i in range(n):
    a[i] = list(map(int, input().split()))
    l += a[i][0]
    r += a[i][1]
best = abs(l - r)
ans = 0
for i in range(n):
    new = abs((l - a[i][0] + a[i][1]) - (r - a[i][1] + a[i][0]))
    if new > best:
        best = new
        ans = i + 1
print(ans)

import math,sys,re,itertools,pprint,collections
ri,rai=lambda:int(input()),lambda:list(map(int, input().split()))

n = ri()
a = [rai() for i in range(n)]

s = 0
for l, r in a:
    s += l - r

res = 0
sres = abs(s)

for i in range(n):
    l, r = a[i]
    s -= l - r
    s += r - l
    if abs(s) > sres:
        res = i + 1
        sres = abs(s)
    s -= r - l
    s += l - r

print(res)


n = int(input())
sum = 0
a = []
b = []
for i in range(0, n):
    c = input()
    c = c.split()
    a.append(int(c[0]))
    b.append(int(c[1]))
    sum += a[i] - b[i]
v = abs(sum)
ans = -1
for i in range(0, n):
    vv = sum - 2*(a[i] - b[i])
    vv = abs(vv)
    if(vv > v):
        v = vv
        ans = i
print(ans + 1)

n = int(input());
l = [0] * n;
r = [0] * n;

cur_res = 0;
for i in range(n):
    l[i], r[i] = [int(x) for x in input().split()];
    cur_res += l[i] - r[i];

max_res = abs(cur_res);
max_indx = -1;

for i in range(n):
    tmp_res = abs(cur_res - 2 * (l[i] - r[i]));
    if tmp_res > max_res:
        max_res = tmp_res;
        max_indx = i;

print((max_indx + 1));


n = int(input())
l, r = 0, 0
a = [] 
for i in range(n):
    l_i, r_i = map(int, input().split())
    l += l_i
    r += r_i
    a.append([l_i, r_i])
ans = abs(l - r)
ind = 0
for i in range(n):
    if (abs(l - a[i][0] + a[i][1] - (r - a[i][1] + a[i][0])) > ans):
        ans = abs(l - a[i][0] + a[i][1] - (r - a[i][1] + a[i][0]))
        ind = i + 1
print(ind)