from itertools import permutations

from math import ceil



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

orders = list(permutations(times))

minimum = sum(ceil(time/10)*10 for time in times)



for order in orders:

    total = order[0]

    for i in range(1, 5):

        total += ceil(order[i]/10)*10

    minimum = min(minimum, total)

print(minimum)



from itertools import permutations

from math import ceil



times = list(int(eval(input())) for _ in range(5))

orders = list(permutations(times, 5))

minimum = sum(ceil(time/10)*10 for time in times)



for order in orders:

    cnt = order[0]

    for i in range(1, 5):

        cnt += ceil(order[i]/10)*10

    minimum = min(minimum, cnt)

print(minimum)

from itertools import permutations
from math import ceil

times = [int(eval(input())) for _ in range(5)]
orders = list(permutations(times))
minimum = sum(ceil(time / 10) * 10 for time in times)
for order in orders:
    total = order[0]
    for i in range(1, 5):
        total += ceil(order[i] / 10) * 10
    minimum = min(minimum, total)
print(minimum)

from itertools import permutations
from math import ceil

times = list(int(eval(input())) for _ in range(5))
orders = list(permutations(times, 5))
minimum = sum(ceil(time / 10) * 10 for time in times)
for order in orders:
    cnt = order[0]
    for i in range(1, 5):
        cnt += ceil(order[i] / 10) * 10
    minimum = min(minimum, cnt)
print(minimum)

-times = [int(eval(input())) for _ in range(5)] -orders = list(permutations(times)) +times = list(int(eval(input())) for _ in range(5)) +orders = list(permutations(times, 5)) -    total = order[0] +    cnt = order[0] -        total += ceil(order[i] / 10) * 10 -    minimum = min(minimum, total) +        cnt += ceil(order[i] / 10) * 10 +    minimum = min(minimum, cnt)