#include using namespace std; using ll = long long; #ifdef LOCAL #include "debug.h" #else #define debug(...) 710 #endif const int MOD = 1e9+9; vector solve(string s){ int n = s.size(); ll dp[n+1][2000][2]; for(int i = 0; i < n+1; i++){ for(int j = 0; j < 2000; j++){ for(int k = 0; k < 2; k++){ dp[i][j][k] = 0; } } } dp[0][0][0] = 1; for(int i = 0; i < n; i++){ for(int j = 0; j < 1900; j++){ for(int k = 0; k < 2; k++){ for(int d = 0; d <= (k ? 9: (s[i]-'0')); d++){ (dp[i+1][j+d][k | (d < (s[i]-'0'))] += dp[i][j][k]) %= MOD; } } } } vector ret(2000, 0); for(int i = 0; i < 2000; i++){ ret[i] = dp[n][i][0] + dp[n][i][1]; ret[i] %= MOD; } return ret; } int main(){ ios::sync_with_stdio(false); cin.tie(0); string m, d; cin >> m >> d; auto v = solve(m); auto w = solve(d); debug(v); debug(w); ll ans = 0; for(int i = 1; i < 2000; i++){ ans += v[i] * w[i]; ans %= MOD; } cout << ans << endl; }