a = []

for i in range(5):

    b = int(eval(input()))

    c = b % 10 if b % 10 != 0 else 9

    d = (b + 10 - 1) // 10 * 10

    a.append([b, c, d])

a = sorted(a, key=lambda x: x[1], reverse=True)

total = 0

for i in range(len(a)):

    total += a[i][2]

print((total - a[i][2] + a[i][0]))

import itertools

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

mi = 10 ** 10

for i in itertools.permutations(a, 5):

    t = 0

    for j, v in enumerate(i):

        if j == 4:

            t += v

        else:

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

    mi = min(t, mi)

print(mi)

a = []
for i in range(5):
    b = int(eval(input()))
    c = b % 10 if b % 10 != 0 else 9
    d = (b + 10 - 1) // 10 * 10
    a.append([b, c, d])
a = sorted(a, key=lambda x: x[1], reverse=True)
total = 0
for i in range(len(a)):
    total += a[i][2]
print((total - a[i][2] + a[i][0]))

import itertools

a = [int(eval(input())) for _ in range(5)]
mi = 10**10
for i in itertools.permutations(a, 5):
    t = 0
    for j, v in enumerate(i):
        if j == 4:
            t += v
        else:
            t += (v + 9) // 10 * 10
    mi = min(t, mi)
print(mi)

-a = [] -for i in range(5): -    b = int(eval(input())) -    c = b % 10 if b % 10 != 0 else 9 -    d = (b + 10 - 1) // 10 * 10 -    a.append([b, c, d]) -a = sorted(a, key=lambda x: x[1], reverse=True) -total = 0 -for i in range(len(a)): -    total += a[i][2] -print((total - a[i][2] + a[i][0])) +import itertools + +a = [int(eval(input())) for _ in range(5)] +mi = 10**10 +for i in itertools.permutations(a, 5): +    t = 0 +    for j, v in enumerate(i): +        if j == 4: +            t += v +        else: +            t += (v + 9) // 10 * 10 +    mi = min(t, mi) +print(mi)