#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include using namespace std; using namespace atcoder; using ll = long long; ll mod = 998244353; 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; } ll inv(ll x, ll mod) { return my_pow(x, mod - 2, mod); } vector pow_poly(vector &vec, ll n, ll mod) { vector ret(0); if (n == 0) { ret.push_back(1); } else if (n % 2 == 1) { vector vec_conv = convolution<998244353>(vec, vec); vector vec_tmp = pow_poly(vec_conv, n / 2, mod); vector vec_nxt = convolution<998244353>(vec, vec_tmp); for (ll i = 0; i < vec_nxt.size(); i++) { ret.push_back(vec_nxt[i]); } } else { vector vec_conv = convolution<998244353>(vec, vec); vector vec_nxt = pow_poly(vec_conv, n / 2, mod); for (ll i = 0; i < vec_nxt.size(); i++) { ret.push_back(vec_nxt[i]); } } return ret; } int main() { ll N, K; cin >> N >> K; vector vec(10); for (ll i = 0; i < 10; i++) { vec[i] = 1; } vector ans_vec1 = pow_poly(vec, (N + 1) / 2, mod); vector ans_vec2 = pow_poly(vec, N / 2, mod); ll len1 = ans_vec1.size(); ll len2 = ans_vec2.size(); vector numsum(N * 9 + 2, 0); for (ll i = 0; i < 11; i++) { vector mod_vec1(len1); for (ll j = 0; j < len1; j++) { if (j % 11 == i) { mod_vec1[j] = ans_vec1[j]; } else { mod_vec1[j] = 0; } } vector mod_vec2(len2); for (ll j = 0; j < len2; j++) { if (j % 11 == i) { mod_vec2[j] = ans_vec2[j]; } else { mod_vec2[j] = 0; } } vector conv = convolution<998244353>(mod_vec1, mod_vec2); for (ll j = 0; j < conv.size(); j++) { numsum[j] = (numsum[j] + conv[j]) % mod; } } ll ans = 0; for (ll i = 0; i <= N * 9; i += 9) { ans = (ans + (numsum[i] * my_pow(i, K, mod))) % mod; } cout << ans << endl; }