N = [0] + list(map(int, input()))
K = int(input())
n = len(N)

DP = [
      [[0] * (K+2) for _ in range(2)] for _ in range(n)
]

# 0桁目(0)で最大値を取っていてk=0の要素は1個。
DP[0][0][0] = 1

for i in range(1, n):
  for k in range(K+1):
    if N[i] != 0:
      DP[i][0][k+1] += DP[i-1][0][k]
      DP[i][1][k] += DP[i-1][0][k]
      DP[i][1][k+1] += DP[i-1][0][k] * (N[i] - 1)
    else:
      DP[i][0][k] += DP[i-1][0][k]
    DP[i][1][k] += DP[i-1][1][k]
    DP[i][1][k+1] += DP[i-1][1][k] * 9
print(DP[n-1][1][K] + DP[n-1][0][K]) N = [0] + list(map(int, input())) N [0] + list(map(int, input())) [0] 0 list(map(int, input())) list map(int, input()) map int input() input K = int(input()) K int(input()) int input() input n = len(N) n len(N) len N [[0] * (K+2) for _ in range(2)] for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) [[0] * (K+2) for _ in range(2)] DP = [
      [[0] * (K+2) for _ in range(2)] for _ in range(n)
] DP [
      [[0] * (K+2) for _ in range(2)] for _ in range(n)
] DP[0][0][0] = 1 DP[0][0][0] [0] [0] DP 0 0 0 1 for i in range(1, n):
  for k in range(K+1):
    if N[i] != 0:
      DP[i][0][k+1] += DP[i-1][0][k]
      DP[i][1][k] += DP[i-1][0][k]
      DP[i][1][k+1] += DP[i-1][0][k] * (N[i] - 1)
    else:
      DP[i][0][k] += DP[i-1][0][k]
    DP[i][1][k] += DP[i-1][1][k]
    DP[i][1][k+1] += DP[i-1][1][k] * 9 i range(1, n) range 1 n for k in range(K+1):
    if N[i] != 0:
      DP[i][0][k+1] += DP[i-1][0][k]
      DP[i][1][k] += DP[i-1][0][k]
      DP[i][1][k+1] += DP[i-1][0][k] * (N[i] - 1)
    else:
      DP[i][0][k] += DP[i-1][0][k]
    DP[i][1][k] += DP[i-1][1][k]
    DP[i][1][k+1] += DP[i-1][1][k] * 9 k range(K+1) range K+1 K 1 if N[i] != 0:
      DP[i][0][k+1] += DP[i-1][0][k]
      DP[i][1][k] += DP[i-1][0][k]
      DP[i][1][k+1] += DP[i-1][0][k] * (N[i] - 1)
    else:
      DP[i][0][k] += DP[i-1][0][k]
     N[i] != 0 N[i] N i 0 DP[i][0][k+1] += DP[i-1][0][k] DP[i][0][k+1] [0] [i] DP i 0 k+1 k 1 DP[i-1][0][k] [0] [i-1] DP i-1 i 1 0 k DP[i][1][k] += DP[i-1][0][k] DP[i][1][k] [1] [i] DP i 1 k DP[i-1][0][k] [0] [i-1] DP i-1 i 1 0 k DP[i][1][k+1] += DP[i-1][0][k] * (N[i] - 1) DP[i][1][k+1] [1] [i] DP i 1 k+1 k 1 DP[i-1][0][k] * (N[i] - 1) DP[i-1][0][k] [0] [i-1] DP i-1 i 1 0 k N[i] - 1 N[i] N i 1 DP[i][0][k] += DP[i-1][0][k] DP[i][0][k] [0] [i] DP i 0 k DP[i-1][0][k] [0] [i-1] DP i-1 i 1 0 k DP[i][1][k] += DP[i-1][1][k] DP[i][1][k] [1] [i] DP i 1 k DP[i-1][1][k] [1] [i-1] DP i-1 i 1 1 k DP[i][1][k+1] += DP[i-1][1][k] * 9 DP[i][1][k+1] [1] [i] DP i 1 k+1 k 1 DP[i-1][1][k] * 9 DP[i-1][1][k] [1] [i-1] DP i-1 i 1 1 k 9 print(DP[n-1][1][K] + DP[n-1][0][K]) print DP[n-1][1][K] + DP[n-1][0][K] DP[n-1][1][K] [1] [n-1] DP n-1 n 1 1 K DP[n-1][0][K] [0] [n-1] DP n-1 n 1 0 K n = len(N) len(N) n K = int(input()) int(input()) K N = [0] + list(map(int, input())) [0] + list(map(int, input())) N DP = [
      [[0] * (K+2) for _ in range(2)] for _ in range(n)
] [
      [[0] * (K+2) for _ in range(2)] for _ in range(n)
] DP
N = [0] + list(map(int, input()))
K = int(input())
n = len(N)

DP = [
      [[0] * (K+2) for _ in range(2)] for _ in range(n)
]

# 0桁目(0)で最大値を取っていてk=0の要素は1個。
DP[0][0][0] = 1

for i in range(1, n):
  for k in range(K+1):
    if N[i] != 0:
      DP[i][0][k+1] += DP[i-1][0][k]
      DP[i][1][k] += DP[i-1][0][k]
      DP[i][1][k+1] += DP[i-1][0][k] * (N[i] - 1)
    else:
      DP[i][0][k] += DP[i-1][0][k]
    DP[i][1][k] += DP[i-1][1][k]
    DP[i][1][k+1] += DP[i-1][1][k] * 9
print(DP[n-1][1][K] + DP[n-1][0][K])