#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=150;
const int MAXH=MAXN/2;

int n,k,mod;
void inc(int &a,int b) { if((a+=b)>=mod) a-=mod; }

int dp[MAXH+1][MAXN+1][2][MAXH+1]; // dp[a][b][par][c] = ways to get to state with last b removed, length of alternating removed sequence before that is a and needing at least one of the next c with given parity to stay (c==0 -> no constraint)
int ndp[MAXH+1][MAXN+1][2][MAXH+1];

bool havecycle(int a,int b) {
	if(k%2==0) {
		int have=(b+1)/2+(b%2==1?a:0);
		return have>=k/2+1;
	} else {
		return b>=k+2;
	}
}

int solve() {
	memset(dp,0,sizeof(dp));
	inc(dp[0][0][0][0],1);
	REP(i,n) {
		memset(ndp,0,sizeof(ndp));
		for(int a=0;2*a<=i;++a) for(int b=0;2*a+b<=i;++b) REP(par,2) for(int c=0;c<=(par==0?(n-i+1)/2:(n-i)/2);++c) if(dp[a][b][par][c]!=0) {
			assert(par==0||c>=1);
			// remove it
			if(!(par==0&&c==1)) {
				if(!havecycle(a,b+1)) inc(ndp[a][b+1][c==0?0:1-par][c==0?0:par==0?c-1:c],dp[a][b][par][c]); //else printf("x %d(%d,%d,%d,%d)=%d\n",i,a,b,par,c,dp[a][b][par][c]);
			} else {
				//printf("y %d(%d,%d,%d,%d)=%d\n",i,a,b,par,c,dp[a][b][par][c]);
			}
			// keep it
			{
				if(b==0) { inc(ndp[0][0][0][0],dp[a][b][par][c]); continue; }
				int na=(b+1)/2+(b%2==1?a:0);
				if(k%2==0) {
					if(!havecycle(na,0)) inc(ndp[na][0][0][par==0?0:c],dp[a][b][par][c]);
				}
				if(k%2==1) {
					if(b%2==0||b==1) inc(ndp[na][0][0][par==0?0:c],dp[a][b][par][c]);
					if(b%2==1&&b!=1) {
						int need=(k+2-b)/2; assert(need>0); if(i+2*need-1>=n) need=0;
						//if(a==1&&b==3&&i==5) printf("need=%d (%d)\n",need,(k+2-b)/2);
						if(a<need) inc(ndp[na][0][0][par==0?0:c],dp[a][b][par][c]);
						if(a>=need) inc(ndp[na][0][0][par==0?need:need==0?c:min(need,c)],dp[a][b][par][c]);
					}
				}
			}
		}
		for(int a=0;2*a<=i+1;++a) for(int b=0;2*a+b<=i+1;++b) REP(par,2) for(int c=0;c<=(par==0?(n-(i+1)+1)/2:(n-(i+1))/2);++c) dp[a][b][par][c]=ndp[a][b][par][c];
		//for(int a=0;2*a<=i+1;++a) for(int b=0;2*a+b<=i+1;++b) REP(par,2) for(int c=0;c<=(par==0?(n-(i+1)+1)/2:(n-(i+1))/2);++c) if(dp[a][b][par][c]!=0) printf("after %d: (%d,%d,%d,%d)=%d\n",i+1,a,b,par,c,dp[a][b][par][c]);
	}
	int ret=0;
	for(int a=0;2*a<=n;++a) for(int b=0;2*a+b<=n;++b) REP(par,2) for(int c=0;c<=(par==0?(n-n+1)/2:(n-n)/2);++c) inc(ret,dp[a][b][par][c]);

	//REP(a,10) REP(b,10) if(havecycle(a,b)) { printf("(%d,%d)\n",a,b); break; }
	return ret;
}

bool isset(int mask,int bit) { return (mask&(1<<bit))!=0; }
int solvestupid() {
	int ret=0;
	REP(mask,1<<n) {
		bool ok=true;
		if(k%2==0) {
		}
		if(k%2==1) {
			for(int b=3;b<=k+2;b+=2) {
				int a=(k+2-b)/2;
				int len=4*a+b;
				REPE(off,n-len) {
					bool match=true;
					REP(i,a) if(!isset(mask,off+2*i)) match=false;
					REP(i,b) if(!isset(mask,off+2*a+i)) match=false;
					REP(i,a) if(!isset(mask,off+2*a+b+1+2*i)) match=false;
					if(match) ok=false;
				}
			}
		}
		if(ok) ++ret;
	}
	return ret;
}

void run() {
	scanf("%d%d%d",&n,&k,&mod);
	printf("%d\n",solve());
	//if(n<=20) printf("%d\n",solvestupid());
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 13952