Problem:
Score : 500 points

Problem Statement

There are N blocks arranged in a row. Let us paint these blocks.

We will consider two ways to paint the blocks different if and only if there is a block painted in different colors in those two ways.

Find the number of ways to paint the blocks under the following conditions:

For each block, use one of the M colors, Color 1 through Color M, to paint it. It is not mandatory to use all the colors.

There may be at most K pairs of adjacent blocks that are painted in the same color.

Since the count may be enormous, print it modulo 998244353.

Constraints

All values in input are integers.

1 \leq N, M \leq 2 \times 10^5

0 \leq K \leq N - 1

Input

Input is given from Standard Input in the following format:

N M K

Output

Print the answer.

Sample Input 1

3 2 1

Sample Output 1

6

The following ways to paint the blocks satisfy the conditions: 112, 121, 122, 211, 212, and 221. Here, digits represent the colors of the blocks.

Sample Input 2

100 100 0

Sample Output 2

73074801

Sample Input 3

60522 114575 7559

Sample Output 3

479519525

Solution in C++ (GCC 9.2.1) (judge verdict: Accepted)

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

constexpr ll MOD = 998244353;

namespace math { namespace integer {

ll mod_pow(ll x, ll n, ll mod) { if(n == 0) { return 1; } if(n % 2 == 0) { return mod_pow(x * x % mod, n / 2, mod); } else { return x * mod_pow(x, n - 1, mod) % mod; } }
template<class T> T extgcd(T a, T b, T& x, T& y) { T d = a; if(b != 0) { d = extgcd(b, a % b, y, x); y -= (a / b) * x;} else { x = 1, y = 0; } return d; }
template<class T> T mod_inverse(T x, T mod) { return mod_pow(x, T(mod - 2), mod); /* use fermat */ }
template<class T> T mod_inverse_composite_num_mod(T a, ll mod) { T x, y; extgcd(a, mod, x, y); return (mod + x % mod) % mod; }

}}
using namespace math::integer;

namespace math {

constexpr int MaxFact = 200020;

template<class T = ll>
struct FactRevFactList {
  array<T, MaxFact+1> fact_;
  array<T, MaxFact+1> rev_fact_;

  FactRevFactList() {
    fact_[0] = 1;
    for(int i=1; i<MaxFact; i++) {
      fact_[i] = fact_[i-1] * i;
      fact_[i] %= MOD;
    }

    rev_fact_[MaxFact-1] = mod_pow(fact_[MaxFact-1], (T)MOD-2, MOD);

    for(int i=MaxFact-2; i>=0; i--) {
      rev_fact_[i] = rev_fact_[i+1] * (i+1);
      rev_fact_[i] %= MOD;
    }
  }

  T fact(int x) const { return fact_[x]; }
  T fact_inv(int x) const { return rev_fact_[x]; }
};

template<class T = ll>
struct CombinationBig {
  math::FactRevFactList<> fr_;
  T comb(T n, T r) { return (fr_.fact(n) * fr_.fact_inv(r) % MOD) * fr_.fact_inv(n-r) % MOD; }
};

}

math::CombinationBig<> cbig;

int main() {
  ll N, M, K; cin >> N >> M >> K;
  ll ans = 0;
  rep(k, K + 1) {
    auto c = cbig.comb(N - 1, k) % MOD;
    c *= mod_pow(M - 1, N - k - 1, MOD) % MOD;
    ans += c % MOD;
    ans %= MOD;
  }
  ans *= M;
  ans %= MOD;
  cout << ans << endl;
}