n = input()
k = int(input())

dp = [[[0] * (k+1) for _ in range(2)] for _ in range(len(n)+1)]
dp[0][0][0] = 1

for i in range(1, len(n) + 1):
    t = int(n[i-1])
    for j in range(k+1):
        if t != 0:
            if j != 0:
                dp[i][0][j] += dp[i-1][0][j-1]
                dp[i][1][j] += dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1)
            dp[i][1][j] += (dp[i-1][1][j] + dp[i-1][0][j])
        else:
            dp[i][0][j] += dp[i-1][0][j]
            if j != 0:
                dp[i][1][j] += dp[i-1][1][j-1] * 9
            dp[i][1][j] += dp[i-1][1][j]

print(dp[len(n)][0][k] + dp[len(n)][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(len(n)+1) for _ in range(len(n)+1) _ range(len(n)+1) range len(n)+1 len(n) len n 1 for _ in range(len(n)+1) [[0] * (k+1) for _ in range(2)] dp = [[[0] * (k+1) for _ in range(2)] for _ in range(len(n)+1)] dp [[[0] * (k+1) for _ in range(2)] for _ in range(len(n)+1)] dp[0][0][0] = 1 dp[0][0][0] [0] [0] dp 0 0 0 1 for i in range(1, len(n) + 1):
    t = int(n[i-1])
    for j in range(k+1):
        if t != 0:
            if j != 0:
                dp[i][0][j] += dp[i-1][0][j-1]
                dp[i][1][j] += dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1)
            dp[i][1][j] += (dp[i-1][1][j] + dp[i-1][0][j])
        else:
            dp[i][0][j] += dp[i-1][0][j]
            if j != 0:
                dp[i][1][j] += dp[i-1][1][j-1] * 9
            dp[i][1][j] += dp[i-1][1][j] i range(1, len(n) + 1) range 1 len(n) + 1 len(n) len n 1 t = int(n[i-1]) t int(n[i-1]) int n[i-1] n i-1 i 1 for j in range(k+1):
        if t != 0:
            if j != 0:
                dp[i][0][j] += dp[i-1][0][j-1]
                dp[i][1][j] += dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1)
            dp[i][1][j] += (dp[i-1][1][j] + dp[i-1][0][j])
        else:
            dp[i][0][j] += dp[i-1][0][j]
            if j != 0:
                dp[i][1][j] += dp[i-1][1][j-1] * 9
            dp[i][1][j] += dp[i-1][1][j] j range(k+1) range k+1 k 1 if t != 0:
            if j != 0:
                dp[i][0][j] += dp[i-1][0][j-1]
                dp[i][1][j] += dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1)
            dp[i][1][j] += (dp[i-1][1][j] + dp[i-1][0][j])
        else:
            dp[i][0][j] += dp[i-1][0][j]
            if j != 0:
                dp[i][1][j] += dp[i-1][1][j-1] * 9
            dp[i][1][j] += dp[i-1][1][j] t != 0 t 0 if j != 0:
                dp[i][0][j] += dp[i-1][0][j-1]
                dp[i][1][j] += dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1)
             j != 0 j 0 dp[i][0][j] += dp[i-1][0][j-1] dp[i][0][j] [0] [i] dp i 0 j dp[i-1][0][j-1] [0] [i-1] dp i-1 i 1 0 j-1 j 1 dp[i][1][j] += dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1) dp[i][1][j] [1] [i] dp i 1 j dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1) dp[i-1][1][j-1] * 9 dp[i-1][1][j-1] [1] [i-1] dp i-1 i 1 1 j-1 j 1 9 dp[i-1][0][j-1] * (t-1) dp[i-1][0][j-1] [0] [i-1] dp i-1 i 1 0 j-1 j 1 t-1 t 1 dp[i][1][j] += (dp[i-1][1][j] + dp[i-1][0][j]) dp[i][1][j] [1] [i] dp i 1 j dp[i-1][1][j] + dp[i-1][0][j] dp[i-1][1][j] [1] [i-1] dp i-1 i 1 1 j dp[i-1][0][j] [0] [i-1] dp i-1 i 1 0 j dp[i][0][j] += dp[i-1][0][j] dp[i][0][j] [0] [i] dp i 0 j dp[i-1][0][j] [0] [i-1] dp i-1 i 1 0 j if j != 0:
                dp[i][1][j] += dp[i-1][1][j-1] * 9
             j != 0 j 0 dp[i][1][j] += dp[i-1][1][j-1] * 9 dp[i][1][j] [1] [i] dp i 1 j dp[i-1][1][j-1] * 9 dp[i-1][1][j-1] [1] [i-1] dp i-1 i 1 1 j-1 j 1 9 dp[i][1][j] += dp[i-1][1][j] dp[i][1][j] [1] [i] dp i 1 j dp[i-1][1][j] [1] [i-1] dp i-1 i 1 1 j print(dp[len(n)][0][k] + dp[len(n)][1][k]) print dp[len(n)][0][k] + dp[len(n)][1][k] dp[len(n)][0][k] [0] [len(n)] dp len(n) len n 0 k dp[len(n)][1][k] [1] [len(n)] dp len(n) len n 1 k dp = [[[0] * (k+1) for _ in range(2)] for _ in range(len(n)+1)] [[[0] * (k+1) for _ in range(2)] for _ in range(len(n)+1)] dp k = int(input()) int(input()) k t = int(n[i-1]) int(n[i-1]) t n = input() input() n
n = input()
k = int(input())

dp = [[[0] * (k+1) for _ in range(2)] for _ in range(len(n)+1)]
dp[0][0][0] = 1

for i in range(1, len(n) + 1):
    t = int(n[i-1])
    for j in range(k+1):
        if t != 0:
            if j != 0:
                dp[i][0][j] += dp[i-1][0][j-1]
                dp[i][1][j] += dp[i-1][1][j-1] * 9 + dp[i-1][0][j-1] * (t-1)
            dp[i][1][j] += (dp[i-1][1][j] + dp[i-1][0][j])
        else:
            dp[i][0][j] += dp[i-1][0][j]
            if j != 0:
                dp[i][1][j] += dp[i-1][1][j-1] * 9
            dp[i][1][j] += dp[i-1][1][j]

print(dp[len(n)][0][k] + dp[len(n)][1][k])