class Comb: def __init__(self, N, mod = 998244353): self.n = N self.mod = mod self.fac = [0] * (self.n + 1) self.invf = [0] * (self.n + 1) self.inv = [0] * (self.n + 1) self.fac[0] = 1 self.fac[1] = 1 self.invf[0] = 1 self.invf[1] = 1 self.inv[1] = 1 for i in range(2, self.n + 1): self.fac[i] = self.fac[i - 1] * i % self.mod self.inv[i] = self.mod - self.inv[self.mod % i] * (self.mod // i) % self.mod self.invf[i] = self.invf[i - 1] * self.inv[i] % self.mod def F(self, N): return self.fac[N] def C(self, N, K): return self.invf[K] * self.invf[N - K] % self.mod * self.fac[N] % self.mod def P(self, N, K): return self.invf[N - K] * self.fac[N] % self.mod def H(self, N, K): return self.invf[K] * self.invf[N - 1] % self.mod * self.fac[N + K - 1] % self.mod # a + b √5 mod = 998244353 class Q_v5: def __init__(self, a, b): self.a = a % mod self.b = b % mod def __add__(self, other): return self.__class__((self.a + other.a) % mod, (self.b + other.b) % mod) def __sub__(self, other): return self.__class__((self.a - other.a) % mod, (self.b - other.b) % mod) def __mul__(self, other): return self.__class__((self.a * other.a + self.b * other.b * 5) % mod, (self.a * other.b + self.b * other.a) % mod) def __truediv__(self, other): other_inv = pow(other.a * other.a - 5 * other.b * other.b, mod - 2, mod) return self.__class__((self.a * other.a - 5 * self.b * other.b) * other_inv % mod, (other.a * self.b - self.a * other.b) * other_inv % mod) def __neg__(self): return self.__class__(-self.a % mod, -self.b % mod) def __str__(self): return str(self.a) + ' + ' + str(self.b) + ' √5' # 繰り返し二乗法 def pow_(a: Q_v5, n: int): res = Q_v5(1, 0) now = a for i in range(100): if n & (1 << i): res = res * now now = now * now return res N, K = map(int, input().split()) c = Comb(1000) sm = Q_v5(0, 0) inv2 = 499122177 a = Q_v5(inv2, inv2) b = Q_v5(inv2, -inv2) for i in range(K + 1): p = c.C(K, i) * (1 if i % 2 == 0 else -1) % mod x = pow_(a, K - i) * pow_(b, i) # x^1 + ... + x^N if x.a == 1 and x.b == 0: sm = sm + Q_v5(p * N, 0) else: sm = sm + Q_v5(p, 0) * (pow_(x, N + 1) - x) / (x - Q_v5(1, 0)) sm = sm / pow_(Q_v5(0, 1), K) print(sm.a)