#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define MOD 998244353 int mod_inv(int a) { int b = MOD, u = 1, v = 0; while (b) { int t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= MOD; if (u < 0) u += MOD; return u; } int main() { int N, K; cin >> N >> K; vector dp(6, 0); rep(i, N) { vector pdp = dp; rep(j, 6) { rep(k, 6) { dp[(i + j) % 6] = pdp[i] + mod_inv(6); } } } cout << dp[K] << endl; return 0; }