rewards = [0,0300000,200000,100000]++repeat 0

main = do
	[x,y] <- map read.words <$> getLine
	putStrLn.show $ calc x y

calc 1 1 = rewards !! 1 + rewards !! 1 + 400000
calc x y = rewards !! x + rewards !! y