import java.util.*; public class Main { public static long MOD = (long)Math.pow(10, 9) + 9; public static void main(String[] args) { Scanner sc = new Scanner(System.in); String M = sc.next(); String D = sc.next(); long ans = 0; for(int i = 1; i < 1801; i++) { long t = (func(M, i) * func(D, i)) % MOD; ans = (ans + t) % MOD; } System.out.println(ans); } public static long func(String s, int p) { int len = s.length(); long[][][] dp = new long[len][1801][2]; int first = Integer.parseInt(String.valueOf(s.charAt(0))); for(int i = 0; i < first; i++) { dp[0][i][1] = 1; } dp[0][first][0] = 1; for(int i = 1; i < len; i++) { int d = Integer.parseInt(String.valueOf(s.charAt(i))); for(int j = 0; j <= (9 * i); j++) { dp[i][j + d][0] = (dp[i][j + d][0] + dp[i - 1][j][0]) % MOD; for(int k = 0; k < d; k++) { dp[i][j + k][1] = (dp[i][j + k][1] + dp[i - 1][j][0]) % MOD; } for(int k = 0; k < 10; k++) { dp[i][j + k][1] = (dp[i][j + k][1] + dp[i - 1][j][1]) % MOD; } } } return (dp[len - 1][p][0] + dp[len - 1][p][1]) % MOD; } }