x = []
x << gets.chomp.to_f
x << gets.chomp.to_f
x << gets.chomp.to_f
x << gets.chomp.to_f
x << gets.chomp.to_f
y = []
z = []
for a in 0..4
  y << (x[a] / 10).ceil * 10
  z << y[a] - x[a]
end
ss = z.index(z.max)
result = y.inject(0) { |sum, x| sum + x } - y[ss] + x[ss]
result = result.to_i
puts result
