n = input()
k = int(input())
dp = [[0] * (3 + 1) for i in range(len(n))]
dp[0][1] = int(n[0])
cnt = 1
for i in range(1, len(n)):
  m = int(n[i])
  if cnt == 1:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = (dp[i - 1][1] - 1) * 9 + dp[i - 1][2] + m
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
  elif cnt == 2:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] + m
  else:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
  if m != 0:
    cnt += 1
print(dp[len(n) - 1][k]) n = input() n input() input k = int(input()) k int(input()) int input() input [0] * (3 + 1) 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] * (3 + 1) [0] 0 3 + 1 3 1 dp = [[0] * (3 + 1) for i in range(len(n))] dp [[0] * (3 + 1) for i in range(len(n))] dp[0][1] = int(n[0]) dp[0][1] [0] dp 0 1 int(n[0]) int n[0] n 0 cnt = 1 cnt 1 for i in range(1, len(n)):
  m = int(n[i])
  if cnt == 1:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = (dp[i - 1][1] - 1) * 9 + dp[i - 1][2] + m
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
  elif cnt == 2:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] + m
  else:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
  if m != 0:
    cnt += 1 i range(1, len(n)) range 1 len(n) len n m = int(n[i]) m int(n[i]) int n[i] n i if cnt == 1:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = (dp[i - 1][1] - 1) * 9 + dp[i - 1][2] + m
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
  elif cnt == 2:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] + m
  else:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
   cnt == 1 cnt 1 dp[i][1] = 9 + dp[i - 1][1] dp[i][1] [i] dp i 1 9 + dp[i - 1][1] 9 dp[i - 1][1] [i - 1] dp i - 1 i 1 1 dp[i][2] = (dp[i - 1][1] - 1) * 9 + dp[i - 1][2] + m dp[i][2] [i] dp i 2 (dp[i - 1][1] - 1) * 9 + dp[i - 1][2] + m (dp[i - 1][1] - 1) * 9 + dp[i - 1][2] (dp[i - 1][1] - 1) * 9 dp[i - 1][1] - 1 dp[i - 1][1] [i - 1] dp i - 1 i 1 1 1 9 dp[i - 1][2] [i - 1] dp i - 1 i 1 2 m dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3] dp[i][3] [i] dp i 3 dp[i - 1][2] * 9 + dp[i - 1][3] dp[i - 1][2] * 9 dp[i - 1][2] [i - 1] dp i - 1 i 1 2 9 dp[i - 1][3] [i - 1] dp i - 1 i 1 3 elif cnt == 2:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] + m
   cnt == 2 cnt 2 dp[i][1] = 9 + dp[i - 1][1] dp[i][1] [i] dp i 1 9 + dp[i - 1][1] 9 dp[i - 1][1] [i - 1] dp i - 1 i 1 1 dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2] dp[i][2] [i] dp i 2 dp[i - 1][1] * 9 + dp[i - 1][2] dp[i - 1][1] * 9 dp[i - 1][1] [i - 1] dp i - 1 i 1 1 9 dp[i - 1][2] [i - 1] dp i - 1 i 1 2 dp[i][3] = (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] + m dp[i][3] [i] dp i 3 (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] + m (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] (dp[i - 1][2] - 1) * 9 dp[i - 1][2] - 1 dp[i - 1][2] [i - 1] dp i - 1 i 1 2 1 9 dp[i - 1][3] [i - 1] dp i - 1 i 1 3 m dp[i][1] = 9 + dp[i - 1][1] dp[i][1] [i] dp i 1 9 + dp[i - 1][1] 9 dp[i - 1][1] [i - 1] dp i - 1 i 1 1 dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2] dp[i][2] [i] dp i 2 dp[i - 1][1] * 9 + dp[i - 1][2] dp[i - 1][1] * 9 dp[i - 1][1] [i - 1] dp i - 1 i 1 1 9 dp[i - 1][2] [i - 1] dp i - 1 i 1 2 dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3] dp[i][3] [i] dp i 3 dp[i - 1][2] * 9 + dp[i - 1][3] dp[i - 1][2] * 9 dp[i - 1][2] [i - 1] dp i - 1 i 1 2 9 dp[i - 1][3] [i - 1] dp i - 1 i 1 3 if m != 0:
    cnt += 1 m != 0 m 0 cnt += 1 cnt 1 print(dp[len(n) - 1][k]) print dp[len(n) - 1][k] [len(n) - 1] dp len(n) - 1 len(n) len n 1 k n = input() input() n m = int(n[i]) int(n[i]) m k = int(input()) int(input()) k cnt += 1 1 cnt dp = [[0] * (3 + 1) for i in range(len(n))] [[0] * (3 + 1) for i in range(len(n))] dp cnt = 1 1 cnt
n = input()
k = int(input())
dp = [[0] * (3 + 1) for i in range(len(n))]
dp[0][1] = int(n[0])
cnt = 1
for i in range(1, len(n)):
  m = int(n[i])
  if cnt == 1:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = (dp[i - 1][1] - 1) * 9 + dp[i - 1][2] + m
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
  elif cnt == 2:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = (dp[i - 1][2] - 1) * 9 + dp[i - 1][3] + m
  else:
    dp[i][1] = 9 + dp[i - 1][1]
    dp[i][2] = dp[i - 1][1] * 9 + dp[i - 1][2]
    dp[i][3] = dp[i - 1][2] * 9 + dp[i - 1][3]
  if m != 0:
    cnt += 1
print(dp[len(n) - 1][k])