import java.io.*; import java.util.*; import java.util.stream.*; public class Main { static final int MOD = 1000000009; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); HashMap month = getCount(sc.next().toCharArray()); HashMap 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 HashMap getCount(char[] arr) { int base = 0; HashMap current = new HashMap<>(); for (char c : arr) { HashMap next = new HashMap<>(); int x = c - '0'; for (int i = 0; i < x; i++) { next.put(base + i, (next.getOrDefault(base + i, 0L) + 1) % MOD); } for (int y : current.keySet()) { for (int i = 0; i < 10; i++) { next.put(y + i, (next.getOrDefault(y + i, 0L) + current.get(y)) % MOD); } } base += x; current = next; } current.put(base, current.getOrDefault(base, 0L) + 1); return current; } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); 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 int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }