#include <bits/stdc++.h>
using namespace std;
int mo;
struct COMPLEX {
  long double r, i;
  COMPLEX() {}
  COMPLEX(long double _r, long double _i) { r = _r, i = _i; }
  COMPLEX operator+(const COMPLEX &a) const {
    return COMPLEX(r + a.r, i + a.i);
  }
  COMPLEX operator-(const COMPLEX &a) const {
    return COMPLEX(r - a.r, i - a.i);
  }
  COMPLEX operator*(const COMPLEX &a) const {
    return COMPLEX(r * a.r - i * a.i, r * a.i + i * a.r);
  }
  COMPLEX conj() const { return COMPLEX(r, -i); }
};
const int FFTN = 1 << 16;
COMPLEX w[FFTN + 2], a[FFTN + 2], b[FFTN + 2];
int R[FFTN], LEN;
const long double pi = acos(-1);
void prepare() {
  for (int i = (int)(0); i <= (int)(FFTN - 1); i++)
    w[i] = COMPLEX(cos(2 * pi * i / FFTN), sin(2 * pi * i / FFTN));
}
void FFTinit(int sz) {
  LEN = 1;
  int L = 0;
  for (; LEN <= sz; LEN <<= 1, L++)
    ;
  for (int i = (int)(0); i <= (int)(LEN - 1); i++)
    R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));
}
void DFT(COMPLEX *a, int n) {
  for (int i = (int)(0); i <= (int)(n - 1); i++)
    if (i < R[i]) swap(a[i], a[R[i]]);
  for (int d = 1; d < n; d <<= 1) {
    int len = FFTN / (d << 1);
    for (int i = 0; i < n; i += d << 1)
      for (int j = i, p = 0; j < i + d; j++, p += len)
        a[j + d] = a[j] - a[j + d] * w[p], a[j] = a[j] + a[j] - a[j + d];
  }
}
const int N = 30005;
int f[2][N], n, ans, mxv;
void solve(int mx) {
  if (mx == 1) {
    f[0][0] = f[1][1] = ans = 1;
    return;
  }
  solve(mx / 2);
  for (int i = (int)(0); i <= (int)(LEN - 1); i++)
    a[i] = (i <= n ? COMPLEX(f[0][i], f[1][i]) : COMPLEX(0, 0));
  DFT(a, LEN);
  for (int i = (int)(0); i <= (int)(LEN - 1); i++) {
    int ano = (LEN - i) & (LEN - 1);
    COMPLEX v0 = (a[i] + a[ano].conj()) * COMPLEX(0.5, 0);
    COMPLEX v1 = (a[i] - a[ano].conj()) * COMPLEX(0, -0.5);
    b[ano] = (v0 + v1) * v1 + (v0 + v1) * (v0 - COMPLEX(1, 0)) * COMPLEX(0, 1);
  }
  DFT(b, LEN);
  for (int i = (int)(0); i <= (int)(n); i++) {
    int v1 = (long long)(b[i].r / LEN + 0.49) % mo;
    int v0 = (long long)(b[i].i / LEN + 0.49) % mo;
    if (mx & 2) swap(v0, v1);
    f[0][i] = (f[0][i] + v0) % mo;
    f[1][i] = (f[1][i] + v1) % mo;
  }
  if (mx & 1)
    for (int i = (int)(n); i >= (int)(1); i--)
      f[1][i] = (f[1][i] + f[1][i - 1] + 1ll * f[0][i - 1]) % mo;
  for (int i = 1; i <= n; i += 2) ans = (ans + f[1][i]) % mo;
}
int main() {
  scanf("%d%d%d", &n, &mxv, &mo);
  if (mxv == 1) return puts("0"), 0;
  prepare();
  FFTinit(2 * n);
  solve(mxv / 2);
  printf("%d\n", ans);
}
