attrs = Array.new
while line = $stdin.gets
    attrs << line.chomp.split.map{|v| v.to_i }
end

attrs.flatten!
mod_paar = attrs.map{|v| [v, v.modulo(10)]}
mod_paar = mod_paar.sort{|a, b|
  b[1] <=> a[1] 
  }

time = 0

zero_count = 0
mod_paar.each do |paar| 
  if paar[1] == 0 then
    time += paar[0]
    zero_count += 1
  end
end

if zero_count > 0 then
  zero_count.times do mod_paar.pop end
end

for i in 0..(mod_paar.length - 1) do
  if i == (mod_paar.length - 1) then
    time += mod_paar[i][0]
  else
    tmp = ((mod_paar[i][0] / 10.0).ceil * 10)
    time += tmp
  end
end

puts time