x,y = gets.chomp.split.map(&:to_i)

p = 0
f = 300000
s = 200000
t = 100000

if x == 1
    p += f
elsif x == 2
    p += s
elsif x =- 3
    p += t
else
    p
end 

if y == 1
    p += f
elsif y == 2
    p += s
elsif y == 3
    p += t
else
    p
end 

if p == 600000
    puts p + 400000
else
    puts p
end
