import Control.Monad

toInt :: String -> Int
toInt = read :: String -> Int

main = do
  a <- map toInt <$> replicateM 5 getLine
  let s = sum . map (* 10) . map ceiling . map (/ 10) . map fromIntegral $ a
  let l = maximum $ map (\x -> mod (10 - (mod x 10)) 10) a
  print $ (s - l)
