#include using namespace std; typedef long long ll; typedef long double ld; typedef pair point; typedef pair pii; typedef pair pll; const int N = (int)(20) + 7; const int M = (int)(1e3) + 7; const ll MOD = (ll)(998244353); const ll INF = (ll)(1e10) + 7; const ld eps = (ld)(1e-12); #define pb push_back #define mp make_pair #define x first #define y second void precalc() { } ll pw(ll a, ll b) { if (!b) { return 1LL; } ll x = pw(a, b / 2LL); x *= x; x %= MOD; if (b & (1LL)) { x *= a; x %= MOD; } return x; } void solve(int num_t) { ll n, k; cin >> n >> k; ll ans = pw(k, n); ans = pw(ans, MOD - 2); ans *= (((n * k) % MOD) * (k - 1LL)) % MOD; ans %= MOD; cout << ans << endl; } int main() { precalc(); /*int ttt; cin >> ttt; for (int i = 0; i < ttt; ++i) { solve(i); }//*/solve(0); return 0; }