import Control.Monad
import Data.List
main = do
  ts <- replicateM 5 readLn :: IO [Int]
  let (x:ys) = sortOn ((`mod` 11) . (+ 10) . (`mod` 10)) ts
  print $ x + sum (map (\y -> if mod y 10 == 0 then y else (div y 10 + 1)*10 ) ys)