#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 struct combi{ deque kaijou; deque kaijou_; combi(int n){ kaijou.push_back(1); for(int i=1;i<=n;i++){ kaijou.push_back(kaijou[i-1]*i); } mint b=kaijou[n].inv(); kaijou_.push_front(b); for(int i=1;i<=n;i++){ int k=n+1-i; kaijou_.push_front(kaijou_[0]*k); } } mint combination(int n,int r){ if(r>n)return 0; mint a = kaijou[n]*kaijou_[r]; a *= kaijou_[n-r]; return a; } mint junretsu(int a,int b){ mint x = kaijou_[a]*kaijou_[b]; x *= kaijou[a+b]; return x; } mint catalan(int n){ return combination(2*n,n)/(n+1); } }; int N,K; array,2>,2> merge(array,2>,2> a,array,2>,2> b){ array,2>,2> ret; rep(i,2){ rep(j,2){ ret[i][j] = vector(K+1,0); } } //cout<>N>>K; array,2>,2> dp; dp[0][0] = vector(K+1,0); dp[0][0][0] = 1; dp[0][1] = dp[0][0]; { vector t(K+1); for(int i=0;i<=K;i++){ t[i] = C.kaijou_[i]; } dp[1][0] = t; dp[1][1] = t; } array,2>,2> cur; rep(i,2){ rep(j,2)cur[i][j] = vector(K+1,0); } cur[0][0][0] = 1; rep(i,18){ if((N>>i)&1){ cur = merge(cur,dp); } dp = merge(dp,dp); } /* rep(i,2){ rep(j,2){ rep(k,cur[i][j].size())cout<K)ans += cur[i][j][K]; } } rep(i,K)ans *= i+1; cout<