# Arup Guha
# 9/27/24
# Solution to 2024 UCF Qualifier Problem: Basketball Score

# Returns the score of a team where team[i] stores the number
# of shots worth i+1 points.
def weightscore(team):
    res = 0
    for i in range(len(team)):
        res += (i+1)*team[i]
    return res

# Get team buckets.
team1 = [int(x) for x in input().split()]
team2 = [int(x) for x in input().split()]

# Get scores of both teams.
t1score = weightscore(team1)
t2score = weightscore(team2)

# Output winner or tie.
if t1score > t2score:
    print(1)
elif t2score > t1score:
    print(2)
else:
    print(0)
