#include using namespace std; typedef long long ll; ll mo = 1000000007; ll solve(ll n, ll k, ll x){ if(n == 3){ if(x == 1){ return k-1; }else{ return k-2; } } ll sam, dif; if(x == 1){ sam = 0; dif = k-1; }else{ sam = 1; dif = k-2; } //cout<> n >> k >> x; cout<