using System; using System.Collections.Generic; using System.Linq; using System.Numerics; static public class Program { //small static public void Main() { var max = BigInteger.Pow(10, 6); var S = readString(2).ValidateArray(x => { var v = BigInteger.Parse(x); return 1 <= v && v <= max; }); readEOF(); const long mod = (long)1e9 + 9; var M = int.Parse(S[0]); var D = int.Parse(S[1]); var a = new int[5000]; long ans = 0; for (int i = 1; i <= M; i++) a[i.ToString().Select(x => x - '0').Sum()]++; for (int i = 1; i <= D; i++) ans += a[i.ToString().Select(x => x - '0').Sum()]; Console.WriteLine(ans % mod); } static string[] readString(int n) { var s = Console.ReadLine().Split(' '); if (s.Length != n) throw new Exception(string.Format("invalid input, expected{0} actual{1}", n, s.Length)); return s; } static void readEOF() { if (Console.In.Peek() >= 0) throw new Exception("invalid input too long input file"); } } static public class Ex { static public T[] ValidateArray(this T[] input, Func f) { foreach (var x in input) if (!f(x)) throw new Exception("invalid input"); return input; } }