//#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long typedef long long ll; typedef unsigned long long ull; //typedef unsigned __int128 HASH; typedef pair pii; typedef pair pll; typedef pair pullull; typedef pair plli; typedef pair pdi; typedef pair pdbi; typedef pair pipii; typedef pair plpll; typedef vector vi; typedef vector vll; typedef vector vvi; typedef vector vvvi; typedef vector vpii; typedef vector> mat; #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n);i>0;i--) #define rrep2(i,a,b) for (int i=(a);i>b;i--) #define fi first #define se second #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() template using MINPQ = std::priority_queue, greater>; //MINPQ pq; template using MAXPQ = std::priority_queue; const ll hmod1 = 999999937; const ll hmod2 = 1000000000 + 9; const int INF = 1<<30; const ll INFLL = 1LL<<62; const double EPS = 1e-12; const ll mod = 1000000000 + 9; //const ll mod = 998244353; const int dx4[4] = {1, 0, -1, 0}; const int dy4[4] = {0, 1, 0, -1}; const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1}; const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1}; const long double pi = 3.141592653589793; #define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod #define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false #define stand(B, i) (((B>>i) & 1) == 1) ? true : false //Bのi番目のbitが1ならtrue, 0ならfalse //debug #define DEBUG #define DUMPOUT cerr #ifdef DEBUG #define dump(...) DUMPOUT<<#__VA_ARGS__<<" :["<<__FUNCTION__<<":"<<__LINE__<<"]"< void dump_func(Head&& head, Tail&&... tail) { DUMPOUT << head; if (sizeof...(Tail) == 0) DUMPOUT << " "; else DUMPOUT << ", "; dump_func(std::move(tail)...); } //ostream template ostream& operator << (ostream& os, vector& vec) { os << "["; for (int i = 0; i ostream& operator << (ostream& os, pair& pair_var) { os << "(" << pair_var.first << ", " << pair_var.second << ")"; return os; } template ostream& operator << (ostream& os, map& map_var) { os << "["; for (auto itr = map_var.begin(); itr != map_var.end(); itr++) { os << "(" << itr->first << ", " << itr->second << ")"; itr++; if(itr != map_var.end()) os << ", "; itr--; } os << "]"; return os; } template ostream& operator << (ostream& os, set& set_var) { os << "["; for (auto itr = set_var.begin(); itr != set_var.end(); itr++) { os << *itr; ++itr; if(itr != set_var.end()) os << ", "; itr--; } os << "]"; return os; } string m, d; vector>> solve(int n, string& s) { vector>> dp(n+1, vector>(2, vector(2000, 0))); dp[0][0][0] = 1; for (int i = 0; i < n; i++) { for(int j = 0; j < 2; j++) { for (int k = 0; k < 1900; k++) { for (int x = 0; x <= (j ? 9 : s[i]-'0'); x++) { addm(dp[i+1][j || x < (s[i]-'0')][k+x], dp[i][j][k]); } } } } return dp; } signed main() { cin.tie(0); ios::sync_with_stdio(false); cin >> m >> d; int ms = m.size(); int ds = d.size(); vector>> dp_m = solve(ms, m); vector>> dp_d = solve(ds, d); int ans = 0; rep2(k, 1, 2000) { rep(i, 2)rep(j, 2) { addm(ans, dp_m[ms][i][k] * dp_d[ds][j][k]); } } cout << ans << endl; }