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,c in enumerate(N):
    x=int(c)

    for j in range(2):
        for d in range(x+1 if j==1 else 10):
            for k in range(K+1):
                dp[i+1][x==d if j==1 else 0][k+1 if 0<d else 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,c in enumerate(N):
    x=int(c)

    for j in range(2):
        for d in range(x+1 if j==1 else 10):
            for k in range(K+1):
                dp[i+1][x==d if j==1 else 0][k+1 if 0<d else k]+=dp[i][j][k]    i c enumerate(N) enumerate N x=int(c) x int(c) int c for j in range(2):
        for d in range(x+1 if j==1 else 10):
            for k in range(K+1):
                dp[i+1][x==d if j==1 else 0][k+1 if 0<d else k]+=dp[i][j][k]    j range(2) range 2 for d in range(x+1 if j==1 else 10):
            for k in range(K+1):
                dp[i+1][x==d if j==1 else 0][k+1 if 0<d else k]+=dp[i][j][k]    d range(x+1 if j==1 else 10) range x+1 if j==1 else 10 j==1 j 1 x+1 x 1 10 for k in range(K+1):
                dp[i+1][x==d if j==1 else 0][k+1 if 0<d else k]+=dp[i][j][k]    k range(K+1) range K+1 K 1 dp[i+1][x==d if j==1 else 0][k+1 if 0<d else k]+=dp[i][j][k] dp[i+1][x==d if j==1 else 0][k+1 if 0<d else k] [x==d if j==1 else 0] [i+1] dp i+1 i 1 x==d if j==1 else 0 j==1 j 1 x==d x d 0 k+1 if 0<d else k 0<d 0 d k+1 k 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 x=int(c) int(c) x 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,c in enumerate(N):
    x=int(c)

    for j in range(2):
        for d in range(x+1 if j==1 else 10):
            for k in range(K+1):
                dp[i+1][x==d if j==1 else 0][k+1 if 0<d else k]+=dp[i][j][k]   

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