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