import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.lang.Math; public class Solution { static long countArray(int n, int k, int x) { long res = (long)Math.pow(k-1, n-2); res = res - (k-2); return res; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt(); long answer = countArray(n, k, x); System.out.println(answer); in.close(); } }