n = input()
k = int(input())
dp = [[0]*(k+1) for _ in range(2)]
dp[0][0] = 1
for i in range(len(n)):
    newdp = [[0]*(k+1) for _ in range(2)]
    for j in range(k+1):
        if n[i]=='0':
            newdp[0][j] = dp[0][j]
            newdp[1][j] = dp[1][j]
            if j>0:
                newdp[1][j] += dp[1][j-1]*9
        else:
            newdp[1][j] = dp[0][j] + dp[1][j]
            if j>0:
                newdp[0][j] = dp[0][j-1]
                newdp[1][j] += dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9
    dp = newdp
print(dp[0][k]+dp[1][k]) n = input() n input() input k = int(input()) k int(input()) int input() input [0]*(k+1) for _ in range(2) for _ in range(2) _ range(2) range 2 for _ in range(2) [0]*(k+1) [0] 0 k+1 k 1 dp = [[0]*(k+1) for _ in range(2)] dp [[0]*(k+1) for _ in range(2)] dp[0][0] = 1 dp[0][0] [0] dp 0 0 1 for i in range(len(n)):
    newdp = [[0]*(k+1) for _ in range(2)]
    for j in range(k+1):
        if n[i]=='0':
            newdp[0][j] = dp[0][j]
            newdp[1][j] = dp[1][j]
            if j>0:
                newdp[1][j] += dp[1][j-1]*9
        else:
            newdp[1][j] = dp[0][j] + dp[1][j]
            if j>0:
                newdp[0][j] = dp[0][j-1]
                newdp[1][j] += dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9
    dp = newdp i range(len(n)) range len(n) len n [0]*(k+1) for _ in range(2) for _ in range(2) _ range(2) range 2 for _ in range(2) [0]*(k+1) [0] 0 k+1 k 1 newdp = [[0]*(k+1) for _ in range(2)] newdp [[0]*(k+1) for _ in range(2)] for j in range(k+1):
        if n[i]=='0':
            newdp[0][j] = dp[0][j]
            newdp[1][j] = dp[1][j]
            if j>0:
                newdp[1][j] += dp[1][j-1]*9
        else:
            newdp[1][j] = dp[0][j] + dp[1][j]
            if j>0:
                newdp[0][j] = dp[0][j-1]
                newdp[1][j] += dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9
     j range(k+1) range k+1 k 1 if n[i]=='0':
            newdp[0][j] = dp[0][j]
            newdp[1][j] = dp[1][j]
            if j>0:
                newdp[1][j] += dp[1][j-1]*9
        else:
            newdp[1][j] = dp[0][j] + dp[1][j]
            if j>0:
                newdp[0][j] = dp[0][j-1]
                newdp[1][j] += dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9
     n[i]=='0' n[i] n i '0' newdp[0][j] = dp[0][j] newdp[0][j] [0] newdp 0 j dp[0][j] [0] dp 0 j newdp[1][j] = dp[1][j] newdp[1][j] [1] newdp 1 j dp[1][j] [1] dp 1 j if j>0:
                newdp[1][j] += dp[1][j-1]*9
         j>0 j 0 newdp[1][j] += dp[1][j-1]*9 newdp[1][j] [1] newdp 1 j dp[1][j-1]*9 dp[1][j-1] [1] dp 1 j-1 j 1 9 newdp[1][j] = dp[0][j] + dp[1][j] newdp[1][j] [1] newdp 1 j dp[0][j] + dp[1][j] dp[0][j] [0] dp 0 j dp[1][j] [1] dp 1 j if j>0:
                newdp[0][j] = dp[0][j-1]
                newdp[1][j] += dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9
     j>0 j 0 newdp[0][j] = dp[0][j-1] newdp[0][j] [0] newdp 0 j dp[0][j-1] [0] dp 0 j-1 j 1 newdp[1][j] += dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9 newdp[1][j] [1] newdp 1 j dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9 dp[0][j-1]*(int(n[i])-1) dp[0][j-1] [0] dp 0 j-1 j 1 int(n[i])-1 int(n[i]) int n[i] n i 1 dp[1][j-1]*9 dp[1][j-1] [1] dp 1 j-1 j 1 9 dp = newdp dp newdp print(dp[0][k]+dp[1][k]) print dp[0][k]+dp[1][k] dp[0][k] [0] dp 0 k dp[1][k] [1] dp 1 k k = int(input()) int(input()) k newdp = [[0]*(k+1) for _ in range(2)] [[0]*(k+1) for _ in range(2)] newdp n = input() input() n dp = [[0]*(k+1) for _ in range(2)] [[0]*(k+1) for _ in range(2)] dp dp = newdp newdp dp
n = input()
k = int(input())
dp = [[0]*(k+1) for _ in range(2)]
dp[0][0] = 1
for i in range(len(n)):
    newdp = [[0]*(k+1) for _ in range(2)]
    for j in range(k+1):
        if n[i]=='0':
            newdp[0][j] = dp[0][j]
            newdp[1][j] = dp[1][j]
            if j>0:
                newdp[1][j] += dp[1][j-1]*9
        else:
            newdp[1][j] = dp[0][j] + dp[1][j]
            if j>0:
                newdp[0][j] = dp[0][j-1]
                newdp[1][j] += dp[0][j-1]*(int(n[i])-1) + dp[1][j-1]*9
    dp = newdp
print(dp[0][k]+dp[1][k])