a = [int(input()) for _ in range(5)]

maxv = 0
b = 5
for i in range(5):
    if maxv < 10 - (a[i]%10) and a[i] % 10 != 0:
        maxv, b = 10 - (a[i]%10), i

ans = 0

for i in range(5):
    if i != b:
        ans += a[i]

    if ans % 10 != 0:
        for j in range(10):
            ans += 1
            if ans % 10 == 0:
                break

ans += a[b]
print(ans)