import Control.Monad
import Data.List

main :: IO ()
main = do
  ls <- replicateM 5 readLn
  let ans' = sum $ map ((*10).(`div` 10)) ls
      ls' = (filter (/= 0) $ map (`mod` 10) ls)
      ans'' = (minimum ls') + (max 0 ((length ls') - 1))*10
  print $ ans' + ans''