// g++-13 2.cpp -std=c++20 -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()) random_device seed; mt19937_64 randint(seed()); ll grr(ll mi, ll ma) { // [mi, ma) return mi + randint() % (ma - mi); } using mint = modint998244353; int main(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,m;cin>>n>>m; mint ans=0; rep(v,1,m+1){ // min >= v なる i の個数の期待値 mint prob=m-v+1; prob/=m; // prob=1-prob; if(prob.val()==1){ ans+=n; continue; } mint c=prob.pow(n); c=(1-c)/(1-prob); c*=prob; ans+=c; } rep(i,0,n){ ans*=m; } cout<