import java.util.*; import java.io.*; public class Main { static final int MOD = 1000000009; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); TreeMap month = getCount(sc.next().toCharArray()); TreeMap day = getCount(sc.next().toCharArray()); long ans = 0; for (int x : month.keySet()) { if (x == 0) { continue; } ans += month.get(x) * day.getOrDefault(x, 0L) % MOD; ans %= MOD; } System.out.println(ans); } static TreeMap getCount(char[] value) { TreeMap counts = new TreeMap<>(); counts.put(0, 1L); int total = 0; boolean isFirst = true; for (char c : value) { int x = c - '0'; if (isFirst) { isFirst = false; for (int i = 1; i < x; i++) { counts.put(i, 1L); } total += x; continue; } Integer key = Integer.MAX_VALUE; while ((key = counts.lowerKey(key)) != null) { for (int i = 1; i <= 9; i++) { counts.put(key + i, counts.getOrDefault(key + i, 0L) + counts.get(key)); } } for (int i = 0; i < x; i++) { counts.put(total + i, counts.getOrDefault(total + i, 0L) + 1); } total += x; } counts.put(total, counts.getOrDefault(total, 0L) + 1); return counts; } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }