#include using namespace std; const int MAXN = 1000001, MOD = 998244353; int n, f[MAXN][2][3], ans; string s; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> s; n = s.size(), s = ' ' + s; f[0][1][0] = 1; for(int i = 0; i < n; ++i) { for(bool lim : {0, 1}) { for(int op : {0, 1, 2}) { int r = s[i + 1] - '0'; for(int num = 0; num <= (lim ? r : 9); ++num) { if(!(op == 2 && num == 4)) { f[i + 1][lim & (num == r)][(num == 4 ? 1 : (op == 1 && num == 0 ? 2 : 0))] = (f[i + 1][lim & (num == r)][(num == 4 ? 1 : (op == 1 && num == 0 ? 2 : 0))] + f[i][lim][op]) % MOD; } } } } } for(bool lim : {0, 1}) { for(int op : {0, 1, 2}) { ans = (ans + f[n][lim][op]) % MOD; } } cout << (ans - 1 + MOD) % MOD; return 0; }