#include #include using namespace std; using namespace atcoder; #define rep(i, n) for(int i =0; i < (n); i++) using ll = long long int; string s; ll f(int pos, bool tight, bool has8) { if (pos == s.size()) { return has8; } ll res = 0; int limit = tight ? (s[pos] - '0') : 9; for (int d = 0; d <= limit; d++) { bool new_tight = tight && (d == limit); bool new_has8 = has8 || (d == 8); res += f(pos + 1, new_tight, new_has8); res %= 998244353; } return res; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); //freopen("input.txt", "r", stdin); cin >> s; cout << f(0, true, false) << endl; return 0; }