import Control.Monad (replicateM)

main :: IO ()
main = do
  ns <- map (read :: String -> Int) <$> getNLine_ 5
  print $ ans ns

ans :: [Int] -> Int
ans ns = ds + m
  where ds = (+(-10)) . sum $ map (\n -> let r = n `mod` 10 in if r == 0 then n else n - r + 10) ns
        m = (\k -> if k == [] then 0 else minimum k) . filter (/= 0) $ map (`mod` 10) ns

getNLine_ :: Int -> IO [String]
getNLine_ n = replicateM n getLine