import sys import itertools import heapq import bisect from collections import deque, defaultdict from functools import lru_cache, cmp_to_key input = sys.stdin.readline # for AtCoder Easy test if __file__ != 'prog.py': sys.setrecursionlimit(10 ** 6) def readints(): return map(int, input().split()) def readlist(): return list(readints()) def readstr(): return input().rstrip() M, D = input().split() mod = 10 ** 9 + 9 def solve(n): dp = [[0, 0] for _ in range(L + 1)] dp[0][0] = 1 for i in range(len(n)): ndp = [[0, 0] for _ in range(L + 1)] for j in range(L + 1): for k in range(10): if j - k < 0: break ndp[j][1] += dp[j - k][1] if k < int(n[i]): ndp[j][1] += dp[j - k][0] elif k == int(n[i]): ndp[j][0] += dp[j - k][0] dp = ndp return dp L = 2000 dpm = solve(M) dpd = solve(D) ans = 0 for i in range(1, L + 1): ans += sum(dpm[i]) * sum(dpd[i]) % mod ans %= mod print(ans)