def abc(n):
    if n % 10 == 0:
        return n
    else:
        return n + 10 - (n%10)

ans = 0
mods = []

for _ in range(5):
    tmp = int(input())
    ans += abc(tmp)
    mods.append(tmp%10)

if not set(mods) == {0}:
    ans -= 10
    ans += min(mods)

print(ans)