On his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard.There are $$$n$$$ bricks lined in a row on the ground. Chouti has got $$$m$$$ paint buckets of different colors at hand, so he painted each brick in one of those $$$m$$$ colors.Having finished painting all bricks, Chouti was satisfied. He stood back and decided to find something fun with these bricks. After some counting, he found there are $$$k$$$ bricks with a color different from the color of the brick on its left (the first brick is not counted, for sure).So as usual, he needs your help in counting how many ways could he paint the bricks. Two ways of painting bricks are different if there is at least one brick painted in different colors in these two ways. Because the answer might be quite big, you only need to output the number of ways modulo $$$998\,244\,353$$$.

The first and only line contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$1 \leq n,m \leq 2000, 0 \leq k \leq n-1$$$) — the number of bricks, the number of colors, and the number of bricks, such that its color differs from the color of brick to the left of it.

Print one integer — the number of ways to color bricks modulo $$$998\,244\,353$$$.

NoteIn the first example, since $$$k=0$$$, the color of every brick should be the same, so there will be exactly $$$m=3$$$ ways to color the bricks.In the second example, suppose the two colors in the buckets are yellow and lime, the following image shows all $$$4$$$ possible colorings.

from decimal import Decimal
import operator as op
from functools import reduce
import math

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

z, m, k = input().split()
z = int(z)
m = int(m)
k = int(k)

p = 998244353

l = math.factorial(z-1)//(math.factorial(k) * math.factorial(z - 1 - k))
pow = (m - 1)**k
answer = int(Decimal(l * m * pow))%p
print(answer)

import sys
range = xrange
input = raw_input

MOD = 998244353

n,m,k = [int(x) for x in input().split()]

ways = [0]*n
ways[0] = m

for i in range(1,n):
    for j in reversed(range(1,n)):
        ways[j] = (ways[j]+(m-1)*ways[j-1])%MOD

print ways[k]%MOD

