import Data.List (permutations)

main = do
    a <- readLn :: IO Integer
    b <- readLn :: IO Integer
    c <- readLn :: IO Integer
    d <- readLn :: IO Integer
    e <- readLn :: IO Integer
    print $ minimum $ map takeTimes (permutations [a, b, c, d, e])
    
takeTimes :: [Integer] -> Integer
takeTimes ls =
    sum (map ce heads) + t
    where
        heads = init ls
        t = last ls

ce :: Integer -> Integer
ce a =
    div a 10 * 10 + t
    where
        t = if mod a 10 == 0 then 0 else 10
