#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define fd(i,a,b)for(int i=b,_e=a;i>=_e;--i)
#define ll long long
using namespace std;
const int N=155;
int n,k,m,_n,_k,v,f[N][N],g[N][N][N];
int main(){
	cin>>n>>k>>m;
	if(~k&1){
		int a=n+1>>1;
		f[0][0]=1;k=k/2+1;
		fo(i,1,a){
			f[i][0]=f[i-1][k-1];
			fo(j,0,k-2)f[i][j+1]=f[i-1][j],f[i][0]=(f[i][0]+f[i-1][j])%m;
		}
		int su1=0,su2=0;
		fo(i,0,k-1)su1=(su1+f[a][i])%m,su2=(su2+f[n-a][i])%m;
		printf("%d",(ll)su1*su2%m);
		return 0;
	}
	f[0][0]=1;_k=(k+1)/2-1;
	fo(i,1,_k)
		fo(j,0,i)f[i][j+1]=f[i-1][j],f[i][0]=(f[i][0]+f[i-1][j])%m;
	_n=(n+1)/2+1;
	fo(j,0,_k)g[0][j][_n]=f[_k][j];
	fo(o,1,(n-k+1)/2)
		fo(i,0,o+_k)
			fo(j,o,_n)
				if(v=g[o-1][i][j]){
					//0 0
					g[o][0][_n]=(g[o][0][_n]+v)%m;
					//0 1
					g[o][i+1][_n]=(g[o][i+1][_n]+v)%m;
					//1 
					if(o<j){
						//1 0
						g[o][0][j]=(g[o][0][j]+v)%m;
						//1 1
						int lim=min(o-i+k,_n);
						if(o<lim)
							g[o][i+1][min(lim,j)]=(g[o][i+1][min(lim,j)]+v)%m;
					}
				}
	memset(f,0,sizeof f);
	fo(j,0,_n)fo(i,0,n/2)f[(n-k+1)/2][j]=(f[(n-k+1)/2][j]+g[(n-k+1)/2][i][j])%m;
	fo(o,(n-k+1)/2+1,(n+1)/2)
		fo(j,0,_n)if(v=f[o-1][j]){
			f[o][_n]=(f[o][_n]+v)%m;
			if(o<j)f[o][j]=(f[o][j]+v)%m;
		}
	cout<<f[(n+1)/2][_n];
}