time = []
for i in range(5):
	time.append(int(input()))
remain = []
for i in range(5):
	if time[i] % 10 != 0:
		remain.append(10 - time[i] % 10)
sum = 0
for i in range(5):
	if time[i] % 10 == 0:
		sum += time[i]
	else:
		sum += (time[i] // 10 + 1) * 10

print(sum - max(remain))