#include // #include // #include using namespace std; // using namespace atcoder; // using bint = boost::multiprecision::cpp_int; using ll = long long; using ull = unsigned long long; using ld = long double; using P = pair; using vi = vector; using vvi = vector; using vvvi = vector; using ve = vector>; using vb = vector; using vvb = vector; #define rep(i,n) for(ll i = 0;i < (ll)n;i++) #define ALL(x) (x).begin(),(x).end() #define sz(c) ((ll)(c).size()) #define LB(A,x) (int)(lower_bound(A.begin(),A.end(),x)-A.begin()) #define UB(A,x) (int)(upper_bound(A.begin(),A.end(),x)-A.begin()) // #define MOD 1000000007 #define MOD 998244353 templateusing min_priority_queue=priority_queue,greater>; templateostream&operator<<(ostream&os,vector&v){for(int i = 0;i < v.size();i++)os<istream&operator>>(istream&is,vector&v){for(T&in:v)is>>in;return is;} templateostream&operator<<(ostream&os,pair&p){os<istream&operator>>(istream&is,pair&p){is>>p.first>>p.second;return is;} template inline bool chmax(T &a,T b){if(a < b){a = b;return true;}return false;} template inline bool chmin(T &a,T b){if(a > b){a = b;return true;}return false;} ld dist(ld x1,ld y1,ld x2, ld y2){return sqrtl((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));} template< int mod > struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; } ModInt &operator-=(const ModInt &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; } ModInt &operator*=(const ModInt &p) { x = (int) (1LL * x * p.x % mod); return *this; } ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; } ModInt operator-() const { return ModInt(-x); } ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; } ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; } ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; } ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; } bool operator==(const ModInt &p) const { return x == p.x; } bool operator!=(const ModInt &p) const { return x != p.x; } ModInt inverse() const { int a = x, b = mod, u = 1, v = 0, t; while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return ModInt(u); } ModInt pow(int64_t n) const { ModInt ret(1), mul(x); while(n > 0) { if(n & 1) ret *= mul; mul *= mul; n >>= 1; } return ret; } friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; } friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); } static int get_mod() { return mod; } }; using modint = ModInt< MOD >; using mvi = vector; using mvvi = vector; int main(){ ios_base::sync_with_stdio(0), cin.tie(0); string s;cin >> s; int n = sz(s); mvvi dp(3,mvi(2)); dp[0][1] = 1; rep(i,n){ mvvi DP(3,mvi(2)); int dig = s[i]-'0'; rep(j,3)rep(k,2)rep(l,10){ if(k && l > dig)break; int nk = (k && (l == dig)); if(j == 2 && l == 4)continue; else if(l == 4)DP[1][nk] += dp[j][k]; else if(j == 1 && l == 0)DP[2][nk] += dp[j][k]; else DP[0][nk] += dp[j][k]; } swap(dp,DP); } modint res = 0; rep(i,3)rep(j,2)res += dp[i][j]; cout << res-1 << "\n"; // rep(i,3)rep(j,2)cout << dp[i][j] <<" \n"[j+1 == 2]; return 0; }