#include using namespace std; long countArray(int n, int k, int x) { // Return the number of ways to fill in the array. long res = 0; res = (((k-1)*(k-1)) * (pow(k-2, n-4))) - (n-k); return res; } int main() { int n; int k; int x; cin >> n >> k >> x; long answer = countArray(n, k, x); cout << answer << endl; return 0; }