arr = Array.new(5)
5.times do |i|
	arr[i] = gets.chomp.to_i
end

min = 10
arr.each do |a|
	ngo = a.to_s[-1].to_i 
	min = ngo if min > ngo && ngo != 0
end

cnt = 0
arr.each do |a|
	cnt += (a / 10.0).ceil * 10
end
cnt -= (10 - min) if min != 10
puts cnt


