import           Control.Monad
import           Data.Bool
import           Data.List
import qualified Data.Vector   as V

readInt = readLn :: IO Int

readInts = map read . words <$> getLine :: IO [Int]

readNInts = flip replicateM readInts

main :: IO ()
main = do
  ae <- replicateM 5 readLn :: IO [Int]
  let sorted = sortOn (`mod` 10) ae
      a = f sorted
      as = del a sorted
  print $ a + sum (map roundInt as)

roundInt :: Int -> Int
roundInt n
  | n `mod` 10 == 0 = n
  | otherwise = (* 10) . (+ 1) $ n `div` 10

f [x] = x
f (x:xs)
  | x `mod` 10 == 0 = f xs
  | otherwise = x

del :: Int -> [Int] -> [Int]
del n [] = []
del n (x:xs)
  | n == x = xs
  | otherwise = x : del n xs