#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define Inf 1000000001 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 main(){ int n,m; cin>>n>>m; combi C(100000); vector dp(n+1,0); dp[0] = 1; mint ans = 0; for(int i=1;i<=n+3;i++){ if(i-1>m)break; rep(j,dp.size()){ dp[j] *= C.kaijou_[j]; } vector tdp(n+1,0); rep(j,n+1){ if(j==0)continue; tdp[j] = C.kaijou_[j]; } dp = convolution(dp,tdp); while(dp.size()>n+1)dp.pop_back(); rep(j,dp.size())dp[j] *= C.kaijou[j]; int tt = m+1; tt += max(0, m-(i+1)+1); rep(j,dp.size()){ mint x = dp[j]; x *= C.combination(n,j); x *= mint(tt).pow(n-j); x *= i; ans += x; } } cout<