#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = (int)(n); i >= 0; i--) #define all(v) v.begin(), v.end() #define mod1 1000000007 #define mod2 998244353 typedef long long ll; ll my_pow(ll x, ll n, ll mod){ // 繰り返し二乗法.x^nをmodで割った余り. ll ret; if (n == 0){ ret = 1; } else if (n % 2 == 1){ ret = (x * my_pow((x * x) % mod, n / 2, mod)) % mod; } else{ ret = my_pow((x * x) % mod, n / 2, mod); } return ret; } int main(){ ll n; cin >> n; vector>> dp(n + 1, vector>(606, vector(606))); for (ll k = 0; k < 606; k++){ dp[0][0][k] = 1; } for (ll i = 0; i < n; i++){ for (ll j = 0; j < 606; j++){ for (ll k = 1; k < 606; k++){ if (i == n - 1){ if (j >= 1){ if (k <= 9){ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 1][k - 1]) % mod2; } else{ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 1][k - 1] + mod2 - dp[i][j - 1][k - 10]) % mod2; } } //長さ3 if (j >= 2){ if (k <= 9) continue; else if (k <= 99){ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 2][k - 10]) % mod2; } else{ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 2][k - 10] + mod2 - dp[i][j - 2][k - 100]) % mod2; } } if (j >= 3){ if (k <= 99) continue; else{ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 3][k - 100]) % mod2; } } } else{ //長さ2 if (j >= 2){ if (k <= 9){ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 2][k - 1]) % mod2; } else{ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 2][k - 1] + mod2 - dp[i][j - 2][k - 10]) % mod2; } } //長さ3 if (j >= 3){ if (k <= 9) continue; else if (k <= 99){ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 3][k - 10]) % mod2; } else{ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 3][k - 10] + mod2 - dp[i][j - 3][k - 100]) % mod2; } } if (j >= 4){ if (k <= 99) continue; else{ dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j - 4][k - 100]) % mod2; } } } } for (ll k = 0; k < 403; k++){ dp[i][j][k + 1] = (dp[i][j][k + 1] + dp[i][j][k]) % mod2; } } } ll ans = 0; for (ll j = 1; j <= 605; j++){ ans = (ans + dp[n][j][j] + mod2 - dp[n][j][j - 1]) % mod2; } cout << ans << endl; }