from itertools import product M,D = map(int, input().split()) def count(x): a = str(x) n = len(a) #配列は末から #数字和は制約から2000を超えることはない dp=[[[0] * 2100 for _ in range(2)] for _ in range(n+1)] dp[0][0][0] = 1 #条件に合わせてDP for i, less, suujiwa in product(range(n), (0,1), range(2000)): max_d = 9 if less else int(a[i]) for d in range(max_d+1): less_ = less or d < max_d suujiwa_ = suujiwa + d dp[i + 1][less_][suujiwa_] += dp[i][less][suujiwa] return dp[n] m = count(M) d = count(D) ret = 0 for i in range(1,2000): ret += (m[False][i]+m[True][i])*(d[False][i]+d[True][i]) mod = 10**9+9 print(ret%mod)