// g++-13 1.cpp -std=c++17 -O2 -I . #include using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include using namespace __gnu_pbds; #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) using mint = modint998244353; using fps = vector; random_device seed; mt19937_64 randint(seed()); ll grr(ll mi, ll ma) { // [mi, ma) return mi + randint() % (ma - mi); } vector> mul(vector> &m1,vector> &m2){ // cout<<"call mul"<> res(x,vector(x,{0})); rep(i,0,x){ rep(j,0,x){ rep(k,0,x){ // [i][k] * [k][j] fps f=convolution(m1[i][k],m2[k][j]); int s=f.size(); rep(l,0,s){ if(l> pw(vector> &mat,int n){ // cout<<"call pw "<> res(x,vector(x,{0})); rep(i,0,x){ res[i][i]={1}; } return res; } if(n==1){ return mat; } vector> p=pw(mat,n/2),q=pw(mat,n%2); vector> res=mul(p,p); res=mul(res,q); return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n,h;cin>>n>>h; vector> init(3,vector(3,{0})); mint inv2=1,inv3=1,inv5=1; inv2/=2,inv3/=3,inv5/=5; init[0][0]={inv2}; init[0][1]={inv3}; init[1][0]={0,inv2}; init[1][1]={0,inv3}; init[1][2]={0,inv3}; init[2][1]={0,2*inv3}; init[2][2]={0,inv3}; vector> mt=pw(init,n-1); vector f={{inv5,0},{0,inv5},{0,inv5}}; // cout<<"mt ok"<