a=int(eval(input()))

b=int(eval(input()))

c=int(eval(input()))

d=int(eval(input()))

e=int(eval(input()))

def time(x):

    return (x+9)//10*10

def last(x):

    return time(x)-x

sum_time=time(a)+time(b)+time(c)+time(d)+time(e)

ans=sum_time-max(last(a),last(b),last(c),last(d),last(e))

print(ans)
a=int(eval(input()))

b=int(eval(input()))

c=int(eval(input()))

d=int(eval(input()))

e=int(eval(input()))

def time(x):

    return (x+9)//10*10

def last(x):

    return time(x)-x

sum_tim=time(a)+time(b)+time(c)+time(d)+time(e)

ans=sum_tim-max(last(a),last(b),last(c),last(d),last(e))

print(ans)
a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))


def time(x):
    return (x + 9) // 10 * 10


def last(x):
    return time(x) - x


sum_time = time(a) + time(b) + time(c) + time(d) + time(e)
ans = sum_time - max(last(a), last(b), last(c), last(d), last(e))
print(ans)

a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
d = int(eval(input()))
e = int(eval(input()))


def time(x):
    return (x + 9) // 10 * 10


def last(x):
    return time(x) - x


sum_tim = time(a) + time(b) + time(c) + time(d) + time(e)
ans = sum_tim - max(last(a), last(b), last(c), last(d), last(e))
print(ans)

-sum_time = time(a) + time(b) + time(c) + time(d) + time(e) -ans = sum_time - max(last(a), last(b), last(c), last(d), last(e)) +sum_tim = time(a) + time(b) + time(c) + time(d) + time(e) +ans = sum_tim - max(last(a), last(b), last(c), last(d), last(e))