A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0
print(B)
for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)
