def get(s): N = 2000 le = [0]*N eq = 0 for i in s: d = int(i) nle = [0]*N for j in range(10): for k in range(N-j): nle[k+j] += le[k] nle[k+j] %= MOD for j in range(d): nle[j+eq] += 1 eq += d le = nle le[eq] += 1 le[0] -= 1 return le MOD = 10**9+9 m,n = input().split() rm = get(m) rn = get(n) ans = 0 for i,j in zip(rm,rn): ans += i*j%MOD print(ans%MOD)