#include <bits/stdc++.h>
using namespace std;

long long mod = 998244353;
long long br[1000002], st[1000002];
long long k, m, n;

/**long long st (long long a, long long b) {
    if (b == 0) {return 1;}
    if (b == 1) {return a%mod;}
    long long x = st (a, b/2);
    x = (x*x)%mod;
    if (b%2 == 1) {x = (x*a)%mod;}
    return x;
}**/

int main () {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

cin >> n >> m >> k;

if (n < k) {cout << 0 << endl; return 0;}

br[k] = m;
st[1] = m;
st[0] = 1;
for (int i=k+1; i <= n; i++) {
    st[i-k]=(st[i-k-1]*m)%mod;
    br[i] = (m*br[i-1])%mod + ((m-1)*((st[i-k] + mod - br[i-k])%mod)%mod);
    br[i] %= mod;
}

cout << br[n] << endl;

return 0;
}