from itertools import permutations





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

ans = float('inf')

for ts in permutations(cook_times):

    total = 0

    for t in ts[:-1]:

        if t % 10 == 0:

            total += t

        else:

            total += (t + 9) // 10 * 10

    ans = min(ans, total + ts[-1])

print(ans)
cook_times = sorted([int(eval(input())) for _ in range(5)], key=lambda x: (x + 9) // 10 * 10 - x)

ans = 0

for t in cook_times[:-1]:

    ans += (t + 9) // 10 * 10

print((ans + cook_times[-1]))
from itertools import permutations

cook_times = [int(eval(input())) for _ in range(5)]
ans = float("inf")
for ts in permutations(cook_times):
    total = 0
    for t in ts[:-1]:
        if t % 10 == 0:
            total += t
        else:
            total += (t + 9) // 10 * 10
    ans = min(ans, total + ts[-1])
print(ans)

cook_times = sorted(
    [int(eval(input())) for _ in range(5)], key=lambda x: (x + 9) // 10 * 10 - x
)
ans = 0
for t in cook_times[:-1]:
    ans += (t + 9) // 10 * 10
print((ans + cook_times[-1]))

-from itertools import permutations - -cook_times = [int(eval(input())) for _ in range(5)] -ans = float("inf") -for ts in permutations(cook_times): -    total = 0 -    for t in ts[:-1]: -        if t % 10 == 0: -            total += t -        else: -            total += (t + 9) // 10 * 10 -    ans = min(ans, total + ts[-1]) -print(ans) +cook_times = sorted( +    [int(eval(input())) for _ in range(5)], key=lambda x: (x + 9) // 10 * 10 - x +) +ans = 0 +for t in cook_times[:-1]: +    ans += (t + 9) // 10 * 10 +print((ans + cook_times[-1]))