import Control.Monad
import Data.List

main = do
    t <- forM [1 .. 5] $ \i -> read <$> getLine
    putStrLn $ show $ solve t

solve :: [Int] -> Int
solve t = sum t + sum (take 4 $ sort $ map f t)
  where
    f x = (130 - x) `mod` 10
