A= int(input())
B= int(input())
C= int(input())
D= int(input())
E= int(input())

l = [A,B,C,D,E]

r = list(map(lambda x:x % 10,l))
r = [x if x != 0 else 10 for x in r]

index = r.index(min(r))

ans = 0

for i in range(5):
	if i == index:
		ans += l[i]
	else:
		ans += (l[i]//10 + 1) * 10

print(ans)
