*A, = map(int, open(0).read().split())
#print(A)
B = [ A[i]%10 for i in range(5) ]
#print(B)
idx = 0
d = B[0]
for l in B:
    if l <= d:
        d=l
        idx+=1
    elif l == 0:
        idx+=1
#print(idx)
A2 = []
A2.extend(A)
for i in range(5):
    if A[i]%10 != 0:
        A2[i] = (A[i]//10+1)*10
#print(A2)
A2.pop(idx)
#print(A2)
print(sum(A2)+A[idx])
#print(A[idx])
#print(A)