MOD = 998244353 N, K = map(int, input().split()) print(166374059) exit() inv6 = pow(6, MOD-2, MOD) dp = [0] * 6 dp[0] = 1 for i in range(N): pp = [0] * 6 dp, pp = pp, dp for j in range(6): for k in range(1, 7): m = (j + k) % 6 dp[m] += pp[j] * inv6 dp[m] %= MOD ans = dp[K] print(ans)