#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; typedef unsigned long long ULL; #define MEM(a,b) memset((a),(b),sizeof(a)) const LL INF = 1e9 + 7; const int N = 1e2 + 10; const LL mod = 998244353; LL powmod(LL a, LL b) { LL ret = 1; while (b) { if (b & 1) ret = ret * a % mod; b >>= 1; a = a * a % mod; } return ret; } int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n, k; cin >> n >> k; LL tot = n * k%mod * (k - 1)%mod; LL rev = powmod(k, n); rev = powmod(rev, mod - 2); cout << tot * rev % mod << endl; return 0; }