def kiriage(i):
    if i % 10 == 0:
        return i
    else:
        juu = i // 10
        return (juu + 1) * 10

time = [int(input()) for _ in range(5)]
ans = 643
for t1 in time:
    total = 0
    copied = time.copy()
    copied.remove(t1)
    total += kiriage(t1)
    for t2 in copied:
        copied.remove(t2)
        total += kiriage(t2)
        for t3 in copied:
            copied.remove(t3)
            total += kiriage(t3)
            for t4 in copied:
                copied.remove(t4)
                total += kiriage(t4)
                for t5 in copied:
                    copied.remove(t5)
                    total += t5

                    ans = min(ans, total)

print(ans)