$$f_k(n) = \sum\limits_{i=1}^n \binom{n-1}{i-1} \sum\limits_{2r+s=k-1} (f_{2r}(i-1) + f_{2r+1}(i-1))f_s(n-i)$$

\begin{aligned} \frac{\partial F}{\partial x} &= (tF_0 + F_1) F \\ \frac{\partial F_0}{\partial x} &= (tF_0 + F_1) F_1 \\ \frac{\partial F_1}{\partial x} &= (tF_0 + F_1) F_2 \end{aligned}

\begin{aligned} \frac{\partial(F_0^2-F_1^2)}{\partial x} &= \frac{\partial F_0^2}{\partial x} – \frac{\partial F_1^2}{\partial x} \\ &= 0 \end{aligned}

\begin{aligned} &\quad \; F_0^2 – F_1^2 \\ &= 1 \\ &= \left(\frac12(F(x,t)+F(x,-t))\right)^2 – \left(\frac12(F(x,t)-F(x,-t)\right)^2 \\ &= F(x,t) F(x,-t) \end{aligned}

\begin{aligned} \frac{\partial F}{\partial x} &= (tF_0 + F_1) F \\ &= \frac12 ((t+1)F+(t-1)F^{-1}) F \\ \frac{\partial F}{((t+1)F+(t-1)F^{-1})F} &= \frac{\partial x}2 \end{aligned}

$$\frac{\partial G}{(1-t^2)G^2-1} = \frac{\partial x}2$$

\begin{aligned} \partial (\alpha G) \left(\frac1{\alpha G-1} – \frac1{\alpha G+1}\right) &= \alpha \partial x \\ \ln \frac{\alpha G – 1}{\alpha G + 1} &= \alpha x + C’ \\ \frac{\alpha G – 1}{\alpha G + 1} &= {\rm e}^{\alpha x+C’} \\ &= {\rm e}^{\alpha x} C \\ G &= \frac{ 1+C{\rm e}^{\alpha x} }{\alpha(1-C{\rm e}^{\alpha x})} \end{aligned}

$$C = \frac{\frac{\alpha}{1-t}-1}{\frac{\alpha}{1-t}+1} = \frac{1-\alpha}t$$

$$G = \frac1{\alpha} \left(\frac2{ 1-C{\rm e}^{\alpha x} }-1\right) = \frac1{\alpha} \left(\frac2{ 1-\frac{1-\alpha}t{\rm e}^{\alpha x} }-1\right)$$

\begin{aligned} &\quad\; \frac 2{\alpha} \left(1-\frac{1-\alpha}t {\rm e}^{\alpha x}\right)^{-1} \\ &= \frac 2{\alpha} \sum\limits_r \left(\frac{1-\alpha}t {\rm e}^{\alpha x} \right)^r \\ &= \frac 2{\alpha} \sum\limits_r \left(\frac{1-\alpha}t\right)^r \sum\limits_{s} \frac{(r\alpha x)^s}{s!} \\ &= 2 \sum\limits_r t^{-r} \sum\limits_{s} \frac{(rx)^s}{s!} (1-\alpha)^r \alpha^{s-1} \\ \end{aligned}

$$(1-\sqrt{1-t^2})^r (1-t^2)^{(s-1)/2}$$

$$(1-\sqrt{1-4x})^r (1-4x)^{(s-1)/2}$$

$$F = \frac{ 1-2x-\sqrt{1-4x} }{2x},\quad x = \frac{F}{(1+F)^2}$$

\begin{aligned} (1-\sqrt{1-4x})^r (1-4x)^{(s-1)/2} &= (2x(1+F))^r (1-2x-2xF)^{s-1} \\ &= 2^r x^r (1+F)^r (1-2x(1+F))^{s-1} \\ &= 2^rF^r (1-F)^{s-1} (1+F)^{-r-s+1} \end{aligned}

\begin{aligned} [x^n] F^r (1-F)^{r-1} (1+F)^{-r-s+1} &= [x^n] x^r (1-x)^{r-1} (1+x)^{-r-s+1} \frac{1-x}{(1+x)^3} (1+x)^{2n+2} \\ &= [x^n] x^r (1-x)^r (1+x)^{2n-r-s} \\ &= \sum\limits_i (-1)^i \binom ri \binom{2n-r-s}{n-r-i} \end{aligned}

\begin{aligned} &= 2 \sum\limits_r t^{-r} \sum\limits_{s} \frac{(rx)^s}{s!} 2^r \sum\limits_l \left(\frac{t^2}4\right)^l \sum\limits_i (-1)^i \binom{s}{i} \binom{2l-r-s}{l-r-i} \\ &= 2 \sum\limits_r t^{-r} \sum\limits_{s} \frac{(rx)^s}{s!} 2^r \sum\limits_{u} \left(\frac{t^2}4\right)^{r+u} \sum\limits_i (-1)^i \binom{s}{i} \binom{r+2u-s}{u-i} \\ &= \sum\limits_{r,s,u} 2^{1-r-2u} t^{r+2u} \frac{(rx)^s}{s!} \sum\limits_i (-1)^i \binom si \binom{r+2u-s}{u-i} \end{aligned}

$$g_k(n) = 2^{1-k} \sum\limits_{2i+r \le k,r\equiv k \pmod 2} r^n (-1)^i \binom ni \binom{k-n}{\frac{k-r}2-i}$$

$$f_t = \sum\limits_i (-1)^i \binom ni \binom{-s}{t-i}$$

$$F(x) = (1+x)^{-s} (1-x)^n$$

$$F’ = \frac{-sF}{1+x} – \frac{nF}{1-x}$$

$$tf_t = -(n+s)f_{t-1} + (s-n+t-2)f_{t-2}$$

#include <cstdio>
#include <cstring>
using namespace std;
const int K = 1e6;
const int mod = 998244353;
inline int fpow(int a,int b)
{
int ret = 1;
for(;b;b >>= 1)
(b & 1) && (ret = (long long)ret * a % mod),a = (long long)a * a % mod;
return ret;
}
long long n;
int k;
int ans;
int inv[K + 5];
int vis[K + 5],cnt,prime[K + 5],pw[K + 5];
int f[K + 5];
int get(long long n,int k)
{
if(k <= 0)
return 0;
int ret = 0;
int s = (n - k) % mod;
f[0] = 1;
for(register int t = 1;t <= (k >> 1);++t)
f[t] = ((2 * mod - n % mod - s) % mod * f[t - 1] + (s + t - n % mod - 2 + mod) % mod * (t >= 2 ? f[t - 2] : 0)) % mod,
f[t] = (long long)inv[t] * f[t] % mod;
for(register int r = k;r >= 0;r -= 2)
ret = (ret + (long long)pw[r] * f[k - r >> 1]) % mod;
ret = (long long)ret * fpow(2,(mod - k) % (mod - 1)) % mod;
return ret;
}
int main()
{
scanf("%lld%d",&n,&k);
pw[1] = 1;
for(register int i = 2;i <= k;++i)
{
if(!vis[i])
pw[i] = fpow(i,n % (mod - 1));
for(register int j = 1;j <= cnt && i * prime[j] <= k;++j)
{
vis[i * prime[j]] = 1,pw[i * prime[j]] = (long long)pw[i] * pw[prime[j]] % mod;
if(!(i % prime[j]))
break;
}
}
inv[1] = 1;
for(register int i = 2;i <= (k >> 1);++i)
inv[i] = (long long)(mod - mod / i) * inv[mod % i] % mod;
ans = (get(n,k) - get(n,k - 1) + mod) % mod;
printf("%d\n",ans);
}