x = [input() for _ in range(5)]
t = 9
digits = 0
for idx, i in enumerate(x):
	digits = len(i)
	a = int(i[-1])
	if a != 0:
		if t > a:
			t = a
		if digits == 1:
			x[idx] = "10"
		elif digits == 2:
			i = str(int(i) + 10)
			x[idx] = "".join((i[-2], "0"))
		else:
			i = str(int(i) + 10)
			x[idx] = "".join((i[-3], i[-2], "0"))
print(sum([int(_) for _ in x]) - 10 + t)
