#include <bits/stdc++.h>

const int MAXN = 160;
typedef long long LL;
int mod;
void reduce(int & x) { x += x >> 31 & mod; }
int solve1(int n, int K) {
	static int f[MAXN][MAXN];
	memset(f, 0, sizeof f);
	f[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		memcpy(f[i] + 1, f[i - 1], K << 2);
		for (int j = 0; j < K; ++j)
			f[i][0] = std::accumulate(f[i - 1], f[i], 0ll) % mod;
	}
	return std::accumulate(f[n], f[n + 1], 0ll) % mod;
}
int n, K;
struct status {
	int l, r, ll, rl;
	bool operator < (const status & b) const {
		if (l != b.l) return l < b.l;
		if (r != b.r) return r < b.r;
		if (ll != b.ll) return ll < b.ll;
		return rl < b.rl;
	}
} ;
std::map<status, int> dp[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> K >> mod;
	int ans = 0;
	if (K % 2 == 0)
		ans = (LL) solve1(n >> 1, K >> 1) * solve1(n - (n >> 1), K >> 1) % mod;
	else {
		int now = 1, lst = 0;
		dp[now][(status) {0, 0, n + 1, n + 1}] = 1;
		for (int i = 0; i < n; ++i) {
			std::swap(now, lst); dp[now].clear();
			for (auto j : dp[lst]) {
				auto t = j.first; int v = j.second;
				if (i & 1) {
					reduce(dp[now][(status) {0, t.r, n + 1, t.rl}] += v - mod);
					if (t.ll > i + 1) {
						int tl = t.rl;
						if (i + 2 - 2 * t.r + K <= i + 1)
							tl = std::min(tl, i + 1 - 2 * t.l + K);
						reduce(dp[now][(status) {t.l + 1, t.r, t.ll, tl}] += v - mod);
					}
				} else {
					reduce(dp[now][(status) {t.l, 0, t.ll, n + 1}] += v - mod);
					if (t.rl > i + 1) {
						int tl = t.ll;
						if (i + 2 - 2 * t.l + K <= i + 1)
							tl = std::min(tl, i + 1 - 2 * t.r + K);
						reduce(dp[now][(status) {t.l, t.r + 1, tl, t.rl}] += v - mod);
					}
				}
			}
		}
		for (auto t : dp[now]) reduce(ans += t.second - mod);
	}
	std::cout << ans << std::endl;
	return 0;
}
