#include <bits/stdc++.h>

using namespace std;

#define foru(i, l, r) for (int i = l; i <= r; i++)
#define ford(i, r, l) for (int i = r; i >= l; i--)

int mod = 1;
void Inc(int &x, int y) { x += y, x -= x >= mod ? mod : 0; }
void Dec(int &x, int y) { x -= y, x += x < 0 ? mod : 0; }
int inc(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
int dec(int x, int y) { return x < y ? x - y + mod : x - y; }
int mul(int x, int y) { return 1LL * x * y % mod; }
int fastpow(int base, int x) {
  int res = 1;
  while (x) {
    if (x & 1) res = mul(res, base);
    base = mul(base, base), x >>= 1;
  }
  return res;
}

const int maxn = 155;
int N, M;

namespace work_1 {
int f[maxn];
void solve() {
  M >>= 1, f[0] = 1;
  foru(i, 1, N) foru(j, max(0, i - M - 1), i - 1) Inc(f[i], f[j]);
  int Ans_1 = 0, Ans_2 = 0;
  foru(i, max(0, (N >> 1) - M), (N >> 1)) Inc(Ans_1, f[i]);
  foru(i, max(0, ((N + 1) >> 1) - M), ((N + 1) >> 1)) Inc(Ans_2, f[i]);
  printf("%d\n", mul(Ans_1, Ans_2));
}
}  // namespace work_1

namespace work_2 {
int f[maxn][maxn][maxn];
void solve() {
  f[0][0][0] = 1;
  foru(i, 1, ((N + M) >> 1)) {
    foru(j, 0, M + 1) foru(k, 0, N) Inc(f[i][0][0], f[i - 1][j][k]);
    if (i + i <= N)
      foru(j, 0, M + 1) foru(k, 0, N) Inc(f[i][0][k + 1], f[i - 1][j][k]);
    if (i + i - M >= 1)
      foru(j, 0, M) foru(k, 0, N) Inc(f[i][j + (j > 0)][0], f[i - 1][j][k]);
    int tmp = 0;
    if (i + i <= N && i + i - M >= 1)
      foru(j, 0, M) foru(k, 0, N) if ((tmp = max(j + 1, k + 2)) <= M + 1)
          Inc(f[i][tmp][k + 1], f[i - 1][j][k]);
  }
  int Ans = 0;
  foru(j, 0, M + 1) foru(k, 0, N) Inc(Ans, f[(N + M) >> 1][j][k]);
  printf("%d\n", Ans);
}
}  // namespace work_2

int main() {
  scanf("%d%d%d", &N, &M, &mod);
  if(M & 1) work_2::solve();
  else work_1::solve();
  return 0;
}
