import Data.List.Split

import Data.List
import Control.Monad

getLineRepeat :: Int -> IO [String]
getLineRepeat times = replicateM times getLine

adjust :: Int -> Int
adjust num = let rem = num `mod` 10 in if rem == 0 then num else num + (10 - rem)

mod' n d = let m = mod n d in if m == 0 then d else m

main = do
    input <- getLineRepeat 5
    let set = read <$> input :: [Int]
    let sorted = sortBy (\a b -> compare (b `mod'` 10) (a `mod'` 10)) set
    let ans = sum . (map adjust) . init $ sorted
    putStrLn . show $ ans + (last sorted)