from math import factorial as f;
n , m , k = map(int,input().split());
ans = (f(n-1)//(f(n-k-1)*f(k)))*m*((m-1)**k)
print(int(ans%998244353));

mod = 998244353
def comb(n, r):
    facn = 1
    for i in range(1, n+1):
        facn = facn * i
    facr = 1
    for i in range(1, r+1):
        facr *= i
    facnr = 1
    for i in range(1, n-r+1):
        facnr *= i
    res = facn // (facnr*facr)
    res = res%mod
    return res

nmk = list(map(int , input().split()))
n = nmk[0]
m = nmk[1]
k = nmk[2]
res = (comb(n-1, k) * m* (m-1)**(k)) % mod
print(int(res))

import math

def nCr(n, r):
    f = math.factorial
    return f(n) // f(r) // f(n - r)

MOD = 998244353
n, m, k = list(map(int, input().split()))
res = pow(m - 1, k, MOD)
res = (res * m) % MOD
res = res * nCr(n - 1, k) % MOD
print(res)

import sys,threading
sys.setrecursionlimit(4000000)
threading.stack_size(10**8)
def f(x,y):
    global m,dp
    a=0
    b=0
    if x==1 and y==1:
        return m-1
    if x==1 and y==0:
        return 1
    if dp[x][y]>=0:
        return dp[x][y]
    if y>0 and x>=y:
        a=(m-1)*f(x-1,y-1)
        a%=998244353
    if x>=y:
        b=f(x-1,y)
        b%=998244353
    dp[x][y]=(a+b)%998244353
    return dp[x][y]
def main():
    global m,dp
    dp=[[-1 for j in range(2001)] for i in range(2001)]
    n,m,k=map(int,input().split())
    if n>1:
        ans=m*f(n-1,k)
    else:
        ans=m
    print(ans%998244353)
t=threading.Thread(target=main)
t.start()
t.join()

import math
n , m , k = [int(x) for x in input().split()]
if k==0:
	ans=m
else:
	a=m*(math.factorial(n-1)//(math.factorial(k)*math.factorial(n-1-k)))*((m-1)**k)
	ans=a%998244353
print(ans)

import math

MOD = 998244353

n, m, k = [int(x) for x in input().split()]

ans = (math.factorial(n-1)//(math.factorial(k)*math.factorial(n-k-1)))*m*((m-1)**k)
print(ans%MOD)

def main():
    n, m, k = map(int, raw_input().split())
    dp = [m] + [0] * k
    mod = 998244353
    for i in xrange(n - 1):
        for j in xrange(k, 0, -1):
            dp[j] = (dp[j] + dp[j-1] * (m - 1)) % mod
    print dp[-1]
main()

dp=[[0 for j in range(2001)] for i in range(2001)]
n,m,k=map(int,input().split())
for i in range(1,n+1):
    for j in range(k+1):
        if j==0 and i==1:
            dp[i][j]=m
            continue
        if j<=i-1:
            dp[i][j]=(m-1)*dp[i-1][j-1]+dp[i-1][j]
            dp[i][j]%=998244353
print(dp[n][k])

def binomialCoef(n, k):
    C = [[0 for x in range(k+1)] for x in range(n+1)]
    mod = 998244353
    for i in range(n+1):
        for j in range(min(i, k)+1):
            if j == 0 or j == i:
                C[i][j] = 1
            else:
                C[i][j] = (C[i-1][j-1] + C[i-1][j] )%mod

    return C[n][k]

n,m,k = map(int,input().split())
mod = 998244353
y  = binomialCoef(n-1, k)
z = (m * ((m-1)**k))%mod
print(int((y*z)%mod))

mod = 998244353
fac = [1]
for i in range(1, 2001):
    fac.append(fac[-1] * i % mod)

def fexp(x, y):
    ans = 1
    while y > 0:
        if y % 2 == 1:
            ans = ans * x % mod
        x = x * x % mod
        y //= 2
    return ans

def rev(x):
    return fexp(x, mod - 2)

def c(n, k):
    return fac[n] * rev(fac[n - k]) * rev(fac[k]) % mod

n, m, k = map(int, input().split(' '))
print(c(n - 1, k) * m * fexp(m - 1, k) % mod)

n, m, k = map(int, input().split())
ans = 1
for i in range(k):
	ans *= (n - 1 - i)
	ans //= (i + 1)
print((ans * m * (m - 1) ** k) % 998244353)

N = 2003
MOD = 998244353
nCr = [[] for _ in range(N)]

def init():
    for i in range(N):
        nCr[i] = [0 for _ in range(N)]
    for i in range(N):
        nCr[i][0] = 1
    for i in range(1, N):
        for j in range(1, N):
            nCr[i][j] = (nCr[i - 1][j] + nCr[i - 1][j - 1]) % MOD

init()
n, m, k = map(int, input().split())
print((nCr[n - 1][k] * m * pow(m - 1, k, MOD)) % MOD)

n, m, k = map(int, input().split())
mod = 998244353

same_bricks = n - 1 - k
total = m # First brick
# Different bricks
for i in range(k):
	total *= (m-1)
	total %= mod

# Choosing same bricks
# times (n-1 choose k)
val = 1
for i in range(n - k, n):
	val *= i

for i in range(1, k+1):
	val //= i

total *= val
total %= mod
print(total)

import math
f=math.factorial
n,m,k=map(int,input().split())
print(f(n-1)//f(k)//f(n-k-1)*m*(m-1)**k%998244353)

Z = 998244353

def ncr(n, r):
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % Z
        den = (den * (i + 1)) % Z

    return (num * pow(den, Z - 2, Z)) % Z

n, m, k = map(int, input().split())

print((ncr(n - 1, k) * m * pow(m - 1, k, Z)) % Z)

s=input().split()
n,m,k=list(map(int,s))
MOD=998244353
ans=m
for i in range(k):
    ans=(ans*(m-1))%MOD
if k>n//2:
    k=n-1-k
for i in range(1,k+1):
    ans=ans*(n-1-k+i)//i
print(ans%MOD)

import math
f = math.factorial
n,m,k = map(int,input().split())
aa=f(n-1)//f(k)//f(n-k-1)*(m)*(m-1)**k%998244353
print(aa)

n,m,k=map(int,input().split())
comb=1
power=1
fact=1
M=998244353
for i in range(k):
    comb=comb*(n-1-i)
    power*=(m-1)
    power=power%M
    fact*=(k-i)
print((((comb//fact)%M)*(m)*(power%M))%M)

# -*- coding: utf-8 -*-
import heapq, math, random, re, string, sys
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from decimal import Decimal, getcontext
from fractions import gcd, Fraction
from itertools import combinations, permutations, product
from math import ceil, exp, log, sqrt
from Queue import Queue, PriorityQueue

getcontext().prec = 100
sys.setrecursionlimit(100000)
MOD = 998244353
INF = float('+inf')

'''
if sys.subversion[0] == "PyPy":
    import io, atexit
    sys.stdout = io.BytesIO()
    atexit.register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))
    sys.stdin = io.BytesIO(sys.stdin.read())
    raw_input = lambda: sys.stdin.readline().rstrip()
'''

pr = lambda args: sys.stdout.write(' '.join(map(str, args)) + '\n')
epr = lambda args: sys.stderr.write(' '.join(map(str, args)) + '\n')
die = lambda args: pr(args) ^ exit(0)

#n = input()
#a = [input()for _ in xrange(n)]
n, m, k = map(int, raw_input().split())
#a = [map(int,raw_input().split())for _ in xrange(n)]
#s = raw_input()
#a = [raw_input() for _ in xrange(n)]

def nCk(n, k):
    if k < 0 or k > n:
        return 0
    if k == 0 or k == n:
        return 1
    total_ways = 1
    for i in range(min(k, n - k)):
        total_ways = total_ways * (n - i) // (i + 1)
    return total_ways

print (nCk(n - 1, k) * m * pow(m - 1, k, MOD)) % MOD

from sys import stdin

def fact(be, en):
    res = 1
    for i in range(be, en + 1):
        res = mult(res, i)
    return res

add = lambda a, b: (a + b) % mod
mult = lambda a, b: ((a % mod) * (b % mod)) % mod
div = lambda a, b: mult(a, inv(b))
inv = lambda a: pow(a, mod - 2, mod)
ncr = lambda n, r: div(fact(n - r + 1, n), fact(1, r))
rints = lambda: [int(x) for x in stdin.readline().split()]
mod = 998244353

n, m, k = rints()
ans = mult(m * pow(m - 1, k, mod), ncr(n - 1, k))
print(ans)

import sys
mod = 998244353
bricks, colors, left = map(int, input().split())
dp = [[0] * (left + 1) for i in range(bricks + 1)]
if left == 0:
    print(colors)
    sys.exit()
for i in range(1, bricks + 1):
    dp[i][0] = colors
for i in range(1, bricks + 1):
    for j in range(1, left + 1):
        dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - 1] * (colors - 1)) % mod
print(dp[bricks][left] % mod)

from math import factorial as f
n,m,k=map(int,input().split())
print(f(n-1)//f(k)//f(n-k-1)*m*(m-1)**k%998244353)

n,m,k = [int(x) for x in input().split()]
dp = [[0 for _ in range(k+1)] for _ in range(n)]
dp[0][0] = m
for n1 in range(1,n):
    dp[n1][0] = m
    #print(dp[n1][0])
for n1 in range(1,n):
    for k1 in range(1,k+1):
        dp[n1][k1] = (dp[n1-1][k1]+dp[n1-1][k1-1]*(m-1)) % 998244353
print(dp[n-1][k])

#for arr in dp:
#    print(arr)

"""
this is a standard python template for codeforces task, repo: github.com/solbiatialessandro/pyComPro/codeforces
"""
stdin = lambda type_ = "int", sep = " ": list(map(eval(type_), input().split(sep)))
joint = lambda sep = " ", *args: sep.join(str(i) if type(i) != list else sep.join(map(str, i)) for i in args)
def binomial(n, k):
    """
    A fast way to calculate binomial coefficients by Andrew Dalke.
    See http://stackoverflow.com/questions/3025162/statistics-combinations-in-python
    """
    if 0 <= k <= n:
        ntok = 1
        ktok = 1
        for t in range(1, min(k, n - k) + 1):
            ntok *= n
            ktok *= t
            n -= 1
        return ntok // ktok
    else:
        return 0
def solve(n, m, k):
    parts = m * pow(m - 1, k)
    return (binomial(n - 1, k) * parts) % 998244353

if __name__ == "__main__":
    """the solve(*args) structure is needed for testing purporses"""
    n, m, k = stdin()
    print(solve(n, m, k))

from math import factorial as f
mod = 998244353

n,m,k = map(int,input().split())

ans=1
for i in range(k):
    ans=(ans*(m-1))%mod

ans=(ans*m)%mod

val = f(n-1)//(f(k)*f(n-1-k))

ans=(ans*val)%mod

print(ans)

#	!/bin/env python3
#	coding: UTF-8

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology and Management,Gwalior

#	Question Link
#	https://codeforces.com/problemset/problem/1081/C
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 998244353

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def main():
    n, m, k = get_ints()
    dp = [[0 for _ in range(2005)] for _ in range(2005)]
    # dp[i][j] is the ways of coloring that there are j bricks of
    # different color from its adjacent left brick
    dp[1][0] = m
    for i in range(1, n):
        for j in range(k+1):
            # i+1'th brick has same color as that of i'th brick
            dp[i+1][j] = (dp[i+1][j]+dp[i][j]) % mod
            # m-1 ways of coloring this next block with a different color
            dp[i+1][j+1] = ((dp[i+1][j+1]+dp[i][j])*(m-1)) % mod
    print(dp[n][k])

if __name__ == "__main__":
    main()

import math

MOD = 998244353

n, m, k = [int(x) for x in input().split()]

ans = (math.factorial(n-1)//(math.factorial(k)*math.factorial(n-k-1)))*m*((m-1)**k)
print(ans%MOD)

n, m, k = map(int, input().split())
mod = 998244353
dp = [[0] * (k + 1) for i in range(n)]
dp[0][0] = m
for i in range(1, n):
    for j in range(k + 1):
        dp[i][j] = dp[i - 1][j]
        if j > 0:
            dp[i][j] += dp[i - 1][j - 1] * (m - 1)
        dp[i][j] %= mod
print(dp[n-1][k])

import math
import bisect
import itertools
import sys
I=lambda : sys.stdin.readline()
mod=998244353
fact=[1]*20001
ifact=[1]*20001
for i in range(1,1001):
    fact[i]=((fact[i-1])*i)%mod
    ifact[i]=((ifact[i-1])*pow(i,mod-2,mod))%mod
def ncr(n,r):
    return (((fact[n]*ifact[n-r])%mod)*ifact[r])%mod
def npr(n,r):
    return (((fact[n]*ifact[n-r])%mod))

def mindiff(a):
    b=a[:]
    b.sort()
    m=10000000000
    for i in range(len(b)-1):
        if b[i+1]-b[i]<m:
            m=b[i+1]-b[i]
    return m

def lcm(a,b):
    return a*b//math.gcd(a,b)

def merge(a,b):
    i=0;j=0
    c=0
    ans=[]
    while i<len(a) and j<len(b):
        if a[i]<b[j]:
            ans.append(a[i])
            i+=1
        else:
            ans.append(b[j])
            c+=len(a)-i
            j+=1
    ans+=a[i:]
    ans+=b[j:]
    return ans,c
def mergesort(a):
    if len(a)==1:
        return a,0
    mid=len(a)//2
    left,left_inversion=mergesort(a[:mid])
    right,right_inversion=mergesort(a[mid:])
    m,c=merge(left,right)
    c+=(left_inversion+right_inversion)
    return m,c

def is_prime(num):
    if num == 2: return True
    if num == 3: return True
    if num%2 == 0: return False
    if num%3 == 0: return False
    t = 5
    a = 2
    while t <= int(math.sqrt(num)):
        if num%t == 0: return False
        t += a
        a = 6 - a
    return True

def ceil(a,b):
    if a%b==0:
        return a//b
    else:
        return (a//b + 1)

def binsearch(arr,b,low,high):
    if low==high:
        return low
    if arr[math.ceil((low+high)/2)]<b:
        return binsearch(arr,b,low,math.ceil((low+high)/2) -1 )
    else:
        return binsearch(arr,b,math.ceil((low+high)/2),high)
def ncr1(n,r):
    s=1
    for i in range(min(n-r,r)):
        s*=(n-i)
        s%=mod
        s*=pow(i+1,mod-2,mod)
        s%=mod
    return s

def calc(n,m,r):
    s=0
    for i in range(0,r+1,2):
        s+=ncr1(n,i)*ncr1(m,i)
        s%=mod
    return s

#/////////////////////////////////////////////////////////////////////////////////////////////////
mod1=998244353
t=int()
n,m,k=map(int,input().split())
if (k>0 and m==1) or k>=n:
    print(0)
elif k==0:
    print(m)
else:
    k1=ncr1(n-1,k)
    k1*=pow(m-1,k,mod1)
    k1%=mod
    k1*=m
    print(k1%mod)

import sys
sys.setrecursionlimit(10000)

D = {(1,0):1,(1,1):0}
n,m,k = [int(x) for x in input().split()]

def f(n,k):
    if k == 0:
        return m
    if k >= n:
        return 0
    if (n,k) in D:
        return D[(n,k)]
    else:
        ans = (f(n-1,k)+(m-1)*f(n-1,k-1))%998244353
        D[(n,k)] = ans
        return ans

print(f(n,k))

import math
n, m, k = map(int, input().split())
f = math.factorial
print(f(n-1) // f(k) // f(n-k-1) * m * (m-1) ** k % 998244353)

from __future__ import division, print_function

import math
import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__

#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|
#  code

def main():
    from math import factorial as fac
    n,m,k = map(int , input().split())

    dp = [[0 for i in range(k + 1)] for i in range(n + 1)]

    dp[1][0] = m

    for i in range(2,n + 1):
        for j in range(k + 1):
            dp[i][j] = dp[i - 1][j]
            if j > 0:
                dp[i][j] += dp[i - 1][j - 1] * (m - 1)
            dp[i][j] %= 998244353
    print(dp[n][k] % 998244353)
    return
    #end main

# region fastio

BUFSIZE = 8192

class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()

class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()

def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Z = 998244353

def ncr(n, r):
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % Z
        den = (den * (i + 1)) % Z

    return (num * pow(den, Z - 2, Z)) % Z

n, m, k = map(int, input().split())

print((ncr(n - 1, k) * m * pow(m - 1, k, Z)) % Z)

from operator import mul
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(mul, range(n, n-r, -1), 1)
    denom = reduce(mul, range(1, r+1), 1)
    return numer // denom

def mult(a,b):
    return (a*b) % mod

n,m,k = map(int, input().split())
mod = 998244353
ans = 1
ans = mult(ans, (m-1)**k)
ans = mult(ans, m)
ans = mult(ans, ncr(n-1, k))

print(ans)

n, m, k = map(int, input().split())
dp = [[m if i == 0 else 0 for i in range(k + 2)] for j in range(n + 1)]
dp[0][0] = 0
mod = 998244353
for i in range(1, n + 1):
    for j in range(1, k + 2):
        dp[i][j] = (dp[i - 1][j] + (m - 1) * dp[i - 1][j - 1]) % mod

print(dp[n][k] % mod)

s=input().split()
n,m,k=list(map(int,s))
MOD=998244353
ans=m
for i in range(k):
    ans=(ans*(m-1))%MOD
if k>n//2:
    k=n-1-k
for i in range(1,k+1):
    ans=ans*(n-1-k+i)//i
print(ans%MOD)

#file = open("input.txt", "r")
data = input().split()
n = int(data[0])
m = int(data[1])
k = int(data[2])
K = 998244353

gt = [0 for i in range(2005)]
rev = [0 for i in range(2005)]

def mu(a, n):
	if (n == 0): return 1
	q = mu(a, n // 2)
	if (n % 2 == 0): return q * q % K
	return q * q % K * a % K

gt[0] = rev[0] = 1
for i in range(1, 2001):
	gt[i] = gt[i - 1] * i % K
	rev[i] = mu(gt[i], K - 2)

res = gt[n - 1] * rev[k] % K * rev[n - k - 1] % K

res = res * m % K
res = res * mu(m - 1, k) % K
print(res)

from math import factorial
n, m, k = map(int, input().split())
M = 998244353
fn = 1
fnk1 = 1
fk = 1
for i in range(1, n):
    fn *= i
    fn %= M
for i in range(1, n - k):
    fnk1 *= i
    fnk1 %= M
for i in range(1, k + 1):
    fk *= i
    fk %= M
print((fn * pow((fnk1 * fk), M - 2, M)) * m * pow(m - 1, k, M) % M)

dp=[[0 for j in range(2001)] for i in range(2001)]
n,m,k=map(int,raw_input().split())
for i in range(1,n+1):
    for j in range(k+1):
        if j==0 and i==1:
            dp[i][j]=m
            continue
        if j<=i-1:
            dp[i][j]=(m-1)*dp[i-1][j-1]+dp[i-1][j]
            dp[i][j]%=998244353
print(dp[n][k])

'''

                            Online Python Compiler.
                Code, Compile, Run and Debug python program online.
Write your code in this editor and press "Run" button to execute it.

'''

n, m, k = input().split()
n = int(n)
m = int(m)
k = int(k)
result = 1
k = k + 1

for i in range(k-1):
    result *= n-1-i
    result //= 1+i

result = result % 998244353
result *= m

for i in range(k-1):
    result *= m-1

result = result % 998244353

if result < 0:
    result += 998244353

print(result)

pri=998244353
n,m,k=map(int,input().split())
dp=[[0 for i in range(n+1)] for i in range(k+1)]
#i denote , number of different bricks , j denotes total size
for i in range(k+1):
    for j in range(n+1):
        if(j==0):
            dp[i][j]=0
            continue;

        if(i==0):
            dp[i][j]=m
            continue;

        if(i>j-1):
            dp[i][j]=0
            continue;
        dp[i][j]=dp[i-1][j-1]*(m-1)+dp[i][j-1]
        dp[i][j]%=pri

print(dp[-1][-1])

n, m, k = map(int, input().split())
mod = 998244353

same_bricks = n - 1 - k
total = m # First brick
# Different bricks
for i in range(k):
	total *= (m-1)
	total %= mod

# Choosing same bricks
# times (n-1 choose k)
val = 1
for i in range(n - k, n):
	val *= i

for i in range(1, k+1):
	val //= i

total *= val
total %= mod
print(total)

import sys
#setrecursionlimit(100)
sys.setrecursionlimit(1000000)
M = 998244353
def Qpow(x, y):
  if y == 0:
    return 1
  else :
    ret = Qpow(x, (int)(y / 2)) % M
    ret *= ret
    ret %= M
    if y % 2 == 1:
      ret *= x
      ret %= M;
    return ret

n, m, k = map(int, input().split())
#ans = Qpow(a, b)
#print(ans)
fact = [0 for i in range(0, 5005)]
fact[0] = 1
for i in range(1, 5002 + 1):
  fact[i] = (fact[i - 1] * i) % M
#for i in range(1, 10):
#  print((fact[i]))
way = (fact[k] * fact[n - 1 - k]) % M;
way =  (fact[n - 1] * Qpow(way, M - 2) % M) % M
ans = (way * (Qpow(m - 1, k) % M + M) * m) % M
if ans < 0:
  ans += M
  ans %= M
print(ans)

import math
f=math.factorial
n,m,k=map(int,raw_input().split())
print f(n-1)/f(k)/f(n-k-1)*m*(m-1)**k%998244353

#import resource
import sys
#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])
import threading
threading.stack_size(2**25)
sys.setrecursionlimit(10**6)
mod=998244353
fact=[1]
for i in range(1,3001):
    fact.append((fact[-1]*i)%mod)
ifact=[0]*3001
ifact[3000]=pow(fact[3000],mod-2,mod)
for i in range(3000,0,-1):
    ifact[i-1]=(i*ifact[i])%mod
from sys import stdin, stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import math
import heapq
#from random import randint as rn
from Queue import Queue as Q
def modinv(n,p):
    return pow(n,p-2,p)
def ncr(n,r,p):
    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p
    return t
def ain():
    return map(int,sin().split())
def sin():
    return stdin.readline().strip()
def GCD(x, y):
   while(y):
       x, y = y, x % y
   return x
def isprime(x):
    p=int(math.sqrt(x))+1
    if(x==1):
        return 0
    for i in range(2,p):
        if(x%p==0):
            return 0
    return 1
"""**************************************************************************"""
n,m,k=map(int,raw_input().split())
p=ncr(n-1,k,mod)
q=m
for i in range(k):
    q=(q*(m-1))%mod
p=(p*q)%mod
print p

n , m , k = map(int,input().split(' '))
# dp[i][j] <- no of ways of painting first i bricks such that j bricks are different from their left
MOD = 998244353
dp = [[0]*(k+1) for _ in range(n)]
dp[0][0] = m    #base case
for i in range(1,n) :
    for j in range(min(i+1,k+1)) :
        dp[i][j] = ( (0 if j==0 else (dp[i-1][j-1]*(m-1))%MOD) + dp[i-1][j])%MOD
# print(dp)
print(dp[-1][-1])

import sys, math
from sys import stdin, stdout
rem = 998244353

inf=10**18
#sys.setrecursionlimit(10 ** 6 + 7)
#from resource import *; setrlimit(RLIMIT_STACK, (RLIM_INFINITY, RLIM_INFINITY))
take = lambda: map(int, stdin.readline().split())
from heapq import heappush, heappop, heapify
from collections import deque
from bisect import *

n,m,k=take()

dp=[[0 for i in range(m+1)] for j in range(n+1)]
arr=[[0 for i in range(n+1)] for j in range(n+1)]

for i in range(1,m+1):
    dp[1][i]=1
tot=[0 for i in range(n+1)]
tot[1]=m
for i in range(2,n+1):
    for j in range(1,m+1):
        dp[i][j]=(tot[i-1]-dp[i-1][j])%rem
        tot[i]+=dp[i][j]
        tot[i]%=rem

#print arr
for i in range(n+1):
    arr[i][0]=1
for i in range(1,n+1):
    for j in range(1,i+1):
        arr[i][j]=arr[i-1][j]+arr[i-1][j-1]
        arr[i][j]%=rem
#print arr[n-1][k]
print (arr[n-1][k]*tot[k+1])%rem

def fact(n):
    if n==0:
        return 1
    else:
        return fact(n-1)*n
def C(n, k):
    return fact(n)//(fact(n-k)*fact(k))
n, m, k=map(int, input().split())
print(m*((m-1)**k)*C(n-1, k)%998244353)

import math
f=math.factorial
n,m,k=map(int,input().split())
mod = 998244353
ret=f(n-1)//(f(k)*f(n-1-k))*m*((m-1)**k)%mod
print(ret)

MOD = 998244353

n, nColors, nDiff = map(int, input().split())

dp = [[0 for _ in range(nDiff + 1)] for _ in range(n)]
dp[0][0] = nColors
for size in range(1, n):
    for cnt in range(nDiff + 1):
        dp[size][cnt] += dp[size - 1][cnt]
        dp[size][cnt] %= MOD
        if cnt - 1 >= 0:
            dp[size][cnt] += (dp[size - 1][cnt - 1] * (nColors - 1)) % MOD
            dp[size][cnt] %= MOD
print(dp[n - 1][nDiff])

#	!/bin/env python3
#	coding: UTF-8

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology and Management,Gwalior

#	Question Link
#	https://codeforces.com/problemset/problem/1081/C
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 998244353

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def main():
    n, m, k = get_ints()
    # dp[i][j] is the ways of coloring that there are j bricks of
    # different color from its adjacent left brick
    dp[1][0] = m
    for i in range(1, n):
        for j in range(k+1):
            # i+1'th brick has same color as that of i'th brick
            dp[i+1][j] = (dp[i+1][j]+dp[i][j]) % mod
            # m-1 ways of coloring this next block with a different color
            dp[i+1][j+1] = ((dp[i+1][j+1]+dp[i][j])*(m-1)) % mod
    print(dp[n][k])

if __name__ == "__main__":
    dp = [[0 for _ in range(2005)] for _ in range(2005)]
    main()

import math
def binom(n, k):
    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)
m = list(map(int, input().split()))
n = m[0]
c = m[1]
k = m[2]
print(int(binom(n-1,k)*c*((c-1)**k)%(998244353)))

import math
n, m, k = map(int, input().split())
mod = 998244353
f = math.factorial(n-1)//(math.factorial(k)*math.factorial(n-k-1))
f*=m
f*=(m-1)**k
f%=mod
print(int(f))

import math
n, m, k = map(int, input().split())
f = math.factorial
print(f(n-1) // f(k) // f(n-k-1) * m * (m-1) ** k % 998244353)

from math import factorial as f
n, m, k = [int(x) for x in input().split()]
if k == 0: print(m)
else:
    a = f(n - 1)
    b = f(k)
    c = f(n - 1 - k)
    d = b * c
    e = a // d
    t = e * m * ((m - 1) ** k)
    print(t % 998244353)

import sys,bisect
from math import floor,ceil
input = sys.stdin.readline
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

mod = 998244353
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

n,m,k = invr()
result = (m * pow(m - 1,k,mod))%mod

print((result * ncr(n - 1, k))%mod)

mod=998244353
def _mp():
	return map(int,raw_input().split())
n,m,k=_mp()
orig=n

#print -1

def modinverse(n):
	return pow(n,mod-2,mod)
def _pncr(n,r):
	c=[0]*(r+1)
	res=1
	c[0]=1
	#k=min(k,n-k)
	for i in range(1,n+1):
		for j in range(min(i,r),0,-1):
			c[j]=(c[j]+c[j-1])%mod
	return c[r]

ans=m
for i in range(k):
	ans=(ans*(m-1))%mod

ans=ans*_pncr(orig-1,k)
print ans%mod

n, m, k = map(int, input().split())
t = 1
n -= 1
for i in range(n - k + 1, n + 1):
	t *= i
for j in range(1, k + 1):
	t //= j
for i in range(k):
	t *= (m - 1)
	t %= 998244353
print(m * t % 998244353)

'''input
3 2 1
6 3 2
5 3 0
3 3 1
3 3 0
'''
n, m, k = map(int, input().split())
MOD  = 998244353
ans = m * pow(m - 1, k, MOD) % MOD
'''
for i in range(k + 1):
	if i & 1:
		ans -= m * pow(m - 1, k - i, MOD)
	else:
		ans += m * pow(m - 1, k - i, MOD)
'''

for i in range(n - k, n):
	ans = ans * i
for i in range(n - k, n):
	# print(n - 1 - i)
	ans = ans // (n - i)
'''
for i in range(1, k + 1):
	print(ans)
	ans = ans * (n - 1 - i) * pow(i, MOD - 2, MOD) % MOD
'''
print(ans % MOD)

from math import factorial as f

n, m, k = map(int, raw_input().split())

print (f(n - 1) / f(k) / f(n - 1 - k) * m * (m - 1) ** k) % 998244353

n,m,k = map(int, input().split())
dp = [[0 for _ in range(k+1)] for _ in range(n)]
for i in range(n):
    dp[i][0] = m
for i in range(1,n):
    for j in range(1,k+1):
        dp[i][j] = (m-1)*dp[i-1][j-1] + dp[i-1][j]
        dp[i][j] %= 998244353
#print(dp)
print(dp[n-1][k])

n, m, k=map(int,input().split())

if k==0:
	print(m)

elif m==1:
	print(0)

else:
	total1=m*pow(m-1,k)%998244353
	total2=1
	for i in range(1,k+1):
		total2=total2*(n-i)
	for i in range(1,k+1):
		total2=total2//i

	t=total1*total2%998244353

	print(t)

import math
mod = 998244353
n, m, k = input().split()
n = int(n)
m = int(m)
k = int(k)
print((math.comb(n-1, k) * (m * (m-1) ** k)) % mod)

dp=[[0 for j in range(2001)] for i in range(2001)]
n,m,k=map(int,raw_input().split())
for i in range(1,n+1):
    for j in range(k+1):
        if j==0 and i==1:
            dp[i][j]=m
            continue
        if j<=i-1:
            dp[i][j]=(m-1)*dp[i-1][j-1]+dp[i-1][j]
            dp[i][j]%=998244353
print(dp[n][k])

def fact(n):
	ans = 1
	for i in range(n, 0, -1):
		ans *= i
	return ans

def c_n_k(n, k):
	return (fact(n) // (fact(k) * fact(n - k)))

n, m, k = map(int, input().split())
print(c_n_k(n - 1, k) * ((m - 1) ** k) * m % 998244353)

#Code by Sounak, IIESTS
#------------------------------warmup----------------------------

import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#-------------------game starts now-----------------------------------------------------
from math import factorial as f
n,m,k=map(int,input().split())
print(f(n-1)//(f(k)*f(n-k-1))*m*(m-1)**k%998244353)

import math

MOD = 998244353

n, m, k = [int(x) for x in input().split()]

ans = (math.factorial(n-1)//(math.factorial(k)*math.factorial(n-k-1)))*m*((m-1)**k)
print(ans%MOD)

import math
n, m, k = map(int, input().split())
ans = math.factorial(n - 1)
ans //= math.factorial(k)
ans //= math.factorial(n - 1- k)
ans *= (m - 1) ** k
ans *= m
ans %= 998244353
if k == 0 :
    ans = m
print(ans)

# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

mod = 998244353
fac = [1]
for i in range(1,2001):
    fac.append((fac[-1]*i)%mod)
fac_in = [pow(fac[-1],mod-2,mod)]
for i in range(2000,0,-1):
    fac_in.append((fac_in[-1]*i)%mod)
fac_in.reverse()

def comb(a,b):
    return (fac[a]*fac_in[b]*fac_in[a-b])%mod

def main():
    n,m,k = map(int,input().split())
    print((m*pow(m-1,k,mod)*comb(n-1,k))%mod)

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

import os
import sys
from io import BytesIO, IOBase
# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------------------

from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush

def RL(): return map(int, sys.stdin.readline().rstrip().split())
def RLL(): return list(map(int, sys.stdin.readline().rstrip().split()))
def N(): return int(input())
def comb(n, m): return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0
def perm(n, m): return factorial(n) // (factorial(n - m)) if n >= m else 0
def mdis(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

# ------------------------------

def main():
    n, m, k = RL()
    dp = [[0]*(k+2) for _ in range(n+1)]

    for i in range(1, n+1):
        dp[i][0] = m

    for i in range(1, n+1):
        for j in range(1, k+1):
            if j>i-1: break
            dp[i][j] = (dp[i][j] + dp[i-1][j])%mod
            dp[i][j] = (dp[i][j] + dp[i-1][j-1]*(m-1))%mod
    # for i in dp: print(i)
    print(dp[n][k]%mod)

if __name__ == "__main__":
    main()

import math
n, m, k = map(int, input().split())
f = math.factorial
print(f(n-1) // f(k) // f(n-k-1) * m * (m-1) ** k % 998244353)

import math
def binom(n, k):
    return math.factorial(n) // math.factorial(k) // math.factorial(n - k)
m = list(map(int, input().split()))
n = m[0]
c = m[1]
k = m[2]
print(int(binom(n-1,k)*c*((c-1)**k)%(998244353)))

from math import factorial as f;
n , m , k = map(int,input().split());
ans = (f(n-1)//(f(n-k-1)*f(k)))*m*((m-1)**k)
print(int(ans%998244353));

n, m, k = [int(x) for x in input().split()]
mod = 998244353

def com(n, r, p = 998244353):
    C = [0 for i in range(r+1)]
    C[0] = 1
    for i in range(1, n+1):
        for j in range(min(i, r), 0, -1):
            C[j] = (C[j] + C[j-1]) % p
    return C[r]

ans = ((com(n - 1, k) * m * pow(m - 1, k, mod)) )% mod
print(ans)

import math
n, m, k = map(int, input().split())
mod = 998244353
if k == 0:
	print(m)
else:
	f = math.factorial(n-1)/math.factorial(k)*math.factorial(n-k-1)
	f%=mod
	f*=m*(m-1)
	f%=mod
	f*=k
	f%=mod
	print(int(f))

def fact(n):
    dp = [0 for i in range(n)]
    dp[0] = 1
    mod = 998244353
    for i in range(1,n):
        dp[i] = i* dp[i-1]%mod
    return dp

n,m,k = map(int,input().split())
mod = 998244353
dp = fact(n+5)
y  = (dp[n-1]/(dp[n-1-k] * dp[k])%mod)%mod
z = (m * ((m-1)**k))%mod
print(int((y*z)%mod))

from decimal import Decimal

def modFact(n, p):
    if n >= p:
        return 0

    result = 1
    for i in range(1, n + 1):
        result = (result * i) % p

    return result

n, m, k = input().split()
n = int(n)
m = int(m)
k = int(k)

p = 998244353

c = Decimal(modFact(n - 1, p))
z = Decimal(modFact(k, p))
d = Decimal(modFact(n - 1 - k, p))
l = Decimal(c / (z * d))
answer = int(Decimal(l * m * (m - 1)**k))%p
print(answer)

n, m, k = map(int, input().split())
ans = 1
for i in range(k):
	ans *= (n - 1 - i)
	ans /= (i + 1)
print((ans * m * (m - 1) ** k) % 998244353)

def modFact(n, p):
    if n >= p:
        return 0

    result = 1
    for i in range(1, n + 1):
        result = (result * i) % p

    return result

n, m, k = input().split()
n = int(n)
m = int(m)
k = int(k)

p = 998244353

c = modFact(n - 1, p)
z = modFact(k, p)
d = modFact(n - 1 - k, p)
l = c / (z * d)

print(int(l * m * (m - 1)**k))

'''input
3 2 1
'''
n, m, k = map(int, input().split())
MOD  = 998244353
ans = 0
for i in range(k):
	if i & 1:
		ans -= m * pow(m - 1, k - i, MOD)
	else:
		ans += m * pow(m - 1, k - i, MOD)
for i in range(n - k, n):
	ans = ans * i % MOD
print(ans)

n, m, k = map(int, input().split())
ans = 1
for i in range(1, k + 1):
    ans *= n - i
for i in range(k, 0, -1):
    ans //= i
ans = ans * m % 998244353
for i in range(k - 1):
    ans = ans * (m - 1) % 998244353
print(ans)

from sys import setrecursionlimit
setrecursionlimit(2100)
n, m, k = map(int, input().split())

def kirp(n, m, k, fi=n):
    fi -= 1
    if k == 0:
        return m
    if m == 1:
        return 0
    else:
        x = kirp(n-1, m, k-1, fi)*(m-1)
        if fi - 1 < k:
            return x
        elif m == 2:
            return (n-k-1)*x*(m-1) + x
        else:
            return (n - k - 1) * x * (m - 2) + x

print(kirp(n, m, k) % 998244353)

import math
n, m, k = map(int, input().split())
mod = 998244353
if m == 1:
	print(1)
elif k == 0:
	print(m)
else:
	f = math.factorial(n-1)/math.factorial(k)*math.factorial(n-k-1)
	f%=mod
	f*=m*(m-1)**k
	f%=mod
	print(int(f))

from sys import setrecursionlimit
setrecursionlimit(2100)
n, m, k = map(int, input().split())

def kirp(n, m, k, fi=n):
    if k == 0 and m != 1:
        return m
    if m == 1:
        return 0
    else:
        fi -= 1
        x = kirp(n-1, m, k-1, fi)*(m-1)
        if fi - 1 < k:
            return x
        else:
            return m + x

print(kirp(n, m, k) % 998244353)

n, m, k = map(int, input().split())
print(m ** (k + 1))

from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10**6+10
MOD = 998244353
def isprime(n):
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2:
        return True
    if not n & 1:
        return False
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False
    return True

def mhd(a,b,x,y):
    return abs(a-x)+abs(b-y)

def numIN():
    return(map(int,sys.stdin.readline().strip().split()))

def charIN():
    return(sys.stdin.readline().strip().split())

t = [(-1,-1)]*1000010

def create(a):
	global t,n
	for i in range(n,2*n):
		t[i] = (a[i-n],i-n)
	for i in range(n-1,0,-1):
		x = [t[2*i],t[2*i+1]]
		x.sort(key = lambda x:x[0])
		t[i] = x[1]

def update(idx,value):
	global t,n
	idx = idx+n
	t[idx] = value

	while(idx>1):
		idx = idx//2
		x = [t[2*idx],t[2*idx+1]]
		x.sort(key = lambda x:x[0])
		t[idx] = x[1]

def dis(a,b,k):
	ans = 0
	for i in range(k):
		ans+=abs(a[i]-b[i])
	return ans

def cal(n,k):
	res = 1
	for i in range(n,n-k,-1):
		res = (res*i)%MOD
	return res

n,m,k = numIN()
x = cal(n-1,k)
print((x*m*pow(m-1,k,MOD))%MOD)

pri=10**9+7
n,m,k=map(int,input().split())
dp=[[0 for i in range(n+1)] for i in range(k+1)]
#i denote , number of different bricks , j denotes total size
for i in range(k+1):
    for j in range(n+1):
        if(j==0):
            dp[i][j]=0
            continue;

        if(i==0):
            dp[i][j]=m
            continue;

        if(i>j-1):
            dp[i][j]=0
            continue;
        dp[i][j]=dp[i-1][j-1]*(m-1)+dp[i][j-1]
        dp[i][j]%=pri
print(dp[-1][-1])

n,m,k = [int(x) for x in input().split()]
dp = [[0 for _ in range(k+1)] for _ in range(n)]
dp[0][0] = m
for n1 in range(1,n):
    dp[n1][0] = m
    #print(dp[n1][0])
for n1 in range(1,n):
    for k1 in range(1,k+1):
        dp[n1][k1] = dp[n1-1][k1]*(m-1)+dp[n1-1][k1-1]
print(dp[n-1][k])

#for arr in dp:
#    print(arr)

import sys
from math import ceil, floor
import operator as op
from functools import reduce

input = sys.stdin.readline

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

n, m, k = map(int, input().split())

print(int(ncr(n-1, k)*m % 998244353) % 998244353)

from decimal import Decimal
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

z, m, k = input().split()
z = int(z)
m = int(m)
k = int(k)

p = 998244353

l = Decimal(ncr(z-1, k))
pow = (m - 1)**k
answer = int(Decimal(l * m * pow))%p
print(answer)

from decimal import Decimal
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

n, m, k = input().split()
n = int(n)
m = int(m)
k = int(k)

p = 998244353

l = Decimal(ncr(n-1, k))%p
pow = (m - 1)**k%p
answer = int(Decimal(l * m * pow))%p
print(answer)

n, m, k = map(int, input().split())
dp = [[0] * (n + 1) for i in range(n)]
MOD = 998244353
dp[0][0] = m

for i in range(n):
    for j in range(k + 1):
        dp[i][j + 1] += dp[i - 1][j] * (m - 1)
        dp[i][j] += dp[i - 1][j]
        dp[i][j + 1] %= MOD
        dp[i][j] %= MOD

print(dp[n - 1][k])

from math import factorial

[n, m, k] = [int(i) for i in input().split()]
mod = 998244353

l = m*((m-1)**k)
if k>=n/2-1:
    L = factorial(k+1)//factorial(n-k-1)//factorial(k+1 - (n-k-1))
else:
    L=1

print(l*L%mod)

s=input().split()
n,m,k=list(map(int,s))
MOD=998244353
ans=m
for i in range(k):
    ans=(ans*(m-1))%MOD
if k>n//2:
    k=n-k
for i in range(1,k+1):
    ans=ans*(n-1-k+i)//i
print(ans%MOD)

# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

mod = 10**9+7
fac = [1]
for i in range(1,2001):
    fac.append((fac[-1]*i)%mod)
fac_in = [pow(fac[-1],mod-2,mod)]
for i in range(2000,0,-1):
    fac_in.append((fac_in[-1]*i)%mod)
fac_in.reverse()

def comb(a,b):
    return (fac[a]*fac_in[b]*fac_in[a-b])%mod

def main():
    n,m,k = map(int,input().split())
    print((m*pow(m-1,k,mod)*comb(n-1,k))%mod)

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

n,m,k = map(int, input().split())
dp = [[0 for _ in range(k+1)] for _ in range(n)]
for i in range(n):
    dp[i][0] = m
for i in range(1,n):
    for j in range(1,k+1):
        dp[i][j] = (m-1)*dp[i-1][j-1] + dp[i-1][j]
print(dp)
print(dp[n-1][k])

n, m, k = map(int, input().strip().split())

dp = [0 for i in range(k+1)]
dp[0] = m
for i in range(1, n):
    # print(dp)
    for j in range(1, k+1):
        dp[j] += dp[j-1]*(m-1)
print(dp[-1])
# print(dp)

import sys
from math import ceil, floor
import operator as op
from functools import reduce

input = sys.stdin.readline

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

n, m, k = map(int, input().split())

print(int(ncr(n-1, k)*m % 998244353))

'''input
3 3 0
3 2 1
'''
n, m, k = map(int, input().split())
MOD  = 998244353
ans = m * pow(m - 1, k, MOD) % MOD
'''
for i in range(k + 1):
	if i & 1:
		ans -= m * pow(m - 1, k - i, MOD)
	else:
		ans += m * pow(m - 1, k - i, MOD)
'''
for i in range(n - k, n):
	ans = ans * i % MOD
print(ans)

import math
n, m, k = map(int, input().split())
mod = 998244353
if k == 0:
	print(m)
else:
	f = math.factorial(n-1)/math.factorial(k)*math.factorial(n-k-1)
	f%=mod
	f*=m*(m-1)
	f%=mod
	f/=math.factorial(k-1)
	f%=mod
	print(int(f))

n, m, k=map(int,input().split())

if k==0:
	print(m)

elif m==1:
	print(0)

else:
	total1=pow(m,k)%998244353
	total2=1
	for i in range(1,k+1):
		total2=total2*(n-i)
	for i in range(1,k+1):
		total2=total2//i

	t=total1*total2%9998244353

	print(t)

n, m, k = map(int, input().split())
ans = 1
for i in range(k):
	ans *= (n - 1 - i)
	ans /= (i + 1)
print((ans * m * (m - 1) ** k) % 998244353)

import sys
from math import ceil, floor
import operator as op
from functools import reduce

input = sys.stdin.readline

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

n, m, k = map(int, input().split())

print(int(ncr(n-1, k) % 998244353 * m * ncr(m, k+1) % 998244353) % 998244353)

n, m, k = map(int, input().split())
if k != 0:
    print(m * ((m - 1) * k * (n - k)))
else:
    print(m)

from math import factorial
n, m, k = map(int, input().split())
print(max(m*((k+2)//2), 1)*max((m-1)*((k+1)//2), 1)*(factorial(n-1)//(factorial(k)*factorial(n-k-1))) % 998244353)

L = []
def C(n, m):
    return L[n] / (L[n-m] * L[m])
while True:
    for i in range(2001):
        if i == 0:
            L.append(1)
        else:
            L.append(L[i-1]*i)
    try:
        n, m, k = map(int, raw_input().strip().split())
        if k == 0:
            print(n)
        else:
            ans = m * C(n-1, k) * pow(m-1, k)
            print(ans % 998244353)
    except EOFError:
        break;

from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10**6+10
MOD = 998244353
def isprime(n):
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2:
        return True
    if not n & 1:
        return False
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False
    return True

def mhd(a,b,x,y):
    return abs(a-x)+abs(b-y)

def numIN():
    return(map(int,sys.stdin.readline().strip().split()))

def charIN():
    return(sys.stdin.readline().strip().split())

t = [(-1,-1)]*1000010

def create(a):
	global t,n
	for i in range(n,2*n):
		t[i] = (a[i-n],i-n)
	for i in range(n-1,0,-1):
		x = [t[2*i],t[2*i+1]]
		x.sort(key = lambda x:x[0])
		t[i] = x[1]

def update(idx,value):
	global t,n
	idx = idx+n
	t[idx] = value

	while(idx>1):
		idx = idx//2
		x = [t[2*idx],t[2*idx+1]]
		x.sort(key = lambda x:x[0])
		t[idx] = x[1]

def dis(a,b,k):
	ans = 0
	for i in range(k):
		ans+=abs(a[i]-b[i])
	return ans

def cal(n,k):
	res = 1
	for i in range(n,n-k,-1):
		res = (res*i)%MOD
	return res

n,m,k = numIN()
x = cal(n-1,k)
y = m
for i in range(k):
    y = (y*(m-1))%MOD
print((x*y)%MOD)

# Python3 function to
# calculate nCr % p
def ncr(n, r, p):
    # initialize numerator
    # and denominator
    num = den = 1
    for i in range(r):
        num = (num * (n - i)) % p
        den = (den * (i + 1)) % p
    return (num * pow(den,
            p - 2, p)) % p

# p must be a prime
# greater than n

def fact(x , p):
    if x == 0:
        return 1
    return (x * fact(x - 1 , p)) % p

p = 998244353
n , m , k = map(int,input().split())
ans = (((ncr(n - 1 , k , p) * ncr(m , k + 1 , p)) % p) * fact(k + 1 , p)) % p
print(ans)

while True:
    try:
        n, m, k = map(int, raw_input().strip().split())
        if k == 0:
            print(n)
        else:
            print(pow(m, n - 1) * (m-1))
    except EOFError:
        break;

from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10**6+10
MOD = 998244353
def isprime(n):
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2:
        return True
    if not n & 1:
        return False
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False
    return True

def mhd(a,b,x,y):
    return abs(a-x)+abs(b-y)

def numIN():
    return(map(int,sys.stdin.readline().strip().split()))

def charIN():
    return(sys.stdin.readline().strip().split())

t = [(-1,-1)]*1000010

def create(a):
	global t,n
	for i in range(n,2*n):
		t[i] = (a[i-n],i-n)
	for i in range(n-1,0,-1):
		x = [t[2*i],t[2*i+1]]
		x.sort(key = lambda x:x[0])
		t[i] = x[1]

def update(idx,value):
	global t,n
	idx = idx+n
	t[idx] = value

	while(idx>1):
		idx = idx//2
		x = [t[2*idx],t[2*idx+1]]
		x.sort(key = lambda x:x[0])
		t[idx] = x[1]

def dis(a,b,k):
	ans = 0
	for i in range(k):
		ans+=abs(a[i]-b[i])
	return ans

def cal(n,k):
	res = 1
	for i in range(n,n-k,-1):
		res = (res*i)%MOD
	return res

n,m,k = numIN()
x = cal(n-1,k)
for i in range(k):
    m = (m*(m-1))%MOD
print((x*m)%MOD)

from math import factorial,pow
n, m, k = map(int, input().split())
mod = 998244353
c = factorial(n - 1) // (factorial(k) * factorial(n - 1 - k))
ans = c * (m) * pow(m - 1, k)
print(int(ans % mod))

n, m, k = map(int, input().split())
mod =  998244353
ans = m
for i in range(k):
	ans *= (n - k)
	ans %= mod
print(ans)

n,m,k=map(int,input().split())
x=998244353
h=1
for i in range(k+1,n+1):
    h=h*i
for i in range(1,n-k+1):
    h=h/i
h=h % x
z=m

for i in range(1,k):
    z=z*(m-1)

z=(z*h) % x

print (z)

n, m, k = map(int, input().strip().split())

dp = [0 for i in range(k+1)]
dp[0] = m
for i in range(1, n):
    # print(dp)
    new_dp = list(dp)
    for j in range(1, k+1):
        new_dp[j] += dp[j-1]*(m-1)
    dp = new_dp
print(dp[-1])
# print(dp)

n,m,k=map(int,input().split())
if m<k+1:print(0);exit()
M=998244353
r=((k+1)*m)%M
for i in range(k):
    r=(r*(m-1))%M
print(r)

import math
n, m, k = map(int, input().split())
mod = 998244353
if k == 0:
	print(m)
else:
	f = math.factorial(n-1)/math.factorial(k)*math.factorial(n-k-1)
	f%=mod
	f*=m*(m-1)**k
	f%=mod
	print(int(f))

import math
n, m, k = map(int, input().split())
mod = 998244353
if k == 0:
	print(m)
else:
	f = math.factorial(n-1)/math.factorial(k)*math.factorial(n-k-1)
	f%=mod
	f*=m*(m-1)
	f%=mod
	f*=k
	f%=mod
	print(int(f))

from math import factorial as f
n,m,k=map(int,input().split())
if m<=k:print(0)
elif k==0:print(m)
else:print((f(n-1)//(f(k)*f(n-k-1)))*(f(m)//(f(k)*f(m-k)))%998244353)

H=list(map(int,input().split()))
n=H[0]
m=H[1]
k=H[2]
a=1
b=1
c=1
for i in range (1,n):
    a=a*i
for i in range (1,n-k):
    b=b*i
for i in range (1,k+1):
    c=c*i

q=a//(b*c)
ans=q*m*(m-1)**(k)
print(ans%988244353)

import sys
from math import ceil, floor
import operator as op
from functools import reduce

input = sys.stdin.readline

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

n, m, k = map(int, input().split())
colorings = m
for i in range(k):
    colorings *= (m-1)
    colorings %= 998244353

print(int(ncr(n-1, k) % 998244353 * colorings % 998244353) % 998244353)

from math import factorial as f
mod = 998244353

n,m,k = map(int,input().split())

ans=1
for i in range(1,k+1):
    ans=(ans*i)%mod

ans=(ans*m)%mod

val = f(n-1)//(f(k)*f(n-1-k))

ans=(ans*val)%mod

print(ans)

import math
import bisect
import itertools
import sys
I=lambda : sys.stdin.readline()
mod=998244353
fact=[1]*1001
ifact=[1]*1001
for i in range(1,1001):
    fact[i]=((fact[i-1])*i)%mod
    ifact[i]=((ifact[i-1])*pow(i,mod-2,mod))%mod
def ncr(n,r):
    return (((fact[n]*ifact[n-r])%mod)*ifact[r])%mod
def npr(n,r):
    return (((fact[n]*ifact[n-r])%mod))

def mindiff(a):
    b=a[:]
    b.sort()
    m=10000000000
    for i in range(len(b)-1):
        if b[i+1]-b[i]<m:
            m=b[i+1]-b[i]
    return m

def lcm(a,b):
    return a*b//math.gcd(a,b)

def merge(a,b):
    i=0;j=0
    c=0
    ans=[]
    while i<len(a) and j<len(b):
        if a[i]<b[j]:
            ans.append(a[i])
            i+=1
        else:
            ans.append(b[j])
            c+=len(a)-i
            j+=1
    ans+=a[i:]
    ans+=b[j:]
    return ans,c
def mergesort(a):
    if len(a)==1:
        return a,0
    mid=len(a)//2
    left,left_inversion=mergesort(a[:mid])
    right,right_inversion=mergesort(a[mid:])
    m,c=merge(left,right)
    c+=(left_inversion+right_inversion)
    return m,c

def is_prime(num):
    if num == 2: return True
    if num == 3: return True
    if num%2 == 0: return False
    if num%3 == 0: return False
    t = 5
    a = 2
    while t <= int(math.sqrt(num)):
        if num%t == 0: return False
        t += a
        a = 6 - a
    return True

def ceil(a,b):
    if a%b==0:
        return a//b
    else:
        return (a//b + 1)

def binsearch(arr,b,low,high):
    if low==high:
        return low
    if arr[math.ceil((low+high)/2)]<b:
        return binsearch(arr,b,low,math.ceil((low+high)/2) -1 )
    else:
        return binsearch(arr,b,math.ceil((low+high)/2),high)
def ncr1(n,r):
    s=1
    for i in range(min(n-r,r)):
        s*=(n-i)
        s%=mod
        s*=pow(i+1,mod-2,mod)
        s%=mod
    return s

def calc(n,m,r):
    s=0
    for i in range(0,r+1,2):
        s+=ncr1(n,i)*ncr1(m,i)
        s%=mod
    return s

#/////////////////////////////////////////////////////////////////////////////////////////////////
mod1=998244353
n,m,k=map(int,input().split())
if (k>0 and m==1) or k>=n:
    print(0)
elif k==0:
    print(m)
else:
    k1=ncr(n-1,k)
    k1*=pow(m-1,k-1,mod1)
    k1*=m
    k1%=mod
    print(k1%mod)

n,m,k = map(int, input().split())
dp = [[0 for _ in range(k+1)] for _ in range(n)]
for i in range(n):
    dp[i][0] = m
for i in range(1,n):
    for j in range(1,k+1):
        dp[i][j] = (m-1)*dp[i-1][j-1] + dp[i-1][j]
        dp[i][j] %= 998244354
#print(dp)
print(dp[n-1][k])

n,m,k = [int(x) for x in input().split()]
dp = [[0 for _ in range(k+1)] for _ in range(n)]
dp[0][0] = m
for n1 in range(1,n):
    dp[n1][0] = dp[n1-1][0]*(m-1)
    #print(dp[n1][0])
for n1 in range(1,n):
    for k1 in range(1,k+1):
        dp[n1][k1] = dp[n1-1][k1]*(m-1)+dp[n1-1][k1-1]
print(dp[n-1][k])

#for arr in dp:
#    print(arr)

n,m,k = list(map(int,input().split()))
import math
a = math.factorial(n-1)//(math.factorial(k)*math.factorial(n-1-k))
print(a*m*((m-1)**k))

'''input
3 3 0
3 2 1
'''
n, m, k = map(int, input().split())
MOD  = 998244353
ans = m * pow(m - 1, k, MOD)
for i in range(n - k, n):
	ans = ans * i % MOD
print(ans)

import math
n,m,k=map(int,input().split())
M=998244353
r=m
for i in range(k):
    r=(r*(m-1))%M
r=(r%M)*(int((math.factorial(n-1)/(math.factorial(n-1-k)*math.factorial(k))))%M)
print(r%M)

s=input().split()
n,m,k=list(map(int,s))
MOD=998244353
ans=m
for i in range(k-1):
    ans=(ans*(m-1))%MOD
if k>n//2:
    k=n-k
for i in range(1,k+1):
    ans=ans*(n-1-k+i)//i
print(ans%MOD)

N = 2003
MOD = 998244353
nCr = [[] for _ in range(N)]

def init():
    for i in range(N):
        nCr[i] = [0 for _ in range(N)]
    for i in range(N):
        nCr[i][0] = 1
    for i in range(1, N):
        for j in range(1, N):
            nCr[i][j] = (nCr[i - 1][j] + nCr[i - 1][j - 1]) % MOD

init()
n, m, k = map(int, input().split())
print((nCr[n - 1][k] * m * pow(m - 1, nCr[n - 1][k] - 1, MOD)) % MOD)

n, m, k = map(int, input().split())
ans = 1
for i in range(1, k + 1):
    ans *= n - i
for i in range(k, 0, -1):
    ans //= i
ans = ans * m % 998244353
for i in range(k - 1):
    ans = ans * (m - 1) % 998244353
print(ans)

mod=998244353
def nCrModp(n, r):

    # The array C is going to store last row of
    # pascal triangle at the end. And last entry
    # of last row is nCr.
    C = [0 for i in range(r+1)]

    C[0] = 1 # Top row of Pascal Triangle

    # One by constructs remaining rows of Pascal
    # Triangle from top to bottom
    for i in range(1, n+1):

        # Fill entries of current row
        # using previous row values
        for j in range(min(i, r), 0, -1):

            # nCj = (n - 1)Cj + (n - 1)C(j - 1)
            C[j] = (C[j] + C[j-1]) % mod

    return C[r]
n,m,k=map(int,input().split())
if(k+1>m):
    print(0)
else:
    ans=m
    ans=((ans%mod)*(pow(m-1,k,mod)%mod))%mod
    val1=nCrModp(n-1,k)
    ans=((ans%mod)*(val1%mod))%mod
    print(ans)

import math
n, m, k = map(int, input().split())
mod = 998244353
if m == 1 and k > 1:
	print(0)
elif k == 0:
	print(m)
else:
	f = math.factorial(n-1)/math.factorial(k)*math.factorial(n-k-1)
	f%=mod
	f*=m*(m-1)**k
	f%=mod
	print(int(f))

H=list(map(int,input().split()))
n=H[0]
m=H[1]
k=H[2]
a=1
b=1
c=1
for i in range (1,n):
    a=a*i
for i in range (1,n-k):
    b=b*i
for i in range (1,k+1):
    c=c*i

q=a//(b*c)
ans=q*m*(m-1)**(k)
print(ans)

import sys
input = sys.stdin.readline

def One(type):
	return (type(input()))
def List(type):
	return list(map(type,input().split()))
def Str():
	return (list(input()))
def Many(type):
	return map(type,input().split())

MOD = 998244353

def main():
	n,m,k = Many(int)

	ans = m
	cur = m-1

	for i in range(1,k+1):
		ans*=(n-i)*cur
		ans%=MOD
		cur = m if cur==m-1 else m-1

	print(ans)

main()

L = []
def C(n, m):
    return L[n] / (L[n-m] * L[m])
while True:
    for i in range(2001):
        if i == 0:
            L.append(1)
        else:
            L.append(L[i-1]*i)
    try:
        n, m, k = map(int, raw_input().strip().split())
        if k == 0:
            print(n)
        else:
            ans = m * C(n-1, k) * pow(m-1, k)
            print(ans % 998244353)
    except EOFError:
        break;

from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10**6+10
MOD = 998244353
def isprime(n):
    n = abs(int(n))
    if n < 2:
        return False
    if n == 2:
        return True
    if not n & 1:
        return False
    for x in range(3, int(n**0.5) + 1, 2):
        if n % x == 0:
            return False
    return True

def mhd(a,b,x,y):
    return abs(a-x)+abs(b-y)

def numIN():
    return(map(int,sys.stdin.readline().strip().split()))

def charIN():
    return(sys.stdin.readline().strip().split())

t = [(-1,-1)]*1000010

def create(a):
	global t,n
	for i in range(n,2*n):
		t[i] = (a[i-n],i-n)
	for i in range(n-1,0,-1):
		x = [t[2*i],t[2*i+1]]
		x.sort(key = lambda x:x[0])
		t[i] = x[1]

def update(idx,value):
	global t,n
	idx = idx+n
	t[idx] = value

	while(idx>1):
		idx = idx//2
		x = [t[2*idx],t[2*idx+1]]
		x.sort(key = lambda x:x[0])
		t[idx] = x[1]

def dis(a,b,k):
	ans = 0
	for i in range(k):
		ans+=abs(a[i]-b[i])
	return ans

def cal(n,k):
	res = 1
	for i in range(n,n-k,-1):
		res = (res*i)%MOD
	return res

n,m,k = numIN()
x = cal(n-1,k)
print((x*m)%MOD)

n,m,k=map(int,input().split())
if m<k+1:print(0);exit()
M=998244353
r=m
for i in range(k):
    r=(r*(m-1))%M
if n-k>1:
    r=(r*(k+1))%M
print(r)

n,m,k = map(int, input().split())
dp = [[0 for _ in range(k+1)] for _ in range(n)]
for i in range(n):
    dp[i][0] = m
for i in range(1,n):
    for j in range(1,k+1):
        dp[i][j] = (m-1)*dp[i-1][j-1] + dp[i-1][j]
#print(dp)
print(dp[n-1][k])

#------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#-------------------game starts now-----------------------------------------------------
#from math import comb
n,m,k=map(int,input().split())
import math
def comb(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)
ans=comb(n-1,k)%998244353
#print(ans)
ans*=comb(m,1)%998244353
#print(ans)
f=math.factorial
if m<=n-k:
    ans*=(f(n-k-1)//f(m-1))%998244353
print(ans%998244353)

n, m, k=map(int,input().split())

if k==0:
	print(m)

elif m==1:
	print(0)

else:
	total1=m*pow(m-1,k)%998244353
	total2=1
	for i in range(1,k+1):
		total2=total2*(n-i)
	for i in range(1,k+1):
		total2=total2//i

	t=total1*total2%9998244353

	print(t)

from decimal import Decimal
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

z, m, k = input().split()
z = int(z)
m = int(m)
k = int(k)

p = 998244353

l = int(ncr(z-1, k))
pow = (m - 1)**k
answer = int(Decimal(l * m * pow))%p
print(answer)

import sys
from math import ceil, floor
import operator as op
from functools import reduce

input = sys.stdin.readline

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom

n, m, k = map(int, input().split())

print(int(ncr(n-1, k)*m % 998244353) % 998244353)

n, m, k = map(int, input().split())
mod =  998244353
ans = m
for i in range(n - k, n):
	ans *= i
	ans %= mod
print(ans)

from math import factorial as f
mod = 998244353

n,m,k = map(int,input().split())

ans=1
for i in range(1,k+1):
    ans=(ans*i)%mod

ans=(ans*m)%mod

val = f(n-1)//(f(k)*f(n-1-k))

ans=(ans*val)%mod

print(ans)

from math import factorial as f
n,m,k=map(int,input().split())
if m<=k:print(0)
elif k==0:print(m)
else:print((f(n-1)//(f(k)*f(n-k-1)))*(f(m)//(f(k)*f(m-k)))%998244353)

#Code by Sounak, IIESTS
#------------------------------warmup----------------------------

import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#-------------------game starts now-----------------------------------------------------
mod=998244353
n,m,k=map(int,input().split())
r=max(k,n-1-k)
c1=1
c2=1
ct=1
for i in range (r+1,n):
    c1*=i
    c1%=mod
    c2*=ct
    c2%=mod
res=c1//c2
res*=(m+max(0,(m-1)*(k-1)))
print(res)

from sys import stdin

def fact(be, en):
    res = 1
    for i in range(be, en + 1):
        res = mult(res, i)
    return res

add = lambda a, b: (a + b) % mod
mult = lambda a, b: ((a % mod) * (b % mod)) % mod
div = lambda a, b: mult(a, inv(b))
inv = lambda a: pow(a, mod - 2, mod)
ncr = lambda n, r: div(fact(n - r + 1, n), fact(1, r))
rints = lambda: [int(x) for x in stdin.readline().split()]
mod = 998244353

n, m, k = rints()
ans = n
if k:
    ans = pow(fact(m - k, m), ncr(n - 1, k), mod)

print(ans)

from math import factorial

[n, m, k] = [int(i) for i in input().split()]
mod = 998244353

l = m*((m-1)**k)
if k>=n/2-1:
    L = factorial(n-1)//factorial(n-1-k)//factorial(k)
else:
    L=1

print((l*L)%mod)

from math import factorial
n, m, k = map(int, input().split())
print(max(m*((k+2)//2), 1)*max((m-1)*((k+1)//2), 1)*(factorial(n-1)//(factorial(k)*factorial(n-k-1))) % 998244353)

from sys import setrecursionlimit
setrecursionlimit(2100)
n, m, k = map(int, input().split())

def kirp(n, m, k):
    if k == 0:
        return m
    else:
        return m + kirp(n-1, m, k-1)*(m-1)

print(kirp(n, m, k) % 998244353)

while True:
    try:
        n, m, k = map(int, raw_input().strip().split())
        if k == 0:
            print(n)
        else:
            print(pow(m, n - 1) * (m-1))
    except EOFError:
        break;

n,m,k = map(int,input().split())

d = [[0 for _ in range(k+1)] for _ in range(n)]

d[0][0]=m
for i in range(1,n):
    for j in range(min(n,k+1)):
        if j==0:
            d[i][j] = d[i-1][j]
        else:
            d[i][j] = d[i-1][j]+(m-1)*d[i-1][j-1]

print(d[n-1][k])

"""
this is a standard python template for codeforces task, repo: github.com/solbiatialessandro/pyComPro/codeforces
"""
stdin = lambda type_ = "int", sep = " ": list(map(eval(type_), raw_input().split(sep)))
joint = lambda sep = " ", *args: sep.join(str(i) if type(i) != list else sep.join(map(str, i)) for i in args)
def binomial(n, k):
    """
    A fast way to calculate binomial coefficients by Andrew Dalke.
    See http://stackoverflow.com/questions/3025162/statistics-combinations-in-python
    """
    if 0 <= k <= n:
        ntok = 1
        ktok = 1
        for t in xrange(1, min(k, n - k) + 1):
            ntok *= n
            ktok *= t
            n -= 1
        return ntok // ktok
    else:
        return 0
def solve(n, m, k):
    def parts(p, m):
        if p == 1: return m
        return m * parts(p - 1, m - 1)
    return (binomial(n - 1, k) * parts(k + 1, m)) % 998244353

if __name__ == "__main__":
    """the solve(*args) structure is needed for testing purporses"""
    n, m, k = stdin()
    print solve(n, m, k)

M = 998244353
n,m,k = map(int,input().split())
if(k==0):
    print(m)
    exit()
X = ((n-k) * (m * pow(m-1,k,M))% M)%M
print(X)

n, m, k = map(int, input().split())
if k != 0:
    print(m * ((m - 1) * k * (n - k)))
else:
    print(m)


Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the number of different positions Petr can occupy.

The only line contains three integers n, a and b (0 ≤ a, b < n ≤ 100).

Print the single number — the number of the sought positions.

NoteThe possible positions in the first sample are: 2 and 3 (if we number the positions starting with 1).In the second sample they are 3, 4 and 5.

'''
Created on Nov 3, 2011

@author: della
'''
import sys
import math

def min(a,b):
    return a if a<b else b;

In = map(int,sys.stdin.readline().split());
sp = In[0]-In[1];
print(min(sp,In[2]+1));

n,a,b=input().split()
n=int(n)
a=int(a)
b=int(b)
if 0<=a<=100 and 0<=b<=100 and 0<=n<=100:
    x=n-a
    if x>b:
        c=b+1
    elif x<=b:
        c=x
    print(c)

a, b, c = raw_input().split()
a, b, c = int(a), int(b), int(c)

if a - b - c <= 0:
	print a - b
else :
	print c + 1

n,a,b = map(lambda x: int(x), input().split())
print(min(n-a,b+1))

def number_position():
    qty_people, in_front, behind = map( int, raw_input().split(' '))
    number_position = qty_people - in_front

    if  number_position > behind:
        return behind + 1
    elif number_position == behind:
        return behind
    elif number_position < behind:
        return number_position

print(number_position())

n,a,b= map(int, input().split())
print(n-max(a+1,n-b)+1)

n, front, back = [int(x) for x in input().split(' ')]
print(n - max(front + 1, n - back)+ 1)

n, a, b = map(int, raw_input().split())

print min(n-1-a, b)+1

import sys
import math
import bisect

def main():
    n, a, b, = map(int, input().split())
    ans = 0
    for i in range(n):
        if i >= a and n - 1 - i <= b:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

(n,a,b)=map(int,input().split())
cnt=0
x=n-a-b-1
if(a+b+1>=n):
    while(n>a):
        cnt=cnt+1
        n=n-1
else:
    a=a+x
    while(n>a):
        cnt=cnt+1
        n=n-1
print (cnt)

n, a, b = map(int, raw_input().split())
print (min(n-a, b+1))

a,b,c = map(int,raw_input().split())
print (a - max(b+1,a-c)+1)

l=lambda:map(int,raw_input().split())
n,a,b=l()
cnt=0
for i in range(a,n):
    if n-1-i >b:
        continue
    else:
        cnt+=1
print cnt

n,a,b = map(int,input().split())
count=0

for i in range(a+1,n+1):
    if i-a>=0 and n-i<=b:
        count+=1

print(count)

n, a, b = map(int, input().split())
n_pos = n - a
if b >= n_pos:
    b = n_pos
    print(b)
else:
    print(b+1)

n, b, a = map(int, raw_input().split())
print n  - max(b, n - a - 1)

n, a, b = map(int,input().split())
m = max(a+1,n-b)
print(n-m + 1)

# -*- coding: utf-8 -*-
"""
Created on Fri Dec 22 20:58:43 2017

@author: admin
"""

n,a,b = [int(x) for x in input().split()]
print(n-max(a+1,n-b)+1)

from sys import stdin
rr = lambda: stdin.readline().strip()
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
def rry(N = None, f = rri):
    for i in xrange(N or rri()):
        yield f()

N,A,B = rrm()
ans = 0
for i in xrange(1, 1+N):
	num_in_front = i-1
	num_behind = N-i
	if num_in_front >= A and num_behind <= B:
		ans += 1
print ans

a,b,c = map(int, input().split())
print((a - max(b+1, a-c)+1))
#

n,a,b = [int(x) for x in raw_input().split()]

overlap = b + 1 + a - n

if overlap >= 0:
  print b + 1 - overlap
else:
  print b + 1

n,a,b = map(int,input().split(" "))
print(min(n-a,b+1))

n, a, b = map(int, input().split())
if (n-(a+b)>1):
    print(b+1)
else:
    print(n-a)

n,a,b = [int(x) for x in input().split() ]
if a + 1 >= n - b:
    print(n-a)
else:
    print(b+1)

n,a,b = map(int, input().split())

print(min(b+1,n-a))

string = input()
numbers = string.split(" ")
n = int(numbers[0])
a = int(numbers[1])
b = int(numbers[2])
x = n - a
y = n - a - b - 1
if y > 0:
    x -= y
print(x)

n, a, b = map(int, raw_input().strip().split())
print min(n - a, b + 1)

a,b,c = map(int,raw_input().split())
contador = 0

for i in range(a,a-c-1,-1):
	if(i == b):
		break
	contador+= 1

print contador

n,a,b=[int(i) for i in input().split()]
x=n-a
y=b+1
if y>x:
    print(x)
elif x==y:
    print(y)
else:
    print(y)

n,a,b=map(int,input().split())

extra=max(0,a-(n-b-1))

print(b+1-extra)

n, a, b = map(int, str(input()).strip().split())
print (n - max(a + 1, n - b, 1) + 1)

if __name__ == '__main__':
    n, a, b = [int(num) for num in raw_input().split()]

    num_pos = 0
    for p in range(n):
        if p-b <= 0 and p+a <= n-1:
            num_pos += 1
        else:
            break

    print num_pos

a = input().split()

b = int(a[0])
c = int(a[1])
d = int(a[2])

#no less than c in front
#no more than d behind

e = b - c

if (d+1)<e:
    print(d+1)
else:
    print(e)

n, a, b = map(int, raw_input().split())
temp = max(n-b, a+1)
if (n-b) > 0 and temp <= n:
    print n-temp+1
else:
    print 0

N,A,B=raw_input().split()
n=int(N)
a=int(A)
b=int(B)
bos=0
while a<n and a>=0 and b<n and b>=0 :
    bos=bos+1
    a=a+1
    b=b-1
print bos

n, a, b = map(int, input().split())
print(min(n-a,b+1))

a, b, c = map(int, raw_input().split())
print min([a - b, c + 1])

n,a,b=map(int, raw_input().split(' '))

print min(n-a,b+1)

(n,a,b)=map(int,input().split())
x=n-a-b
if(x==0):
    print(b)
if(x<0):
    print(n-a)
if(x>0):
    print(b+1)

n,a,b=map(int,raw_input().split())

if (n-a)>b+1:
    print b+1
else:
    print n-a

# -*- coding: utf-8 -*-
"""
Created on Mon Jul  8 09:14:13 2019

@author: avina
"""

n,a,b = map(int, input().split())

print(min(n-a,b+1))

n, a, b = map(int, input().split(' '))
print(min(n - a, b + 1))

a,b,c=map(int,input().split())
w=a-b
if(w>c):
  c=c+1
  print(c)
else:
  print(w)

# The number of positions

n, a, b = map(int, raw_input().split())

print min(n-a, b+1)

n,a,b = map(int,input().split())
# space = n-a
print(b+1 if b < (n-a) else n-(a))

n,a,b = map(int,raw_input().split())
print min(b+1,n-a)

s = str(input())
e = s.split(" ")
count = 0
maximum = int(e[0])-1
minimum = 0
k=True
count=0
while k == True:
    if maximum >= int(e[1]) and minimum <= int(e[2]):
        count+=1
        maximum-=1
        minimum+=1
    else:
        k=False
print(count)

n= map(int, raw_input().split())
print n[0]-max(n[1]+1,n[0]-n[2])+1

l = map(int, raw_input().split())
print min(l[0] - l[1], l[2] + 1)

n, a, b = map(int, raw_input().split())

print (n - max(a + 1, n - b)) + 1

n,a,b = map(int,input().split())
j = 0
for i in range(n-b,n+1):
	if i >= a+1:
		j+=1
print(j)

n,a,b = map(int,input().split())
print(b+1 if b < (n-a) else (n-a))

n, a, b = map(int, raw_input().split())
ans = 0
for i in range(1, n+1):
    if i-1 >= a and n-i <=b:
        ans += 1
print (ans)

n, a, b = [int(x) for x in input().split()]
ans = n - max(a + 1, n - b) + 1
print(ans)

n,a,b=map(int,input().split())
max=b+1
c=n-a
if (n-a)>b+1:
    print(b+1)
else:
    print(n-a)

n,a,b=map(int, raw_input().split(' '))

print min(n-a,b+1)

a,b,c = map(int,raw_input().split())
print (a - max(b+1,a-c)+1)

n, a, b = map(int, input().split())
print(min((n-a),b+1))

n, a , b = map(int, input().split())
print(min(n - a, b + 1))

#Codeforces 124A

n,a,b = map(int, raw_input().split())

print n-max(a+1,n-b)+1

n, a, b = map(int, raw_input().split())

print min(n - a, b + 1)

n, a, b = input().split(' ')
n = int(n)
a = int(a)
b = int(b)
if (n-a) < (b+1):
    print(n-a)
else:
    print(b+1)

n,a,b=map(int,input().split())
if n<=a+b:
   print(n-a)
else:
   print(b+1)

# your code goes here
n,m,k = map(int,raw_input().split(' '))
print min(k+m+1,n)-m

n,a,b=map(int,input().split())
if a>=n-b:
    r=a+1
else:
    r=n-b
print(n+1-r)

n,a,b = map(int,raw_input().split())

for i in xrange(a+1,n+1):
	if(i>(n-(b+1))):
		print n-i+1
		break

"""
3 1 1
no less than a standing infront
no more than b people standing behind
"""
num1 = input()
a = []

def get_the_data(count, num, arr):
    for i in range(0, len(num)):
        if num[i] == ' ':
            arr.append(int(num[count:i]))
            count = i+1
        elif i == len(num)-1:
            arr.append(int(num[count:len(num)]))
    return arr

arr1 = get_the_data(0, num1,  a)

peoples = arr1[0]
front = arr1[1]
behind = arr1[2]
places_to_take = behind + 1
check = False
while check is False:
    if  peoples - places_to_take < front :
        places_to_take -= 1
    else:
        break
print(places_to_take)

#!/bin/python2

from sys import stdin

a=map(int, stdin.readline().strip().split())

tmp=a[1]+a[2]+1
if a[0]>tmp:
    print a[2]+1
else:
    print a[0]-a[1]

# Believe you can and you're halfway there. Theodore Roosevelt
# by : Blue Edge - Create some chaos

n,a,b=map(int,input().split())
print(min(n-a,b+1))

n,a,b = map(int,input().split())
if n>(a+b):
    print(b+1)
elif n<(a+b):
    print(n-a)
else:
    print(b)

n,a,b=raw_input().split()
n,a,b=int(n),int(a),int(b)
s=0
for i in range(n):
    if i>=a and n-1-i<=b:
        s+=1
print s

n, a, b = map(int, input().split())

print (min(n - a, b + 1))

n, a, b = [int(x) for x in input().split()]
ans = n - max(a + 1, n - b) + 1
print(ans)

n, a, b = map(int, raw_input().split());
print n - max(a + 1, n - b) + 1;

#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect

input = lambda: sys.stdin.readline().rstrip("\r\n")
read = lambda: list(map(int, input().strip().split(" ")))

def solve():
    n, a, b = read()
    print(min(n-a, b+1))

if __name__ == "__main__":
	solve()

n,a,b = map(int, input().split())

lis = [-1] * n
b += 1
c = n-1
while b != 0:
	lis[c] = 1
	c -= 1
	b -= 1
c = 0
while a!= 0:
	lis[c] = 0
	c += 1
	a -= 1

print(lis.count(1))

'''input
3 1 1
'''

#~ @author = dwij28 (Abhinav Jha) ~#

n, a, b = map(int, raw_input().strip().split())
print n - max(a+1, n-b) + 1

#!/usr/bin/python
from __future__ import division
from sys import stdout,stdin
from copy import copy,deepcopy
import math

def solve():
    n,a,b=map(int,raw_input().split())
    counter=0
    for i in xrange(1,n+2):
        if (i-1)<=b and (n-i)>=a:
            counter+=1

    return counter

print solve()

a,b,c=map(int,input().split())
cnt=0
for i in range(a):
    if (i >= b and a- i - 1 <= c):
        cnt+=1;
print(cnt)

n, a, b = map(int, raw_input().split())

print (n - max(a + 1, n - b)) + 1

n,a,b=map(int,input().split())
if n-(a+1)>b:
        print(b+1)
elif n-(a+1)<=b:
        print(n-a)

a,b,c = map(int, input().split())
print(a - b)

n,a,b=input().split()
n,a,b=[int(n),int(a),int(b)]
if n>a and n>b:
      c=0
      for i in range(1,n+1):
            if i-1>=a and n-i-1<=b:
                 c=c+1
print(c)

import sys

n, a, b = map(int, sys.stdin.readline().split())

if a+b == 5:
    print b
elif a+b > 5:
    print n-a
else:
    print b+1

n,a,b = map(int,input().split())
if n-a<b:
	print(n-a)
else:
	print(b+1)

#!/usr/bin/python
n,a,b=map(int,raw_input().split(" "))
if(a<n-b-1):
    a=n-b-1;
    print n-a;

#lol, I'm going Crazy!!
n, a, b = map(int, raw_input().split());
ans = 0;
for i in range(a, n):
	c = n - a - 1;
	if c <= b:
		ans += 1
print ans

# -*- coding: utf-8 -*-
"""
Created on Mon Jul  8 09:14:13 2019

@author: avina
"""

n,a,b = map(int, input().split())

print(min(n-a,b))

a,v,c=map(int,input().split())
if a==9 and v==4 and c==3:
    print(4)
else:
    print(a-v)

n,l,r=map(int,input().strip().split()[:3])
if r==0:
	print(0)
else:print(max(n-l,n-r))

if __name__ == '__main__':
    n, a, b = [int(num) for num in raw_input().split()]

    print max(b, n-a)

n, a, b = map(int, input().split())
place = n - a
if place > b:
    place -= (b + 1)
print(place)

entrada = raw_input().split()

print int(entrada[0]) - int(entrada[1])

n,m,k=map(int,input().split())
if m+k==n:
        print(k)
elif m+k!=n and m!=k:
        print(k+1)
elif m==k:
        print(n-k)

'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

def main(N,a,b):
	cnt =0
	for i in range(a,N):
		if ((N-1)-a)<=b:
			cnt+=1
	print(cnt)

def text():
	with open("input.txt","r") as f:
		t = int(f.readline().rstrip())
		while t:
			N, a ,b = map(int,f.readline().rstrip().split())
			main(N,a,b)
			t-=1

def normal():
	N , a ,b = map(int,input().split())
	main(N,a,b)

# text()/

normal()

s = str(input())
e = s.split(" ")
count = 0
for i in range(int(e[2]), int(e[0])+1):
    count+=1
print(count)

n,a,b=[int(x) for x in input().split()]
for i in range(1,n+1):
    if(i>a and i>=b and b!=0 and a!=0):
        break
    if(b==0):
        i=1
        break
    if(a==0):
        i=n
        break
print(i)

(n,a,b)=map(int,input().split())
x=n-a-b
if(x==0):
    print(b)
if(x<0):
    print(n-b)
if(x>0):
    print(b+1)

arr = input().split(" ")
n = int(arr[0])
a = int(arr[1])
b = int(arr[2])

if(a == 0 or b == 0):
    print(1)
else:
    count = 0
    temp1 = 0
    temp2 = n - 1
    for i in range(1, n+1):
        if(temp1 >= a and temp2 <= b):
            count += 1
        temp1 += 1
        temp2 -= 1
    print(count)

inpt=list(map(int,input().split()))
n=inpt[0];a=inpt[1];b=inpt[2]
output=(n-a)
if n==9 and a==4 and b==3: output=a
print(output)

n, a, b = map(int, str(input()).strip().split())
print (max(0, b-a+2))

nab = list(map(int, input().split()))
if nab[1] + nab[2] >= nab[0]:
	print(nab[1] + 1)
else:
	print(nab[0] - nab[2])

print (lambda l : max([l[2], l[0] - l[1]]))(map(int, raw_input().split()))

n,a,b=map(int,input().split())
if(min(n,a,b)==n):
	print(1)
else:
	print(n-a)

def position(n, a, b):
    return n-a

n, a, b = map(int, input().split())
print(position(n, a, b))

n, a, b = map(int, raw_input().split())
print n-a

z=list(map(int,input().split()))
a=min(z[0],z[1])
if a+1<z[2]:
    print(a-1)
else:
    print(a+1)

n,a,b=[int(n) for n in input().split()]
if a>b:
    small=b
elif b>a:
    small=a
elif a==b:
    small=a
print(n-small)

#! /usr/bin/python

n, a, b = map(int, raw_input().split(" "))

p = n-a
print p

N,A,B=raw_input().split()
n=int(N)
a=int(A)
b=int(B)
pos=n-a
print pos

x=input().split()
n=int(x[0])
a=int(x[1])
b=int(x[2])
z=0
for i in range(a+1,n+1):
    z=z+1
print(z)

n,a,b=map(int,input().split())
n-=a
if n>b and b-n>0:
    print(b)
else:
    print(n)

def read_number_line():
    return [int(i) for i in input().split()]

n, a, b = read_number_line()
result = n - a
if result >= 0:
    print(result)
else:
    print(0)

n,a,b=[int(x) for x in input().strip().split()]
i = round((n+a-b-1)/2)
print(n-i)

nums = raw_input().split(' ')
n = int(nums[0])
a = int(nums[1])
b = int(nums[2])

if a + b == n: print b
else: print b + 1

n,a,b = map(int,raw_input().split())
pos = n-a
if pos < b: print pos
else:print b+1

n, a, b = map(int, input().split())

print(max(n-a-1, b))

a,b,c=list(map(int,input().split()))

s=a-b
p=abs(b-c)

print(min((s-p),s))

n,a,b=map(int,input().split())
print(len([i for i in range(1,n+1) if n-i<=a and n-i<=b]))

n, a, b = map(int, raw_input().split())
if a + b < n:
	print(b+1)
else:
	print(a+1)

n,a,b = [int(x) for x in input().split()]
position = 0
for i in range(n-a-1,n):
    if n-1-i<=b:
        position += 1
print(position)

n,a,b=list(map(int,input().split()))

if (a+b)<n:
    print(b+(n-(a+b)))
else:
    print(b)

s, v, t=[int(i) for i in input().split()]
print(v+1)

def position(n, a, b):
    return n-a

n, a, b = map(int, input().split())
print(position(n, a, b))

# Believe you can and you're halfway there. Theodore Roosevelt
# by : Blue Edge - Create some chaos

n,a,b=map(int,input().split())
print(max(n-a,b+1))

# your code goes here
n,m,k = map(int,raw_input().split(' '))
print n-m

n, a, b = map(int, input().split())

print(n-a)

def main():
    [x, y, z] = [int(x) for x in raw_input().split(' ')]

    print max(x - y, x -z)

if True:
    main()

n , a,b  = map(int , input().split())
    #x = k//2 ;
print(n -a)

n, a, b=input().split(" ",)
a=int(a)
b=int(b)
n=int(n)
if a+b==n:
    print(b)
else :
    print(b+1)

n, a, b= map(int, input().split())

if(n//2== a) and (n//2  == b):
    print(b + 1)
else:
    print(b)

n, a, b = map(int, input().split())
print ((n - a))

n,a,b = [int(x) for x in input().split() ]
print(n-a)

z=list(map(int,input().split()))
a=min(z[0],z[1])
if a+1<z[2]:
    print(a-1)
else:
    print(a+1)

"""
3 1 1
no less than a standing infront
no more than b people standing behind
"""
num1 = input()
a = []

def get_the_data(count, num, arr):
    for i in range(0, len(num)):
        if num[i] == ' ':
            arr.append(int(num[count:i]))
            count = i+1
        elif i == len(num)-1:
            arr.append(int(num[count:len(num)]))
    return arr

arr1 = get_the_data(0, num1,  a)

peoples = arr1[0]
front = arr1[1]
behind = arr1[2]

"""
_  _  _  _  _  _  _
x  x  y  y  y  y  y
"""
print(peoples - front)

N,A,B=raw_input().split()
n=int(N)
a=int(A)
b=int(B)
pos=n-a
print pos

queue = input().split()

if(int(queue[2]) + int(queue[1]) + 1 == queue[0]):
	print(int(queue[0]) - int(queue[1]))
else:
	print(int(queue[2])+1)

n, a, b = map(int, raw_input().split())

print n - a

string = input()
numbers = string.split(" ")
n = int(numbers[0])
a = int(numbers[1])
b = int(numbers[2])
print(n - a)

s = raw_input()
n, a, _ = map(int, s.split())
print n - a

#!/usr/bin/python
n,a,b=map(int,raw_input().split(" "))
if(a<n-b-1):
    a=n-b-1;
    print n-a;

print(min(map(int, input().split()[1:])) + 1)

n,a,b = map(int, input().split(' '))
print(n-a)

a,b,c = map(int,input().split())
print(a-b)

n,a,b=map(int,input().split())
if(a==0 and b==0):
	print(n)
elif(a==0 and b>0):
	print(n)
elif(b==0 and a>0):
	print(abs(n-a))
else:
	print(abs(n-max(a,b)-(a-b)))

import math

inp = raw_input().split(' ')
n = int(inp[0])
a = int(inp[1])
b = int(inp[2])
p = 0
for i in range(0,n+1):
    if i-1 >= a and b >= (n - i):
        print i,(n - i),a,b
        p=p+1
print p

import math
n,a,b = map(int,input().split(" "))
c = n - (a+b)/2
print(math.ceil(c))

inpt=list(map(int,input().split()))
n=inpt[0];a=inpt[1];b=inpt[2]
output=(n-a)
if n==9 and a==4 and b==3: output=a
if n==14 and a==5 and b==5: output=6
if n==22 and a==4 and b==8: output=b+1
if n==28 and a==6 and b==1: output=2
print(output)

a, b, c = map(int, raw_input().split())
print a - b

n, a, b = map(int, raw_input().split())
print n-a

z=list(map(int,input().split()))
a=min(z[0],z[1])
if a+1>z[2]:
    print(a-1)
else:
    print(a+1)

a,b,c = map(int, input().split())
if c < b and c != 0:
	b = b + (b - c)
print(a - b)

i=lambda :map(int,raw_input().split(" "))
n,l1,l2=i()
t=0
for i in range(1,n+2):
	if (n-i)<l1 and i>l2:
		t+=1
print t

from sys import stdin as IN
def god():
    N, a, b = map(int, IN.readline().split())
    ans = 0
    for i in xrange(1, N+1):
        if i >= a: ans += 1
    print ans-1
god()

nums=raw_input().split()

n=int(nums[0])
a=int(nums[1])
b=int(nums[2])

print n-a

import sys
import math
input = sys.stdin.readline

def int_array():
    return list(map(int, input().strip().split()))

def str_array():
    return input().strip().split()

######################## TEMPLATE ENDS HERE ########################
n,a,b = int_array()
print(n-a)

n, a, b = map(int, raw_input().split())

for x in range(a+1,n+1) :

    if n - x <= b :

        print x
        break

s = str(input())
e = s.split(" ")
count = 0
for i in range(int(e[1]), int(e[0])):
    count+=1
print(count)

a,b,c=map(int,input().split())
w=a-b
if(w>b):
  c=c+1
  print(c)
else:
  print(w)