import Control.Monad (replicateM)

main :: IO ()
main = do
  ns <- map (read :: String -> Int) <$> getNLine_ 5
  print $ sum (map kuriage ns) - 10 + (minimum . filter (/= 0) $ map (`mod` 10) ns)

kuriage :: Int -> Int
kuriage n = let r = n `mod` 10 in if r == 0 then n else n - r + 10

getNLine_ :: Int -> IO [String]
getNLine_ n = replicateM n getLine