#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353L;
long long power(long long base, long long raise) {
    long long result = 1;
    long long curr = base;
    while(raise != 0) {
        int rem = raise % 2;
        raise /= 2;
        if(rem == 1) {
            result *= curr;
            result %= mod;
        }
        curr *= curr;
        curr %= mod;
    }
    return result;
}

long long factorial(long long n) {
    int result = 1;
    if(n <= 1) return 1;
    for(int i = 1; i <= n; i++) {
        result *= i;
        result %= mod;
    }
    return result;
}

int main() {

    int n, m, k;
    cin >> n >> m >> k;
    if(k == 1) {
        cout << power(m, n);
        return 0;
    }
    if(k == 2) {
        cout << power(m, n) - factorial(m) / factorial(m - n);
        return 0;
    }
    int arr[n];
    long long result = 0;
    for(int i = 0; i < n; i++) {
        arr[i] = 1;
    }
    long long p = power(m, n);
    for(int i = 0; i < p; i++) {
        arr[0]++;
        if(arr[0] == m + 1) {
            for(int j = 0; true; j++) {
                arr[j] = 1;
                if(j != n - 1 && arr[j + 1] != m) {
                    arr[j + 1]++;
                    break;
                }
            }
        }

        long long counter = 0;
        int last = arr[0];
        for(int j = 0; j < n; j++) {
            if(arr[j] == last) {
                counter++;
                if(counter == k) {
                    result++;
                    break;
                } else {
                    last = arr[j];
                    counter == 1;
                }
            }
        }
    }

    cout << result % mod << endl;


    return 0;
}
