#!/bin/python3 import sys def countArray(n, k, x): # Return the number of ways to fill in the array. # n size of array # x last element of array 1 and x # 1 to k allowed in array # consec pos diff values # n-2 is length of changy bit in middle # 0 = 1, last =x so 1 cannot = 1 and last-1 cannot = x # each slot can be k-1 numbers k-1 * n -2 return (((k-1)*(n-2))-1) if __name__ == "__main__": n, k, x = input().strip().split(' ') n, k, x = [int(n), int(k), int(x)] answer = countArray(n, k, x) print(answer)