import math

total = 0

first_min = 10

for _ in range(5):

    time = int(eval(input()))

    total += math.ceil(time/10)*10

    if first_min > time%10 > 0:

        first_min = time%10

print((total-10+first_min))
dishes = [int(eval(input())) for _ in range(5)]

diffs = [-(-dish//10)*10 - dish for dish in dishes]

print((sum(dishes) + sum(diffs) - max(diffs)))
import math

total = 0
first_min = 10
for _ in range(5):
    time = int(eval(input()))
    total += math.ceil(time / 10) * 10
    if first_min > time % 10 > 0:
        first_min = time % 10
print((total - 10 + first_min))

dishes = [int(eval(input())) for _ in range(5)]
diffs = [-(-dish // 10) * 10 - dish for dish in dishes]
print((sum(dishes) + sum(diffs) - max(diffs)))

-import math - -total = 0 -first_min = 10 -for _ in range(5): -    time = int(eval(input())) -    total += math.ceil(time / 10) * 10 -    if first_min > time % 10 > 0: -        first_min = time % 10 -print((total - 10 + first_min)) +dishes = [int(eval(input())) for _ in range(5)] +diffs = [-(-dish // 10) * 10 - dish for dish in dishes] +print((sum(dishes) + sum(diffs) - max(diffs)))