from scipy.special import comb

N = int(input())
K = int(input())
# n : Nの桁数
n = len(str(N))
# m : 各位の値
m = list(map(int,str(N)))
###最高位が 0 の時
A = (9 ** (K)) * comb(n-1,n-K-1,exact=True)
###最高位が 1 以上 m[0] 未満 の時
B = (m[0]-1) * (9 ** (K-1)) * comb(n-1,n-K,exact = True)
###最高位が m[0] の時
C = 0
## 
if not n == K:
    for i in range(K):
        c_0 = (9 ** (K-1-i)) * comb(n-2-i,K-1-i,exact=True)
        c_9 = 1
        for j in range(1,i+1):
            c_9 *= m[j]
        c = c_0 * c_9
        C += c
        print(c_0,c_9)
else:
    c = 1
    for i in range(n-1):
        c *= m[i+1]
        C += c
print(A,B,C)
print(A+B+C)