a = list(map(int,[input() for i in range(5)]))
b = 10
c = 0
d = False
for i in a:
	if i % 10 > 0:
		c += i + 10 - i % 10
		print("i: {}, c: {}".format(i,c))
		if b > i % 10:
			b = i % 10
	else:
		c += i
print(c-10+b)
