#include <bits/stdc++.h>
using namespace std;
const int N = 65536 + 10;
const double pi = acos(-1);
int n, m, _n, mod, ans, r[N], a[N], f[2][N], g[2][N];
void upd(int &x, int y) {
  x += y;
  x -= x >= mod ? mod : 0;
}
void upd_ans() {
  for (int i = 1; i <= m; i += 2) upd(ans, f[1][i]);
}
struct cp {
  double a, b;
  cp(double a = 0, double b = 0) : a(a), b(b) {}
  cp operator+(cp t) { return cp(a + t.a, b + t.b); }
  cp operator-(cp t) { return cp(a - t.a, b - t.b); }
  cp operator*(cp t) { return cp(a * t.a - b * t.b, a * t.b + b * t.a); }
} w[N], A[N], B[N];
void fft_init(int &n) {
  int len = 0;
  while (1 << len < n) len++;
  n = 1 << len;
  w[0] = w[n] = cp(1, 0);
  for (int i = (1); i <= (n - 1); i++) {
    w[i] = cp(cos(2 * i * pi / n), sin(2 * i * pi / n));
    r[i] = (r[i >> 1] >> 1) | ((i & 1) << len - 1);
  }
}
void fft(cp *a, int all, int fl) {
  for (int i = (0); i <= (all - 1); i++)
    if (i < r[i]) swap(a[i], a[r[i]]);
  int n = 2, m = 1, x = all / 2;
  for (; n <= all; m = n, n <<= 1, x >>= 1)
    for (int i = 0; i < all; i += n)
      for (int k = 0; k < m; k++) {
        cp t = w[fl ? all - x * k : x * k] * a[i + m + k];
        a[i + m + k] = a[i + k] - t;
        a[i + k] = a[i + k] + t;
      }
  if (fl)
    for (int i = (0); i <= (all - 1); i++) a[i].a /= all;
}
void mul(int *a, int *b, int *c) {
  for (int i = (0); i <= (m); i++) A[i] = cp(a[i], 0);
  for (int i = (m + 1); i <= (_n - 1); i++) A[i] = cp(0, 0);
  for (int i = (0); i <= (m); i++) B[i] = cp(b[i], 0);
  for (int i = (m + 1); i <= (_n - 1); i++) B[i] = cp(0, 0);
  fft(A, _n, 0);
  fft(B, _n, 0);
  for (int i = (0); i <= (_n - 1); i++) A[i] = A[i] * B[i];
  fft(A, _n, 1);
  for (int i = (1); i <= (m); i++) c[i] = (long long)(A[i].a + 0.5) % mod;
}
void solve(int n) {
  if (n == 1) {
    f[1][1] = 1;
    if (n != ::n) upd_ans();
    return;
  }
  solve(n / 2);
  memset(g, 0, sizeof(g));
  for (int i = (1); i <= (m); i++) a[i] = (f[0][i] + f[1][i]) % mod;
  for (int t = (0); t <= (1); t++) {
    mul(a, f[t ^ ((n / 2) & 1)], g[t]);
    for (int i = (1); i <= (m); i++) {
      upd(g[t][i], f[t][i]);
      upd(g[t][i], f[t ^ ((n / 2) & 1)][i]);
    }
  }
  if (n & 1) {
    for (int i = m; i > 1; i--) upd(g[1][i], (g[1][i - 1] + g[0][i - 1]) % mod);
    upd(g[1][1], 1);
  }
  memcpy(f, g, sizeof(g));
  if (n != ::n) upd_ans();
}
int main() {
  scanf("%d%d%d", &m, &n, &mod);
  _n = m + m + 1;
  fft_init(_n);
  solve(n);
  printf("%d\n", ans);
  return 0;
}
