dish_arr = 5.times.map{|i| gets.chomp.to_i }

min = 11
index = 0
dish_arr.each_with_index do |d, i|
  q = d % 10
  q = 10 if q == 0
  if q < min
    index = i
    min = q
  end
end

result = 0
dish_arr.each_with_index do |d, i|
  if i != index
    q = d % 10
    q = 10 if q == 0
    result += d + 10 - q
  end
end

result += dish_arr[index]
puts result