A = [int(input()) for _ in range(5)]
ans = 0
I = [i for i, a in enumerate(A) if a % 10 == 0]
for i in reversed(I):
    ans += A.pop(i)
A.sort(key=lambda a: a % 10)
ans += A.pop(0)
for i in range(len(A)):
    A[i] += 10 - (A[i] % 10)
ans += sum(A)
print(ans)
