#include using namespace std; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } #include using mint = atcoder::modint998244353; int main() { fast_io(); string n; cin >> n; int len = n.size(); vector dp(len + 1, vector(2, vector(2, 0))); dp[0][0][0] = 1; for (int i = 0; i < len; i++) { for (int smaller = 0; smaller < 2; smaller++) { for (int f = 0; f < 2; f++) { for (int d = 0; d <= (smaller ? 9 : n[i] - '0'); d++) { dp[i + 1][smaller || (d < n[i] - '0')][f || (d == 8)] += dp[i][smaller][f]; } } } } mint ans = dp[len][0][1] + dp[len][1][1]; cout << ans.val() << endl; }