import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static BigInteger countArray(int n, int k, int x) { BigInteger ans = BigInteger.valueOf(1); for(int start = 0; start < n - 3; start ++) { ans = ans.multiply(BigInteger.valueOf(k -1)); } if (k > 2) ans = ans.multiply(BigInteger.valueOf(k - 2)); ans = ans.add(BigInteger.valueOf(1)); return ans; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt(); BigInteger answer = countArray(n, k, x); System.out.println(answer); in.close(); } }