from scipy.special import comb

strn = input()
strk = input()
n = len(strn)
k = int(strk)
ue = int(strn[0])
sita = int(strn[-1])
print(ue,sita,n)

ans=0

if n-2>=k:
    ans= comb(n-2,k)*pow(9,k)
    print(ans)
if n-2 >= k-1 :
    ans=ans+comb(n-2,k-1)*pow(9,k-1)*sita
    print(ans)
if n-2>=k-2:
    ans = ans + sita*ue*comb(n-2,k-2)*pow(9,k-2)
    print(ans)
ans= int(ans)
print(ans)
