#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");
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBMWzMzNTU0NDMyXTsKCgppbnQgTixLLE07CnVuc2lnbmVkIGludCBNTTsKbG9uZyBsb25nIGFuczsKCgoKdm9pZCBHZW5MKGludCBpLCB1bnNpZ25lZCBpbnQgWG9yKXsKCWlmIChpID09IE4pewoJCUxbIFhvciUgTU0gIF0rKzsKCQlyZXR1cm47Cgl9CglYb3IqPTMzOwoJZm9yIChpbnQgWj0xO1o8PTI2O1orKykKCQlHZW5MKGkrMSwgKFhvcl5aKSk7Cn0KCnVuc2lnbmVkIGludCBJTlZFUlNfTU9EOwoKdm9pZCBHZW5SKGludCBpLHVuc2lnbmVkIGludCBYb3IpewoJaWYgKGkpCgkJWG9yKj1JTlZFUlNfTU9EOwoJaWYgKGkgPT0gTil7CgkJLy9SWyAoWG9yICUgTU0pIF0rKzsKCQlhbnMrPUxbWG9yJU1NIF07CgkJcmV0dXJuOwoJfQoKCWZvciAoaW50IFo9MTtaPD0yNjtaKyspC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