#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; int mod = 998244353; mint f[2010][2010],fa[2010],fi[2010]; mint pw(mint a,int x){ mint ret = 1; while(x){ if(x&1) (ret *= a); (a *= a); x /= 2; } return ret; } mint nck(int n,int k){ if(n<0 || k<0 || n=1;i--) fi[i] = fi[i + 1]*(i + 1); } int main(){ int i,j,k,x,n,m; cin >> n >> m; solve(); for(k=0;k<=n;k++){ vector g(n + 2),h(n + 2); for(j=0;j<=n + 1;j++) g[j] = pw(m + 1 - j,k)*pw(mod - 1,j)*fi[j]; for(j=0;j<=n + 1;j++) h[j] = fi[j]; g = convolution(g,h); for(j=0;j<=min(m + 1,n + 1);j++) f[k][j] = pw(m + 1,n - k)*fa[j]*g[j]; } mint ans = 0; for(i=1;i<=n + 1;i++){ for(k=1;k<=n;k++) ans += nck(n,k)*f[k][i]; } cout << ans.val() << endl; }