1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define st first
#define nd second
#define umap unordered_map
#define uset unordered_set
#define watch(x) cerr << (#x) << " is " << (x) << endl
#define all(a) begin(a),end(a)

using namespace std;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const int inf=0x3f3f3f3f;
const long long llinf=0x3f3f3f3f3f3f3f3f;
const double oo=1e15;
const double eps=1e-8;
const double pi=acos(-1.0);

template<typename T> T sqr(T a_) { return a_*a_; }
template<typename T> T cub(T a_) { return a_*a_*a_; }

inline void readI(int*n){register char c=0,sign=1;while(c<33)c=getchar_unlocked();if(c=='-'){sign=-1;c=getchar_unlocked();}*n=0;while(c>33){*n*=10;*n+=c-'0';c=getchar_unlocked();}*n*=sign;}
inline void printI(int n){if(!n){putchar_unlocked('0');return;}if(n<0){putchar_unlocked('-');n*=-1;}char digits[12];int i=0;while(n){digits[i++]=(n%10)+'0';n/=10;}while(i--)putchar_unlocked(digits[i]);}
// inline void readLL(long long*n){register char c=0,sign=1;while(c<33)c=getchar_unlocked();if(c=='-'){sign=-1;c=getchar_unlocked();}*n=0;while(c>33){*n*=10;*n+=c-'0';c=getchar_unlocked();}*n*=sign;}
// inline void printLL(long long n){if(!n){putchar_unlocked('0');return;}if(n<0){putchar_unlocked('-');n*=-1;}char digits[24];int i=0;while(n){digits[i++]=(n%10)+'0';n/=10;}while(i--)putchar_unlocked(digits[i]);}
// inline void readS(string*s){register char c=0;while(c<33)c=getchar_unlocked();while(c>=33){*s+=c;c=getchar_unlocked();}}
// inline void printS(string s){for(auto c:s)putchar_unlocked(c);}

typedef long double ld;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

//-----------------------------------------------//

const int N=0;
const int M=0;
const int mod=1000005997;


int n,k,p;
ll res;
ll t[20][21]={
    {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,8,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,16,100,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,32,616,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,64,4024,952,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,128,28512,11680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,256,219664,142800,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,512,1831712,1788896,7680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,1024,16429152,23252832,233792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,2048,157552000,315549312,5898240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,4096,1606874944,4483860928,136280832,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

};

int main(){

    readI(&n);
    readI(&k);
    readI(&p);

    res=t[n][k]%p;
    printI(res);

    return 0;
}

//-----------------------------------------------//