#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
long long M;
long long dp[160][80][80][80];
long long DP[160][160][160];
int main(){
	int a,b;
	scanf("%d%d%lld",&a,&b,&M);
	if(b%2==0){
		DP[0][0][1]=1;
		for(int i=0;i<a;i++){
			for(int j=0;j<=i+1;j++){
				for(int k=0;k<=i+1;k++){
					if(!DP[i][j][k])continue;
					if(i%2==0){
						DP[i+1][i+2][k]=(DP[i+1][i+2][k]+DP[i][j][k])%M;
						if(i-j<b)DP[i+1][j][k]=(DP[i+1][j][k]+DP[i][j][k])%M;
					}else{
						DP[i+1][j][i+2]=(DP[i+1][j][i+2]+DP[i][j][k])%M;
						if(i-k<b)DP[i+1][j][k]=(DP[i+1][j][k]+DP[i][j][k])%M;
					}
				}
			}
		}
		long long ret=0;
		for(int i=0;i<=a+1;i++){
			for(int j=0;j<=a+1;j++){
				ret+=DP[a][i][j];
			}
		}
		ret%=M;
		printf("%lld\n",ret);
		return 0;
	}else{
		dp[0][0][0][79]=1;
		for(int i=0;i<a;i++){
			for(int j=0;j<80;j++){
				for(int k=0;k<80;k++){
					for(int l=0;l<80;l++){
						if(!dp[i][j][k][l])continue;
						
						int x=j*2-2;
						int y=k*2-1;
					//	printf("%d %d %d %d: %lld\n",i,x,y,l,dp[i][j][k][l]);
						if(x<y){
							if(i%2==0){
								if(i<l*2)dp[i+1][j][k][l]=(dp[i+1][j][k][l]+dp[i][j][k][l])%M;
								dp[i+1][(i+2)/2][k][79]=(dp[i+1][(i+2)/2][k][79]+dp[i][j][k][l])%M;
							}else{
								if(x+2+b<=i)dp[i+1][j][k][min(l,(y+2+b)/2)]=(dp[i+1][j][k][min(l,(y+b+2)/2)]+dp[i][j][k][l])%M;
								else dp[i+1][j][k][l]=(dp[i+1][j][k][l]+dp[i][j][k][l])%M;
								dp[i+1][j][(i+1)/2][l]=(dp[i+1][j][(i+1)/2][l]+dp[i][j][k][l])%M;
							}
						}else{
							if(i%2==1){
								if(i<l*2-1)dp[i+1][j][k][l]=(dp[i+1][j][k][l]+dp[i][j][k][l])%M;
								dp[i+1][j][(i+1)/2][79]=(dp[i+1][j][(i+1)/2][79]+dp[i][j][k][l])%M;
							}else{
								if(y+2+b<=i)dp[i+1][j][k][min(l,(x+b+3)/2)]=(dp[i+1][j][k][min(l,(x+b+3)/2)]+dp[i][j][k][l])%M;
								else dp[i+1][j][k][l]=(dp[i+1][j][k][l]+dp[i][j][k][l])%M;
								dp[i+1][(i+2)/2][k][l]=(dp[i+1][(i+2)/2][k][l]+dp[i][j][k][l])%M;
							}
						}
					}
				}
			}
		}
		long long ret=0;
		for(int i=0;i<80;i++){
			for(int j=0;j<80;j++){
				for(int k=0;k<80;k++){
					ret+=dp[a][i][j][k];
				}
			}
		}
		ret%=M;
		printf("%lld\n",ret);
	}
}

Measured memory_bytes: 534656