#include #include using namespace std; using Mint = atcoder::modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(0); string N; cin >> N; bool exist_8 = false; Mint ans = 0; for (int i = 0; i < (int)N.size(); i++) { int d = N[i] - '0'; for (int j = 0; j < d; j++) { ans += Mint(10).pow((int)N.size() - 1 - i); if (!(exist_8 || j == 8)) ans -= Mint(9).pow((int)N.size() - 1 - i); } if (d == 8) exist_8 = true; } if (exist_8) ans += 1; cout << ans.val() << endl; }