import Control.Monad

fl::Int->Int
fl n = if mod n 10 == 0 then n else (n + 10) - (mod n 10)

mod_size::Int->Int
mod_size n = if mod n 10 == 0 then 0 else 10 - (mod n 10)


solver::[Int]->Int
solver ls = (sum (map fl ls)) - (maximum (map mod_size ls))

main::IO()
main=do
  ls<-forM [1..5] (\_ -> return.read=<<getLine)
  print (solver ls)
