#include using namespace std; #include using namespace atcoder; using ll = long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; ++i) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> x; vector dp(100,0); bool ok = true; int n = x.size(), state = 0; rep(i,n){ vector upd(100,0), tot(10,0); rep(j,100) tot[j%10] += dp[j]; rep(j,10){ rep(k,10){ upd[j*10+k] += tot[j]; } } upd[4] -= dp[40]; if(ok){ rep(j,(int)(x[i]-'0')){ if(state==40 && j==4) continue; upd[(state*10+j)%100] += 1; } } state = state * 10 + x[i] - '0'; if(state==404) ok = false; state %= 100; dp = upd; } mint tot = ok-1; rep(i,100) tot += dp[i]; cout << tot.val() << '\n'; return 0; }