#include <iostream>

using namespace std;

int L[33554432];


int N,K,M;
unsigned int MM;
long long ans;



void GenL(int i, unsigned int Xor){
	if (i == N){
		L[ Xor% MM  ]++;
		return;
	}
	Xor*=33;
	for (int Z=1;Z<=26;Z++)
		GenL(i+1, (Xor^Z));
}

unsigned int INVERS_MOD;

void GenR(int i,unsigned int Xor){
	if (i)
		Xor*=INVERS_MOD;
	if (i == N){
		//R[ (Xor % MM) ]++;
		ans+=L[Xor%MM ];
		return;
	}

	for (int Z=1;Z<=26;Z++)
		GenR(i+1, ( (Xor^Z) ) );
}



int main(){
	
	cin >> N >> K >> M;
	MM = (1ll<< M);

	if (N <= 5){
		GenL(0,0);
		cout << L[K];
		//system("pause");
		return 0;
	}


	INVERS_MOD = 1;
	unsigned int pref = 32;

	for (int i=5;i<M;i++){
		if ( (i/5) & 1)
			INVERS_MOD+=pref;
		pref*=2;
	}

	int nn = N;
	N = 5;
	GenL(0,0);
	N = nn - 5;
	GenR(0,K);


	cout << ans;
	//system("pause");

}
