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

dp = [[[0,0] for _ in range(K+1)] for _ in range(L+1)]
dp[0][0][0] = 1
for i,c in enumerate(S):
    c = int(c)
    for k in reversed(range(K+1)):
        for d in range(10):
            nk = k + (d>0)
            if nk > K: continue
            dp[i+1][nk][1] += dp[i][k][1]
            if d > c: continue
            less = int(d < c)
            dp[i+1][nk][less] += dp[i][k][0]
print(sum(dp[-1][-1])) S = input() S input() input L = len(S) L len(S) len S K = int(input()) K int(input()) int input() input [[0,0] for _ in range(K+1)] for _ in range(L+1) for _ in range(L+1) _ range(L+1) range L+1 L 1 for _ in range(L+1) [[0,0] for _ in range(K+1)] dp = [[[0,0] for _ in range(K+1)] for _ in range(L+1)] dp [[[0,0] for _ in range(K+1)] for _ in range(L+1)] dp[0][0][0] = 1 dp[0][0][0] [0] [0] dp 0 0 0 1 for i,c in enumerate(S):
    c = int(c)
    for k in reversed(range(K+1)):
        for d in range(10):
            nk = k + (d>0)
            if nk > K: continue
            dp[i+1][nk][1] += dp[i][k][1]
            if d > c: continue
            less = int(d < c)
            dp[i+1][nk][less] += dp[i][k][0] i c enumerate(S) enumerate S c = int(c) c int(c) int c for k in reversed(range(K+1)):
        for d in range(10):
            nk = k + (d>0)
            if nk > K: continue
            dp[i+1][nk][1] += dp[i][k][1]
            if d > c: continue
            less = int(d < c)
            dp[i+1][nk][less] += dp[i][k][0] k reversed(range(K+1)) reversed range(K+1) range K+1 K 1 for d in range(10):
            nk = k + (d>0)
            if nk > K: continue
            dp[i+1][nk][1] += dp[i][k][1]
            if d > c: continue
            less = int(d < c)
            dp[i+1][nk][less] += dp[i][k][0] d range(10) range 10 nk = k + (d>0) nk k + (d>0) k d>0 d 0 if nk > K: continue
             nk > K nk K dp[i+1][nk][1] += dp[i][k][1] dp[i+1][nk][1] [nk] [i+1] dp i+1 i 1 nk 1 dp[i][k][1] [k] [i] dp i k 1 if d > c: continue
             d > c d c less = int(d < c) less int(d < c) int d < c d c dp[i+1][nk][less] += dp[i][k][0] dp[i+1][nk][less] [nk] [i+1] dp i+1 i 1 nk less dp[i][k][0] [k] [i] dp i k 0 print(sum(dp[-1][-1])) print sum(dp[-1][-1]) sum dp[-1][-1] [-1] dp -1 -1 K = int(input()) int(input()) K S = input() input() S dp = [[[0,0] for _ in range(K+1)] for _ in range(L+1)] [[[0,0] for _ in range(K+1)] for _ in range(L+1)] dp nk = k + (d>0) k + (d>0) nk less = int(d < c) int(d < c) less c = int(c) int(c) c L = len(S) len(S) L
S = input()
L = len(S)
K = int(input())

dp = [[[0,0] for _ in range(K+1)] for _ in range(L+1)]
dp[0][0][0] = 1
for i,c in enumerate(S):
    c = int(c)
    for k in reversed(range(K+1)):
        for d in range(10):
            nk = k + (d>0)
            if nk > K: continue
            dp[i+1][nk][1] += dp[i][k][1]
            if d > c: continue
            less = int(d < c)
            dp[i+1][nk][less] += dp[i][k][0]
print(sum(dp[-1][-1]))