a = gets.chomp.to_i
b = gets.chomp.to_i
c = gets.chomp.to_i
d = gets.chomp.to_i
e = gets.chomp.to_i

xs = [a, b, c, d, e]
x = xs.min_by { |y| z = y - (y / 10 * 10); z == 0 ? 1000 : z }
idx = xs.find_index(x)
xs.delete_at(idx)

def round(n)
  return n if (n / 10 * 10) == n
  ((n / 10) + 1) * 10
end

puts x + xs.map { |y| round(y) }.inject(:+)
