main = do
  a <- readLn
  b <- readLn
  c <- readLn
  d <- readLn
  e <- readLn
  let s = [a,b,c,d,e]
  print $ sum (map f s) - 10 + minimum (map g s)

f x
  | x `mod` 10 == 0 = x
  | otherwise = (x `div` 10 + 1) * 10
g y
  | y `mod` 10 == 0 = 10
  | otherwise = y `mod` 10