x,y = list(map(int,input().split()))

amount = 0

if x < 4:

  amount += (4-x)*100000

if y < 4:

  amount += (4-y)*100000

if x ==1 and y==1:

  amount += 400000

print(amount)
x,y = list(map(int,input().split()))



def f(x):

  if x==3:

    return 100000

  elif x==2:

    return 200000

  elif x== 1:

    return 300000

  else:

    return 0



ans = f(x)+f(y)

if x == y== 1:

  ans += 400000

print(ans)
x, y = list(map(int, input().split()))
amount = 0
if x < 4:
    amount += (4 - x) * 100000
if y < 4:
    amount += (4 - y) * 100000
if x == 1 and y == 1:
    amount += 400000
print(amount)

x, y = list(map(int, input().split()))


def f(x):
    if x == 3:
        return 100000
    elif x == 2:
        return 200000
    elif x == 1:
        return 300000
    else:
        return 0


ans = f(x) + f(y)
if x == y == 1:
    ans += 400000
print(ans)

-amount = 0 -if x < 4: -    amount += (4 - x) * 100000 -if y < 4: -    amount += (4 - y) * 100000 -if x == 1 and y == 1: -    amount += 400000 -print(amount) + + +def f(x): +    if x == 3: +        return 100000 +    elif x == 2: +        return 200000 +    elif x == 1: +        return 300000 +    else: +        return 0 + + +ans = f(x) + f(y) +if x == y == 1: +    ans += 400000 +print(ans)