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

LL = {}

for i in range(len(L)):
	I = str((L[i]-1))[-1]
	I = int(I)
	LL[i] = I

key = [k for k,v in LL.items() if v == min(LL.values())][0]

min = L[key]
L[key] = 0

for i in range(0,5):
	digit_one = str(L[i])[-1]
	if digit_one != "0":
		L[i] += 10 - int(digit_one)
	
print(sum(L) + min)