import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  (x : y : _) <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  print $ f x y

f :: Int -> Int -> Int
f x y = g x + g y + h x y

g :: Int -> Int -> Int
g 1 = 300000
g 2 = 200000
g 3 = 100000
g _ = 0

h :: Int -> Int -> Int
h 1 1 = 400000
h _ _ = 0

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
