module Main where

import qualified Data.Vector as Vector
import Data.List as List
import Data.Vector.Unboxed as V
import qualified Data.ByteString.Char8 as BS
import Data.Maybe as Maybe

main :: IO ()
main =
    solve =<< getInts

getInt :: IO Int
getInt = read <$> BS.unpack <$> BS.getLine

splitLine :: IO [BS.ByteString]
splitLine = BS.words <$> BS.getLine

getInts :: IO (V.Vector Int)
getInts = V.fromList <$> List.map fst <$> Maybe.mapMaybe BS.readInt <$> splitLine

solve :: V.Vector Int -> IO ()
solve v = print (if (v V.! 0 == 1) && (v V.! 1 == 1) then 1000000 else V.foldl (\a b -> a + (prize b)) 0 v)

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