a = [int(input()) for i in range(5)]

sum = 0
rest = 10

for i in a:
	if i % 10 < rest:
		sum = ((sum - 1) // 10 + 1) * 10 if sum != 0 else 0
		sum += i
	else:
		sum += ((i - 1) // 10 + 1) * 10
		
print(sum)