from itertools import permutations

foods = [int(eval(input())) for i in range(5)]

ans = 1230

for i in permutations(foods):

    tmp = 0

    for j in range(4):

        tmp += -(-i[j] // 10)

    tmp *= 10

    tmp += i[4]

    ans = min(ans, tmp)

print(ans)
foods = [int(eval(input())) for i in range(5)]

amari = [i % 10 for i in foods]

kiriage = [-(-i//10) for i in foods]

min_amari = 10

for i in amari:

    if 1 <= i < min_amari:

        min_amari = i

print((sum(kiriage) * 10 - (10 - (10 if max(amari) == 0 else min_amari))))
from itertools import permutations

foods = [int(eval(input())) for i in range(5)]
ans = 1230
for i in permutations(foods):
    tmp = 0
    for j in range(4):
        tmp += -(-i[j] // 10)
    tmp *= 10
    tmp += i[4]
    ans = min(ans, tmp)
print(ans)

foods = [int(eval(input())) for i in range(5)]
amari = [i % 10 for i in foods]
kiriage = [-(-i // 10) for i in foods]
min_amari = 10
for i in amari:
    if 1 <= i < min_amari:
        min_amari = i
print((sum(kiriage) * 10 - (10 - (10 if max(amari) == 0 else min_amari))))

-from itertools import permutations - -ans = 1230 -for i in permutations(foods): -    tmp = 0 -    for j in range(4): -        tmp += -(-i[j] // 10) -    tmp *= 10 -    tmp += i[4] -    ans = min(ans, tmp) -print(ans) +amari = [i % 10 for i in foods] +kiriage = [-(-i // 10) for i in foods] +min_amari = 10 +for i in amari: +    if 1 <= i < min_amari: +        min_amari = i +print((sum(kiriage) * 10 - (10 - (10 if max(amari) == 0 else min_amari))))