A = [int(input()) for i in range(5)]
B = [A[i] % 10 for i in range(5)]
C = [10 - B[i] for i in range(5) if B[i] != 0]

ans = 0
for i in range(5):
    ans += A[i]
    if B[i]: ans += 10 - B[i]

print(ans - max(C))