strN = input().rstrip()
K = int(input())

maxD = len(strN)

dp = [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)]
dp[0][0][0] = 1
for d, Nd in enumerate(strN):
    Nd = int(Nd)
    for isLtN in range(2):
        for numNot0 in range(K+1):
            for x in range(10):
                if not isLtN and x > Nd: continue
                isLtN2 = isLtN or x < Nd
                numNot02 = numNot0 + (x != 0)
                if numNot02 > K: continue
                dp[d+1][isLtN2][numNot02] += dp[d][isLtN][numNot0]

ans = dp[-1][0][K] + dp[-1][1][K]
print(ans) strN = input().rstrip() strN input().rstrip() ().rstrip () input rstrip K = int(input()) K int(input()) int input() input maxD = len(strN) maxD len(strN) len strN [[0]*(K+1) for j in range(2)] for i in range(maxD+1) for i in range(maxD+1) i range(maxD+1) range maxD+1 maxD 1 for i in range(maxD+1) [[0]*(K+1) for j in range(2)] dp = [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)] dp [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)] dp[0][0][0] = 1 dp[0][0][0] [0] [0] dp 0 0 0 1 for d, Nd in enumerate(strN):
    Nd = int(Nd)
    for isLtN in range(2):
        for numNot0 in range(K+1):
            for x in range(10):
                if not isLtN and x > Nd: continue
                isLtN2 = isLtN or x < Nd
                numNot02 = numNot0 + (x != 0)
                if numNot02 > K: continue
                dp[d+1][isLtN2][numNot02] += dp[d][isLtN][numNot0] d Nd enumerate(strN) enumerate strN Nd = int(Nd) Nd int(Nd) int Nd for isLtN in range(2):
        for numNot0 in range(K+1):
            for x in range(10):
                if not isLtN and x > Nd: continue
                isLtN2 = isLtN or x < Nd
                numNot02 = numNot0 + (x != 0)
                if numNot02 > K: continue
                dp[d+1][isLtN2][numNot02] += dp[d][isLtN][numNot0] isLtN range(2) range 2 for numNot0 in range(K+1):
            for x in range(10):
                if not isLtN and x > Nd: continue
                isLtN2 = isLtN or x < Nd
                numNot02 = numNot0 + (x != 0)
                if numNot02 > K: continue
                dp[d+1][isLtN2][numNot02] += dp[d][isLtN][numNot0] numNot0 range(K+1) range K+1 K 1 for x in range(10):
                if not isLtN and x > Nd: continue
                isLtN2 = isLtN or x < Nd
                numNot02 = numNot0 + (x != 0)
                if numNot02 > K: continue
                dp[d+1][isLtN2][numNot02] += dp[d][isLtN][numNot0] x range(10) range 10 if not isLtN and x > Nd: continue
                 not isLtN and x > Nd not isLtN isLtN x > Nd x Nd isLtN2 = isLtN or x < Nd isLtN2 isLtN or x < Nd isLtN x < Nd x Nd numNot02 = numNot0 + (x != 0) numNot02 numNot0 + (x != 0) numNot0 x != 0 x 0 if numNot02 > K: continue
                 numNot02 > K numNot02 K dp[d+1][isLtN2][numNot02] += dp[d][isLtN][numNot0] dp[d+1][isLtN2][numNot02] [isLtN2] [d+1] dp d+1 d 1 isLtN2 numNot02 dp[d][isLtN][numNot0] [isLtN] [d] dp d isLtN numNot0 ans = dp[-1][0][K] + dp[-1][1][K] ans dp[-1][0][K] + dp[-1][1][K] dp[-1][0][K] [0] [-1] dp -1 0 K dp[-1][1][K] [1] [-1] dp -1 1 K print(ans) print ans K = int(input()) int(input()) K strN = input().rstrip() input().rstrip() strN numNot02 = numNot0 + (x != 0) numNot0 + (x != 0) numNot02 dp = [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)] [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)] dp Nd = int(Nd) int(Nd) Nd isLtN2 = isLtN or x < Nd isLtN or x < Nd isLtN2 maxD = len(strN) len(strN) maxD ans = dp[-1][0][K] + dp[-1][1][K] dp[-1][0][K] + dp[-1][1][K] ans
strN = input().rstrip()
K = int(input())

maxD = len(strN)

dp = [[[0]*(K+1) for j in range(2)] for i in range(maxD+1)]
dp[0][0][0] = 1
for d, Nd in enumerate(strN):
    Nd = int(Nd)
    for isLtN in range(2):
        for numNot0 in range(K+1):
            for x in range(10):
                if not isLtN and x > Nd: continue
                isLtN2 = isLtN or x < Nd
                numNot02 = numNot0 + (x != 0)
                if numNot02 > K: continue
                dp[d+1][isLtN2][numNot02] += dp[d][isLtN][numNot0]

ans = dp[-1][0][K] + dp[-1][1][K]
print(ans)
