X,Y=list(map(int,input().split()))

Xp=max((4-X),0)*100000

Yp=max((4-Y),0)*100000

print((Xp+Yp+((0,400000)[X*Y==1])))
X,Y=list(map(int,input().split()));print(((max((4-X),0)+max((4-Y),0)+((0,4)[X*Y==1]))*10**5))
X, Y = list(map(int, input().split()))
Xp = max((4 - X), 0) * 100000
Yp = max((4 - Y), 0) * 100000
print((Xp + Yp + ((0, 400000)[X * Y == 1])))

X, Y = list(map(int, input().split()))
print(((max((4 - X), 0) + max((4 - Y), 0) + ((0, 4)[X * Y == 1])) * 10**5))

-Xp = max((4 - X), 0) * 100000 -Yp = max((4 - Y), 0) * 100000 -print((Xp + Yp + ((0, 400000)[X * Y == 1]))) +print(((max((4 - X), 0) + max((4 - Y), 0) + ((0, 4)[X * Y == 1])) * 10**5))