#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; int main(){ ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; array,2> dp; dp[0][1] = 1; for(auto c : s){ int v = c - '0'; array,2> ndp; for(int i = 0; i < 2; i++){ for(int j = 0; j < 2; j++){ int r = j ? v : 9; for(int k = 0; k <= r; k++){ ndp[i | (k == 8)][j & (k == r)] += dp[i][j]; } } } dp = ndp; } cout << (dp[1][0] + dp[1][1]).val() << '\n'; }