N=list(input())
K=int(input())

OK=[[0 for k in range(5)]for i in range(len(N))]
OK[0][0]=1
OK[0][1]=int(N[0])-1
D=1
#print(OK)
for i in range(1,len(N)):
    OK[i][0]=OK[i-1][0]
    OK[i][1]+=OK[i-1][0]*9+OK[i-1][1]
    OK[i][2]+=OK[i-1][1]*9+OK[i-1][2]
    OK[i][3]+=OK[i-1][2]*9+OK[i-1][3]
    if D<=K and int(N[i])!=0:
        OK[i][D]+=1
        OK[i][D+1]+=int(N[i])-1
        D+=1
if D==K:
    print(OK[-1][K]+1)
else:
    print(OK[-1][K]) N=list(input()) N list(input()) list input() input K=int(input()) K int(input()) int input() input [0 for k in range(5)]for i in range(len(N)) for i in range(len(N)) i range(len(N)) range len(N) len N for i in range(len(N)) [0 for k in range(5)] OK=[[0 for k in range(5)]for i in range(len(N))] OK [[0 for k in range(5)]for i in range(len(N))] OK[0][0]=1 OK[0][0] [0] OK 0 0 1 OK[0][1]=int(N[0])-1 OK[0][1] [0] OK 0 1 int(N[0])-1 int(N[0]) int N[0] N 0 1 D=1 D 1 for i in range(1,len(N)):
    OK[i][0]=OK[i-1][0]
    OK[i][1]+=OK[i-1][0]*9+OK[i-1][1]
    OK[i][2]+=OK[i-1][1]*9+OK[i-1][2]
    OK[i][3]+=OK[i-1][2]*9+OK[i-1][3]
    if D<=K and int(N[i])!=0:
        OK[i][D]+=1
        OK[i][D+1]+=int(N[i])-1
        D+=1 i range(1,len(N)) range 1 len(N) len N OK[i][0]=OK[i-1][0] OK[i][0] [i] OK i 0 OK[i-1][0] [i-1] OK i-1 i 1 0 OK[i][1]+=OK[i-1][0]*9+OK[i-1][1] OK[i][1] [i] OK i 1 OK[i-1][0]*9+OK[i-1][1] OK[i-1][0]*9 OK[i-1][0] [i-1] OK i-1 i 1 0 9 OK[i-1][1] [i-1] OK i-1 i 1 1 OK[i][2]+=OK[i-1][1]*9+OK[i-1][2] OK[i][2] [i] OK i 2 OK[i-1][1]*9+OK[i-1][2] OK[i-1][1]*9 OK[i-1][1] [i-1] OK i-1 i 1 1 9 OK[i-1][2] [i-1] OK i-1 i 1 2 OK[i][3]+=OK[i-1][2]*9+OK[i-1][3] OK[i][3] [i] OK i 3 OK[i-1][2]*9+OK[i-1][3] OK[i-1][2]*9 OK[i-1][2] [i-1] OK i-1 i 1 2 9 OK[i-1][3] [i-1] OK i-1 i 1 3 if D<=K and int(N[i])!=0:
        OK[i][D]+=1
        OK[i][D+1]+=int(N[i])-1
        D+=1 D<=K and int(N[i])!=0 D<=K D K int(N[i])!=0 int(N[i]) int N[i] N i 0 OK[i][D]+=1 OK[i][D] [i] OK i D 1 OK[i][D+1]+=int(N[i])-1 OK[i][D+1] [i] OK i D+1 D 1 int(N[i])-1 int(N[i]) int N[i] N i 1 D+=1 D 1 if D==K:
    print(OK[-1][K]+1)
else:
    print(OK[-1][K]) D==K D K print(OK[-1][K]+1) print OK[-1][K]+1 OK[-1][K] [-1] OK -1 K 1 print(OK[-1][K]) print OK[-1][K] [-1] OK -1 K N=list(input()) list(input()) N OK=[[0 for k in range(5)]for i in range(len(N))] [[0 for k in range(5)]for i in range(len(N))] OK K=int(input()) int(input()) K D=1 1 D D+=1 1 D
N=list(input())
K=int(input())

OK=[[0 for k in range(5)]for i in range(len(N))]
OK[0][0]=1
OK[0][1]=int(N[0])-1
D=1
#print(OK)
for i in range(1,len(N)):
    OK[i][0]=OK[i-1][0]
    OK[i][1]+=OK[i-1][0]*9+OK[i-1][1]
    OK[i][2]+=OK[i-1][1]*9+OK[i-1][2]
    OK[i][3]+=OK[i-1][2]*9+OK[i-1][3]
    if D<=K and int(N[i])!=0:
        OK[i][D]+=1
        OK[i][D+1]+=int(N[i])-1
        D+=1
if D==K:
    print(OK[-1][K]+1)
else:
    print(OK[-1][K])
