#include <bits/stdc++.h>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

ostream& operator<<(ostream& os, const pair<char, int>& unit) {
  return os << unit.first << "^" << unit.second;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, k, M;
  cin >> n >> k >> M;
  function<int(int)> norm = [&](int x) { return x >= M ? x - M : x; };
  function<void(int&, int)> add = [&](int& x, int y) {
    (x += y) >= M ? x -= M : 0;
  };
  function<void(int&, int)> sub = [&](int& x, int y) {
    (x -= y) < 0 ? x += M : 0;
  };
  if (k % 2 == 0) {
    function<vi(int, int)> easy = [&](int n, int k) {
      vi dp(n + 2);
      dp[0] = 1;
      for (int i = 1; i <= n + 1; ++i)
        for (int j = 1; j <= k + 1 && j <= i; ++j)
          add(dp[i], dp[i - j]);
      dp.erase(dp.begin());
      return dp;
    };
    vi need = easy((n + 1) / 2, k / 2);
    cout << need[n / 2] * (ll)need[(n + 1) / 2] % M;
  } else {
    int nn = n / 2 + 1;
    static int dp[80][80][160], newdp[80][80][160];
    dp[0][0][0] = 1;
    const int INF = 1 << 30;
    static int glt[80][80];
    function<int(int, int)> gl = [&](int a, int b) {
      a = min(a, k / 2 + 2);
      if ((b - a + 1) * 2 < k - a * 2 + 3 || a <= 0)
        return INF;
//      cerr << a << ' ' << b << ": " << (k - a * 2 + 3) << '\n';
      return (k - a * 2 + 3) / 2 - 1;
    };
    for (int i = 0; i <= nn; ++i)
      for (int j = 0; j <= nn; ++j) {
        if (i >= k / 2 + 2 && j >= k / 2 + 1) continue;
        glt[j + 1][i] = gl(j + 1, i);
      }
    for (int rep = 0; rep < n; ++rep) {
      memset(newdp, 0, sizeof(newdp));
      for (int i = 0; i <= nn; ++i)
        for (int j = 0; j <= nn; ++j) {
          if (i >= k / 2 + 2 && j >= k / 2 + 1) continue;
          // no limit
          add(newdp[0][i][0], dp[i][j][0]);
          int v = glt[j + 1][i];
          //cerr << v << ' ';
          if (j < k / 2 + 1 || i < k / 2 + 1)
            add(newdp[j + 1][i][v == INF ? 0 : ((v + 1) << 1)], dp[i][j][0]);
          // this
          add(newdp[0][i][0], dp[i][j][2]);
          for (int l = 1; l <= nn; ++l) {
            add(newdp[0][i][0], dp[i][j][(l + 1) << 1]);
            if (j < k / 2 + 1 || i < k / 2 + 1)
              add(newdp[j + 1][i][(l - 1) << 1 | 1], dp[i][j][(l + 1) << 1]);
          }
          // those
          for (int l = 0; l <= nn; ++l) {
            add(newdp[0][i][(l + 1) << 1], dp[i][j][l << 1 | 1]);
            if (j < k / 2 + 1 || i < k / 2 + 1) {
              add(newdp[j + 1][i][(min(glt[j + 1][i], l) + 1) << 1], dp[i][j][l << 1 | 1]);
              //cerr << glt[j + 1][i] << ' ';
            }
          }
        }
      memcpy(dp, newdp, sizeof(dp));
    }
    int ans = 0;
    for (int i = 0; i <= nn; ++i)
      for (int j = 0; j <= nn; ++j)
        for (int l = 0; l <= n + 5; ++l)
          add(ans, dp[i][j][l]);
    cout << ans;
  }

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
      -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 8320