n = input()
K = int(input())
L = len(n)

dp = [[[0] * (K + 2) for _ in range(2)] for __ in range(L + 1)]
dp[0][1][0] = 1

for i in range(L):
    d = int(n[i])
    for j in [0, 1]:
        for k in range(K + 1):
            if j == 0:
                dp[i + 1][j][k] += dp[i][j][k]
                dp[i + 1][j][k + 1] += dp[i][j][k] * 9
            else:
                if d > 0:
                    dp[i + 1][0][k] += dp[i][j][k]
                    dp[i + 1][0][k + 1] += dp[i][j][k] * (d - 1)
                    dp[i + 1][1][k + 1] += dp[i][j][k]
                else:
                    dp[i + 1][1][k] += dp[i][j][k]


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

dp = [[[0] * (K + 2) for _ in range(2)] for __ in range(L + 1)]
dp[0][1][0] = 1

for i in range(L):
    d = int(n[i])
    for j in [0, 1]:
        for k in range(K + 1):
            if j == 0:
                dp[i + 1][j][k] += dp[i][j][k]
                dp[i + 1][j][k + 1] += dp[i][j][k] * 9
            else:
                if d > 0:
                    dp[i + 1][0][k] += dp[i][j][k]
                    dp[i + 1][0][k + 1] += dp[i][j][k] * (d - 1)
                    dp[i + 1][1][k + 1] += dp[i][j][k]
                else:
                    dp[i + 1][1][k] += dp[i][j][k]


print(dp[L][0][K] + dp[L][1][K])

