#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; const int n = s.size(); array tmp = {4, 0, 4}; array dp{}; dp[1] = 1; for(int i = 0; i < n; i++){ array ndp{}; for(int S = 0; S < 8; S++){ if(dp[S] == 0) continue; const int r = S & 1 ? s[i] - '0' : 9; if((S & 6) == 6){ if(S & 1){ ndp[7] += dp[S]; if(r >= 1) ndp[6] += r * dp[S]; }else{ ndp[6] += 10 * dp[S]; } }else{ const int fl = S & 1, st = S >> 1; for(int nv = 0; nv <= r; nv++){ int ns = tmp[st] == nv ? st + 1 : (nv == 4); ndp[ns * 2 + ((nv == r) & fl)] += dp[S]; } } } swap(dp, ndp); } cout << accumulate(dp.begin(), dp.begin() + 6, mint(-1)).val() << '\n'; }