#include<bits/stdc++.h>
#define llong long long
#define pii pair<int,int>
#define riterator reverse_iterator
using namespace std;

inline int read()
{
	int x = 0,f = 1; char ch = getchar();
	for(;!isdigit(ch);ch=getchar()) {if(ch=='-') f = -1;}
	for(; isdigit(ch);ch=getchar()) {x = x*10+ch-48;}
	return x*f;
}

const int N = 150;
llong P;
int n,m;

void updsum(llong &x,llong y) {x = x+y>=P?x+y-P:x+y;}

namespace Solve1
{
	llong f[N+3];
	void solve()
	{
		m>>=1; f[0] = 1ll;
		for(int i=1; i<=n; i++)
		{
			for(int j=max(0,i-m-1); j<i; j++)
			{
				updsum(f[i],f[j]);
			}
		}
		llong ans1 = 0ll,ans2 = 0ll;
		for(int i=max(0,(n>>1)-m); i<=(n>>1); i++) updsum(ans1,f[i]);
		for(int i=max(0,(n+1>>1)-m); i<=(n+1>>1); i++) updsum(ans2,f[i]);
//		printf("ans1=%lld ans2=%lld\n",ans1,ans2);
		printf("%lld\n",ans1*ans2%P);
	}
}

namespace Solve2
{
	llong f[N+3][N+3][N+3];
	void solve()
	{
		f[0][0][0] = 1ll;
		for(int i=1; i+i-m<=n; i++)
		{
			for(int j=0; j<=m+1; j++) for(int k=0; k<=n; k++)
			{
				updsum(f[i][0][0],f[i-1][j][k]);
			}
			if(i+i<=n)
			{
				for(int j=0; j<=m+1; j++) for(int k=0; k<=n; k++)
				{
					updsum(f[i][0][k+1],f[i-1][j][k]);
				}
			}
			if(i+i-m>=1)
			{
				for(int j=0; j<=m; j++) for(int k=0; k<=n; k++)
				{
					updsum(f[i][j+(j>0)][0],f[i-1][j][k]);
				}
			}
			if(i+i<=n&&i+i-m>=1)
			{
				for(int j=0; j<=m; j++) for(int k=0; k<=n; k++)
				{
					int jj = max(j+1,k+2);
					if(jj<=m+1)
					{
						updsum(f[i][jj][k+1],f[i-1][j][k]);
					}
				}
			}
		}
		llong ans = 0ll;
		for(int j=0; j<=m+1; j++) for(int k=0; k<=n; k++)
		{
			updsum(ans,f[(n+m)>>1][j][k]);
		}
		printf("%lld\n",ans);
	}
}

int main()
{
	scanf("%d%d%lld",&n,&m,&P);
	if(!(m&1)) {Solve1::solve();}
	else {Solve2::solve();}
	return 0;
}