import Control.Monad
main = do
    a <- replicateM 5 readLn
    let s = sum (map ((*10) . ceiling . (/10) . fromIntegral) a)
    let m = maximum $ 0:[10 - (x `mod` 10) | x <- a , x `mod` 10 > 0]
    print $ s - m