from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
n = len(s)
K = inp()
dp = [[[0 for i in range(5)] for j in range(2)] for k in range(n+1)]
# dp[i][j][k] j:0 kaku j:1 mikaku , k:kosuu
dp[0][1][0] = 1
for i,x in enumerate(s):
    x = int(x)
    for k in range(4):
        dp[i+1][0][k] += dp[i][0][k]
        dp[i+1][0][k+1] += dp[i][0][k]*9 + dp[i][1][k]*max(0,(x-1))

        if x != 0:
            dp[i+1][0][k] += dp[i][1][k]
            dp[i+1][1][k+1] = dp[i][1][k]
            if k == 0: dp[i+1][1][k] = 0
        else:
            dp[i+1][1][k] = dp[i][1][k] 
        for j in range(2):
            dp[i+1][j][k] %= mod

    # print(dp[i+1][0])
    # print(dp[i+1][1])
    # print()
print(dp[-1][0][K] + dp[-1][1][K]) from collections import Counter,defaultdict,deque from heapq import heappop,heappush from bisect import bisect_left,bisect_right import sys,math,itertools,fractions sys math itertools fractions sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 INF = float('inf') INF float('inf') float 'inf' def inp(): return int(sys.stdin.readline()) inp def inpl(): return list(map(int, sys.stdin.readline().split())) inpl s = input() s input() input n = len(s) n len(s) len s K = inp() K inp() inp [[0 for i in range(5)] for j in range(2)] for k in range(n+1) for k in range(n+1) k range(n+1) range n+1 n 1 for k in range(n+1) [[0 for i in range(5)] for j in range(2)] dp = [[[0 for i in range(5)] for j in range(2)] for k in range(n+1)] dp [[[0 for i in range(5)] for j in range(2)] for k in range(n+1)] dp[0][1][0] = 1 dp[0][1][0] [1] [0] dp 0 1 0 1 for i,x in enumerate(s):
    x = int(x)
    for k in range(4):
        dp[i+1][0][k] += dp[i][0][k]
        dp[i+1][0][k+1] += dp[i][0][k]*9 + dp[i][1][k]*max(0,(x-1))

        if x != 0:
            dp[i+1][0][k] += dp[i][1][k]
            dp[i+1][1][k+1] = dp[i][1][k]
            if k == 0: dp[i+1][1][k] = 0
        else:
            dp[i+1][1][k] = dp[i][1][k] 
        for j in range(2):
            dp[i+1][j][k] %= mod

    # print(dp[i+1][0])
    # print(dp[i+1][1])
    # print() i x enumerate(s) enumerate s x = int(x) x int(x) int x for k in range(4):
        dp[i+1][0][k] += dp[i][0][k]
        dp[i+1][0][k+1] += dp[i][0][k]*9 + dp[i][1][k]*max(0,(x-1))

        if x != 0:
            dp[i+1][0][k] += dp[i][1][k]
            dp[i+1][1][k+1] = dp[i][1][k]
            if k == 0: dp[i+1][1][k] = 0
        else:
            dp[i+1][1][k] = dp[i][1][k] 
        for j in range(2):
            dp[i+1][j][k] %= mod

    # print(dp[i+1][0])
    # print(dp[i+1][1])
    # print() k range(4) range 4 dp[i+1][0][k] += dp[i][0][k] dp[i+1][0][k] [0] [i+1] dp i+1 i 1 0 k dp[i][0][k] [0] [i] dp i 0 k dp[i+1][0][k+1] += dp[i][0][k]*9 + dp[i][1][k]*max(0,(x-1)) dp[i+1][0][k+1] [0] [i+1] dp i+1 i 1 0 k+1 k 1 dp[i][0][k]*9 + dp[i][1][k]*max(0,(x-1)) dp[i][0][k]*9 dp[i][0][k] [0] [i] dp i 0 k 9 dp[i][1][k]*max(0,(x-1)) dp[i][1][k] [1] [i] dp i 1 k max(0,(x-1)) max 0 x-1 x 1 if x != 0:
            dp[i+1][0][k] += dp[i][1][k]
            dp[i+1][1][k+1] = dp[i][1][k]
            if k == 0: dp[i+1][1][k] = 0
        else:
            dp[i+1][1][k] = dp[i][1][k] 
         x != 0 x 0 dp[i+1][0][k] += dp[i][1][k] dp[i+1][0][k] [0] [i+1] dp i+1 i 1 0 k dp[i][1][k] [1] [i] dp i 1 k dp[i+1][1][k+1] = dp[i][1][k] dp[i+1][1][k+1] [1] [i+1] dp i+1 i 1 1 k+1 k 1 dp[i][1][k] [1] [i] dp i 1 k if k == 0: dp[i+1][1][k] = 0
         k == 0 k 0 dp[i+1][1][k] = dp[i][1][k] dp[i+1][1][k] [1] [i+1] dp i+1 i 1 1 k dp[i][1][k] [1] [i] dp i 1 k for j in range(2):
            dp[i+1][j][k] %= mod

    # print(dp[i+1][0])
    # print(dp[i+1][1])
    # print() j range(2) range 2 dp[i+1][j][k] %= mod dp[i+1][j][k] [j] [i+1] dp i+1 i 1 j k mod print(dp[-1][0][K] + dp[-1][1][K]) print dp[-1][0][K] + dp[-1][1][K] dp[-1][0][K] [0] [-1] dp -1 0 K dp[-1][1][K] [1] [-1] dp -1 1 K mod = 10**9+7 10**9+7 mod def inp(): return int(sys.stdin.readline()) def inp(): return int(sys.stdin.readline()) inp def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl(): return list(map(int, sys.stdin.readline().split())) inpl s = input() input() s x = int(x) int(x) x INF = float('inf') float('inf') INF n = len(s) len(s) n K = inp() inp() K dp = [[[0 for i in range(5)] for j in range(2)] for k in range(n+1)] [[[0 for i in range(5)] for j in range(2)] for k in range(n+1)] dp
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
n = len(s)
K = inp()
dp = [[[0 for i in range(5)] for j in range(2)] for k in range(n+1)]
# dp[i][j][k] j:0 kaku j:1 mikaku , k:kosuu
dp[0][1][0] = 1
for i,x in enumerate(s):
    x = int(x)
    for k in range(4):
        dp[i+1][0][k] += dp[i][0][k]
        dp[i+1][0][k+1] += dp[i][0][k]*9 + dp[i][1][k]*max(0,(x-1))

        if x != 0:
            dp[i+1][0][k] += dp[i][1][k]
            dp[i+1][1][k+1] = dp[i][1][k]
            if k == 0: dp[i+1][1][k] = 0
        else:
            dp[i+1][1][k] = dp[i][1][k] 
        for j in range(2):
            dp[i+1][j][k] %= mod

    # print(dp[i+1][0])
    # print(dp[i+1][1])
    # print()
print(dp[-1][0][K] + dp[-1][1][K])
