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

B = sorted(A)
sum = 0

for i in range(len(B)):
    y,x = B[i]
    sum += x
    if i == 0:
        sum -= 10-y

print(sum)
