import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long countArray(int n, int k, int x) { long k1=(long)k; long x1=(long)x; long n1=(long)n; if(n<=0){return 0;} else if(n==1){return 1;} else if(n==2){return 2;} else if(n==3){ if(k>1 && k!=x){ return k1-2; } else{ return 0;} } else if(n==4){ if(k>1 ){ return (k1-1)*(k1-1)-1; }else{return 0;} }else { if(k1>1){ return (k1-1)*(n-2)-1; }else{return 0;} } // Return the number of ways to fill in the array. } 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(); } }