N,K = map(int, input().split()) mod = 998244353 def matrix_multiply(A, B): """2つの行列AとBの乗算を行う""" result = [[0 for _ in range(len(B[0]))] for _ in range(len(A))] for i in range(len(A)): for j in range(len(B[0])): for k in range(len(B)): result[i][j] = (result[i][j] + (A[i][k] * B[k][j]))%mod return result divsix = pow(6,mod-2,mod) transition_matrix = [[divsix for _ in range(6)] for _ in range(6)] ANS = [[0 for _ in range(6)] for _ in range(6)] for i in range(N): ANS[i][i]=1 while N: if N & 1: ANS = matrix_multiply(ANS, transition_matrix) transition_matrix = matrix_multiply(transition_matrix, transition_matrix) N //= 2 print(ANS[0][K])