import math 



al = []

for _ in range(5):

    al.append(int(eval(input())))

    



tmp = 11

log = -1

for idx,a in enumerate(al):

    point = a % 10

    if point == 0:

        point = 10

    if tmp > point:

        tmp = point

        log = idx



ans = 0

for idx, a in enumerate(al):

    if idx != log:

        ans += math.ceil(a / 10) * 10

    else:

        ans += a

    

print(ans)
ans = 0

def ceil(a, b):

   return a // b + (a % b > 0)

big = 0

for _ in range(5):

    a = int(eval(input()))

    ans += ceil(a, 10) * 10

    if a % 10 != 0:

        big = max(big, 10-(a%10))



print((ans-big))





import math

al = []
for _ in range(5):
    al.append(int(eval(input())))
tmp = 11
log = -1
for idx, a in enumerate(al):
    point = a % 10
    if point == 0:
        point = 10
    if tmp > point:
        tmp = point
        log = idx
ans = 0
for idx, a in enumerate(al):
    if idx != log:
        ans += math.ceil(a / 10) * 10
    else:
        ans += a
print(ans)

ans = 0


def ceil(a, b):
    return a // b + (a % b > 0)


big = 0
for _ in range(5):
    a = int(eval(input()))
    ans += ceil(a, 10) * 10
    if a % 10 != 0:
        big = max(big, 10 - (a % 10))
print((ans - big))

-import math +ans = 0 -al = [] + +def ceil(a, b): +    return a // b + (a % b > 0) + + +big = 0 -    al.append(int(eval(input()))) -tmp = 11 -log = -1 -for idx, a in enumerate(al): -    point = a % 10 -    if point == 0: -        point = 10 -    if tmp > point: -        tmp = point -        log = idx -ans = 0 -for idx, a in enumerate(al): -    if idx != log: -        ans += math.ceil(a / 10) * 10 -    else: -        ans += a -print(ans) +    a = int(eval(input())) +    ans += ceil(a, 10) * 10 +    if a % 10 != 0: +        big = max(big, 10 - (a % 10)) +print((ans - big))