arr = []
result = 0

5.times do
	temp = gets.chomp.to_i
	temp2 = temp % 10 != 0 ? temp % 10 : 100 
	arr << [temp,temp2]
end

arr.sort_by!{|i| i[1]}

arr.each_with_index do |item,idx|
	if idx == 0
		result += item[0]
		next
	end

	result += (item[0] / 10) * 10
	result += 10 if item[0] % 10 > 0

end

puts result