#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=998244353; const double PI=acos(-1); //xのy乗 ll mod_pow(ll x,ll y,ll mod){ ll power=x; ll ret = 1; while(y>0){ if(y&1){ ret = ret*power%mod; } power = power*power%mod; y = y>>1; } return ret; } struct combination{ typedef long long ll; std::vector fact,ifact; combination(ll n): fact(n+1),ifact(n+1){ fact[0]=1;//0!=1通り for(ll i=1;i<=n;i++) fact[i] = fact[i-1]*i%MOD; //ifact[n] = fact[n].inv(); // n!の逆元がifact[n] ifact[n] = mod_pow(fact[n],MOD-2,MOD);// n!を(mod-2)乗した後でmodであまりをとった for(ll i=n;i>=1;i--) ifact[i-1] = ifact[i]*i%MOD; } ll operator()(ll n,ll k){ if(k<0 || k>n) return 0; // n!/( k!*(n-k)! ) return (fact[n]*ifact[k])%MOD * ifact[n-k]%MOD; } }; combination comb(2*100000); int main(){ int N,K; cin>>N>>K; ll c=mod_pow(K,N,MOD); ll inv=mod_pow(c,MOD-2,MOD); ll nom=K; nom*=(K-1); nom%=MOD; nom*=comb(N,N-1); nom%=MOD; ll ans=nom*inv%MOD; cout<