#include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector VI; typedef vector VVI; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) #define FOR(i, f, t) for(int(i)=(f);(i)<(t);(++i)) #define RREP(i, n) for(int(i)=(n)-1;(i)>=0;--(i)) const int MOD = int(1e9+9); ll dp1[2000][222][2]; ll dp2[2000][222][2]; string M,D; int m,d; ll dfs( ll (*dp)[222][2], const string &v, const int n, const int s, const int i, const int f){ if(s < 0) return 0; if(i == n) return (s == 0)?1:0; if(dp[s][i][f] >= 0) return dp[s][i][f]; int d = v[i]-'0'; ll res = 0; if(f){ REP(j,d){ (res += dfs(dp, v, n, s-j, i+1, 0)) %= MOD; } (res += dfs(dp, v, n, s-d, i+1, 1)) %= MOD; } else { REP(j,10){ (res += dfs(dp, v, n, s-j, i+1, 0)) %= MOD; } } return (dp[s][i][f] = res); } int main(){ do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0); memset(dp1,-1,sizeof(dp1)); memset(dp2,-1,sizeof(dp2)); cin >> M >> D; m = M.size(); d = D.size(); ll res = 0; FOR(i,1,2000){ (res += dfs(dp1, M, m, i, 0, 1) * dfs(dp2, D, d, i, 0, 1) % MOD) %= MOD; } cout << res << endl; return 0; }