#include using namespace std; long long mod = 998244353; //入力が必ず-mod= mod) v -= mod; return *this; } mint operator-=(const mint b){ v -= b.v; if(v < 0) v += mod; return *this; } mint operator*=(const mint b){v = v*b.v%mod; return *this;} mint operator/=(mint b){ if(b == 0) assert(false); int left = mod-2; while(left){if(left&1) *this *= b; b *= b; left >>= 1;} return *this; } mint operator++(){*this += 1; return *this;} mint operator--(){*this -= 1; return *this;} mint operator++(int){*this += 1; return *this;} mint operator--(int){*this -= 1; return *this;} bool operator==(const mint b){return v == b.v;} bool operator!=(const mint b){return v != b.v;} bool operator>(const mint b){return v > b.v;} bool operator>=(const mint b){return v >= b.v;} bool operator<(const mint b){return v < b.v;} bool operator<=(const mint b){return v <= b.v;} mint pow(long long n){ mint ret = 1,p = v; if(n < 0) p = p.inv(),n = -n; while(n){ if(n&1) ret *= p; p *= p; n >>= 1; } return ret; } mint inv(){return mint(1)/v;} }; void jury(int N){ vector> G(3*N,vector(3*N)); for(int i=0; i P(3*N); iota(P.begin(),P.end(),0); vector J(2*N); long long c = 0; do{ if(P.at(0) != 0) break; int edge = 0,pos = 0; for(int i=0; ; i++){ int one = P.at(i),two = P.at(i+1); if(G.at(one).at(two) == false){ edge++; if(abs(one/3-two/3) != 1 || (one+two)%6 != 5){pos = i+2; edge = -1000; break;} } if(two == 3*N-1){pos = i+2; break;} } c++; if(edge >= 0) J.at(edge)++; sort(P.begin()+pos,P.end()); reverse(P.begin()+pos,P.end()); }while(next_permutation(P.begin(),P.end())); for(int i=1; i<2*N; i++) J.at(i) += J.at(i-1); for(auto v : J) cout << v << " "; cout << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,K; cin >> N >> K; if(K == 0){cout << 1 << endl; return 0;} //jury(N); vector dp1(K+1),dp2(K+1),dp3(K+1); vector back1(K+1),back3(K+1); vector hold1(K+1),hold3(K+1); dp1.at(K) = 1; for(int i=0; i next1(K+1),next2(K+1),next3(K+1); mint add = 0; if(i%2 == 0){ for(int k=0; k<=K; k++){ dp1.at(k) += back1.at(k); if(k) dp3.at(k-1) += back3.at(k); add += back1.at(k); if(k) add += back3.at(k); } } else{ for(int k=0; k<=K; k++){ if(k) dp1.at(k-1) += back1.at(k); dp3.at(k) += back3.at(k); add += back3.at(k); if(k) add += back1.at(k); } } //cout << i+1 << " " << add << endl; if(i > 0){ for(int k=0; k<=K; k++){ if(k+2 <= K) back1.at(k) = back1.at(k+2); if(k+2 <= K) back3.at(k) = back3.at(k+2); back1.at(k) += hold1.at(k); back3.at(k) += hold3.at(k); hold1.at(k) = 0,hold3.at(k) = 0; } } if(i%2 == 0){ for(int k=0; k<=K; k++){ mint sum = dp1.at(k)+dp2.at(k)+dp3.at(k); if(k) next1.at(k-1) += sum,next2.at(k-1) += sum; next3.at(k) += sum; if(k-2 >= 0) hold1.at(k-2) += dp3.at(k),hold3.at(k-2) += dp1.at(k); } } else{ for(int k=0; k<=K; k++){ mint sum = dp1.at(k)+dp2.at(k)+dp3.at(k); next1.at(k) += sum; if(k) next2.at(k-1) += sum,next3.at(k-1) += sum; if(k-2 >= 0) hold1.at(k-2) += dp3.at(k),hold3.at(k-2) += dp1.at(k); } } dp1 = next1,dp2 = next2,dp3 = next3; } mint answer = 0; for(auto v : dp1) answer += v; for(auto v : dp2) answer += v; for(auto v : dp3) answer += v; mint add = answer; if(N%2){ for(auto v : back1) answer += v; for(auto v : hold3) answer += v; back3.at(0) = 0; for(auto v : back3) answer += v; back3.at(1) = 0; for(auto v : back3) answer += v; } else{ for(auto v : back3) answer += v; for(auto v : hold1) answer += v; back1.at(0) = 0; for(auto v : back1) answer += v; back1.at(1) = 0; for(auto v : back1) answer += v; } //cout << N << " " << answer-add << endl; cout << answer.v << endl; }