import Data.List
import Data.Bool

main = print . solve . map read . words =<< getContents

solve :: [Int] -> Int
solve ns = ns' - 10 + t
    where
        ns' = sum . map ((*10) . ceiling . (/10.0) . fromIntegral) $ ns
        ts = map (`mod` 10) ns
        ts' = filter (/=0) ts
        t = bool (minimum ts') 0 $ null ts'
