#include #include #include #include using namespace std; #define REP(i,s,e) for (i = s; i <= e; i++) #define rep(i,n) REP (i,0,(int)(n)-1) #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP (i,(int)(n)-1,0) #define INF (int)1e8 #define MOD (int)(1e9+9) typedef long long ll; ll dp[2][201][1801]; ll dp2[2][201][1801]; int main(void) { int i, j, k; string m, d; cin >> m >> d; dp[1][0][0] = 1; rep (i,m.size()) { rep (j,m.size() * 9 + 1) { rep (k,10) { if (k == m[i] - '0') { dp[1][i+1][j+k] += dp[1][i][j]; dp[1][i+1][j+k] %= MOD; } dp[0][i+1][j+k] += dp[0][i][j]; if (k < m[i] - '0') dp[0][i+1][j+k] += dp[1][i][j]; dp[0][i+1][j+k] %= MOD; } } } dp2[1][0][0] = 1; rep (i,d.size()) { rep (j,d.size() * 9 + 1) { rep (k,10) { if (k == d[i] - '0') { dp2[1][i+1][j+k] += dp2[1][i][j]; dp2[1][i+1][j+k] %= MOD; } dp2[0][i+1][j+k] += dp2[0][i][j]; if (k < d[i] - '0') dp2[0][i+1][j+k] += dp2[1][i][j]; dp2[0][i+1][j+k] %= MOD; } } } int ans = 0; REP (j,1,1800) ans = (ans + (dp[0][m.size()][j]+dp[1][m.size()][j]) * (dp2[0][d.size()][j]+dp2[1][d.size()][j])) % MOD; cout << ans << endl; return 0; }