A=[int(input()) for  i in range(5)]
B=[int(str(A[i])[-1]) for i in range(5)]
if B==[0]*5:
	print(sum(A))
else:
	for i in range(5):
		if B[i]==0:
			B[i]=10
	ans=min(B)
	o=B.index(ans)
print((sum(A)-A[o])+10-(sum(A)-A[o])%10+A[o])