#include <bits/stdc++.h>
typedef long long ll;
const int mod = 998244353;

ll step( int x, int st ){
    if( st == 0 ) return 1;
    return ( step( x, st-1 ) * x ) % mod;
}

int main () {

    int n, m, k;
    std::cin>>n>>m>>k;
    if( k == 1 ){
        std::cout<<step( m, n )<<"\n";
    }else{
        if( k == 2 ){
            ll ans = 0;
            if( n%2 == 0){
                ans = (ans + (step( m, n/2-1 ) * step(m, 2) ))%mod;
            }else{
                ans = (ans + step( m, n/2 + 1 ) ) % mod;
                ans = (ans + step( m, n/2 + 1 ) ) % mod;
            }
            std::cout<<ans<<"\n";
        }
    }

    return 0;
}
