main = do
    a <- readLn :: IO Int
    b <- readLn :: IO Int
    c <- readLn :: IO Int
    d <- readLn :: IO Int
    e <- readLn :: IO Int
    let ls = [a,b,c,d,e]
    let modLs = filter (>0) $ map (`mod` 10) ls
    let last = if modLs == [] then 10 else minimum modLs
    let rounded = sum $ map ((*10). ceiling . (/10).fromIntegral) ls :: Int
    print $ rounded - (10-last)
