list = []
amari = []
amari_min = 100
real = []
sum = 0
5.times do
  list << gets.chomp.to_i
end
for i in 0..4 do
  amari << (list[i] % 10)
end
for i in 0..4 do
  if (list[i] % 10) == 0
    real << list[i]
  else
    real << (list[i] / 10 + 1) * 10
    if (list[i] % 10) < amari_min
      amari_min = (list[i] % 10)
    end
  end
end
for i in 0..4 do
  sum += real[i]
end
if amari_min != 100
  realsum = sum - 10 + amari_min
else
  realsum = sum  
end
puts realsum
