#include "bits/stdc++.h" using namespace std; using lint = long long int; using pint = pair; using plint = pair; #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((lint)(x).size()) #define POW2(n) (1LL << (n)) #define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i=i##_begin_;i--) #define REP(i, n) FOR(i,0,n) #define IREP(i, n) IFOR(i,0,n) templatebool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; } templatebool chmin(T & a, const T & b) { if (b < a) { a = b; return 1; } return 0; } template pair operator+(const pair& l, const pair& r) { return make_pair(l.first + r.first, l.second + r.second); } template pair operator-(const pair& l, const pair& r) { return make_pair(l.first - r.first, l.second - r.second); } const lint MOD = 1000000009; template class modint { using u64 = std::int_fast64_t; public: u64 a; constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {} constexpr u64& value() noexcept { return a; } constexpr const u64& value() const noexcept { return a; } constexpr modint operator+(const modint rhs) const noexcept { return modint(*this) += rhs; } constexpr modint operator-(const modint rhs) const noexcept { return modint(*this) -= rhs; } constexpr modint operator*(const modint rhs) const noexcept { return modint(*this) *= rhs; } constexpr modint operator/(const modint rhs) const noexcept { return modint(*this) /= rhs; } constexpr modint& operator+=(const modint rhs) noexcept { a += rhs.a; if (a >= Modulus) { a -= Modulus; } return *this; } constexpr modint& operator-=(const modint rhs) noexcept { if (a < rhs.a) { a += Modulus; } a -= rhs.a; return *this; } constexpr modint& operator*=(const modint rhs) noexcept { a = a * rhs.a % Modulus; return *this; } constexpr modint& operator/=(modint rhs) noexcept { u64 exp = Modulus - 2; while (exp) { if (exp % 2) { *this *= rhs; } rhs *= rhs; exp /= 2; } return *this; } }; typedef modint ModInt; ModInt dpM[202][2][2000]; ModInt dpD[202][2][2000]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); string M, Day; cin >> M >> Day; lint m = SZ(M), d = SZ(Day); fill((long long*)dpM, (long long*)dpM + sizeof(dpM) / sizeof(long long), 0); fill((long long*)dpD, (long long*)dpD + sizeof(dpD) / sizeof(long long), 0); dpM[0][0][0] = 1; dpD[0][0][0] = 1; REP(i, m) { int D = M[i] - '0'; REP(j, 2) { REP(k, 2000) { REP(d, (j ? 10 : D + 1)) { dpM[i + 1][j || d < D][k + d] += dpM[i][j][k]; } } } } REP(i, d) { int D = Day[i] - '0'; REP(j, 2) { REP(k, 2000) { REP(d, (j ? 10 : D + 1)) { dpD[i + 1][j || d < D][k + d] += dpD[i][j][k]; } } } } ModInt sum = 0; FOR(i, 1, 2000) { sum += (dpM[m][1][i] + dpM[m][0][i]) * (dpD[d][1][i] + dpD[d][0][i]); } cout << sum.a << endl; }