import           Control.Monad (replicateM)
import           Data.List     (sortOn)

main :: IO ()
main = do
  ts <- replicateM 5 readLn
  print $ solve ts

solve :: [Int] -> Int
solve ts =
  let
    m : rest  = sortOn ((`mod` 10) . subtract 1) ts
  in
    sum $ m : map ceiling10 rest

ceiling10 :: Int -> Int
ceiling10 = (* 10) . ceiling . (/ 10) . (fromIntegral :: Int -> Double)
