#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const long long modc = 1e9+9; vector f(string X){ int N = X.size(); vector>> pd(N+1, vector(1801, vector(2))); pd[0][0][1] = 1; for (int i=1; i<=N; i++){ for (int j=0; j<=1800; j++){ if (j-(X[i-1]-'0')>=0) pd[i][j][1] = pd[i-1][j-(X[i-1]-'0')][1]; for (int k=0; k<=9; k++) if (j>=k){ pd[i][j][0] += pd[i-1][j-k][0]; pd[i][j][0] %= modc; } for (int k=0; k=k){ pd[i][j][0] += pd[i-1][j-k][1]; pd[i][j][0] %= modc; } } } vector dp(1801); for (int i=0; i<=1800; i++) dp[i] = (pd[N][i][0] + pd[N][i][1]) % modc; return dp; } int main(){ long long ans=0; string M, D; cin >> M >> D; vector dpm, dpd; dpm = f(M); dpd = f(D); for (int i=1; i<=1800; i++) ans = (ans + dpm[i]*dpd[i]%modc) % modc; cout << ans << endl; return 0; }