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


def func(num,counter):
    remain = num%10
    quotient = num//10
    
    
    if counter == 0:
        return 1
    
    if num<10:
        if counter ==1:
            return num
        else:
            return 0

    return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter)

print(func(N,K)) N = int(input()) N int(input()) int input() input K = int(input()) K int(input()) int input() input def func(num,counter):
    remain = num%10
    quotient = num//10
    
    
    if counter == 0:
        return 1
    
    if num<10:
        if counter ==1:
            return num
        else:
            return 0

    return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter) func remain = num%10 remain num%10 num 10 quotient = num//10 quotient num//10 num 10 if counter == 0:
        return 1
    
     counter == 0 counter 0 return 1 1 if num<10:
        if counter ==1:
            return num
        else:
            return 0

     num<10 num 10 if counter ==1:
            return num
        else:
            return 0

     counter ==1 counter 1 return num num return 0 0 return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter) func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter) func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) func(quotient,counter-1)*remain func(quotient,counter-1) func quotient counter-1 counter 1 remain func(quotient-1,counter-1)*(9-remain) func(quotient-1,counter-1) func quotient-1 quotient 1 counter-1 counter 1 9-remain 9 remain func(quotient,counter) func quotient counter num num counter counter print(func(N,K)) print func(N,K) func N K def func(num,counter):
    remain = num%10
    quotient = num//10
    
    
    if counter == 0:
        return 1
    
    if num<10:
        if counter ==1:
            return num
        else:
            return 0

    return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter) def func(num,counter):
    remain = num%10
    quotient = num//10
    
    
    if counter == 0:
        return 1
    
    if num<10:
        if counter ==1:
            return num
        else:
            return 0

    return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter) func K = int(input()) int(input()) K N = int(input()) int(input()) N
N = int(input())
K = int(input())


def func(num,counter):
    remain = num%10
    quotient = num//10
    
    
    if counter == 0:
        return 1
    
    if num<10:
        if counter ==1:
            return num
        else:
            return 0

    return func(quotient,counter-1)*remain + func(quotient-1,counter-1)*(9-remain) + func(quotient,counter)

print(func(N,K))