#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long double PI = acos(-1.0);
struct cccccc {
  long double real, imag;
  cccccc() {}
  cccccc(long double real_, long double imag_) : real(real_), imag(imag_) {}
  friend inline cccccc operator+(const cccccc &lhs, const cccccc &rhs) {
    return cccccc(lhs.real + rhs.real, lhs.imag + rhs.imag);
  }
  friend inline cccccc operator-(const cccccc &lhs, const cccccc &rhs) {
    return cccccc(lhs.real - rhs.real, lhs.imag - rhs.imag);
  }
  friend inline cccccc operator*(const cccccc &lhs, const cccccc &rhs) {
    return cccccc(lhs.real * rhs.real - lhs.imag * rhs.imag,
                  lhs.real * rhs.imag + lhs.imag * rhs.real);
  }
};
inline cccccc conj(cccccc &a) { return cccccc(a.real, -a.imag); }
int n, m, mod, ans;
inline void FFT(cccccc *a, int n, int rev) {
  for (int i = 0, j = 0; i < n; ++i) {
    if (i > j) swap(a[i], a[j]);
    for (int k = n >> 1; (j ^= k) < k; k >>= 1)
      ;
  }
  for (int i = 2; i <= n; i <<= 1) {
    int m = i >> 1;
    cccccc g(cos(PI / m), rev * sin(PI / m));
    for (int j = 0; j < n; j += i) {
      cccccc w(1, 0);
      for (int k = 0; k != m; k++) {
        cccccc z = a[j + m + k] * w;
        a[j + m + k] = a[j + k] - z;
        a[j + k] = a[j + k] + z;
        w = w * g;
      }
    }
  }
  if (rev == -1) {
    for (int i = 0; i < n; i++) a[i].real /= n, a[i].imag /= n;
  }
}
cccccc A[N], B[N], f1[N], f2[N], f3[N], f4[N];
void cal(int *a, int *b, int *c, int len) {
  for (int i = 0; i < len; i++) A[i] = cccccc(b[i] & 32767, b[i] >> 15);
  for (int i = 0; i < len; i++) B[i] = cccccc(c[i] & 32767, c[i] >> 15);
  FFT(A, len, 1);
  FFT(B, len, 1);
  for (int i = 0; i < len; i++) {
    int j = (len - i) & (len - 1);
    f2[i] = (A[i] + conj(A[j])) * cccccc(0.5, 0);
    f1[i] = (A[i] - conj(A[j])) * cccccc(0, -0.5);
    f4[i] = (B[i] + conj(B[j])) * cccccc(0.5, 0);
    f3[i] = (B[i] - conj(B[j])) * cccccc(0, -0.5);
  }
  for (int i = 0; i < len; i++) {
    A[i] = f1[i] * f3[i] + f1[i] * f4[i] * cccccc(0, 1);
    B[i] = f2[i] * f4[i] * cccccc(0, 1) + f2[i] * f3[i];
  }
  FFT(A, len, -1);
  FFT(B, len, -1);
  for (int i = 0; i < len; i++) {
    long long g1 = (long long)(A[i].real + 0.5) % mod;
    long long g2 = (long long)(A[i].imag + 0.5) % mod;
    long long g3 = (long long)(B[i].real + 0.5) % mod;
    long long g4 = (long long)(B[i].imag + 0.5) % mod;
    a[i] = (g4 + (g2 + g3 << 15) + (g1 << 30)) % mod;
  }
}
int pre[2][N], nxt[2][N], a[N], b[N], c[N];
void work(int m) {
  if (m == 1) {
    ans = 1;
    pre[1][1] = 1;
    pre[0][1] = 0;
    return;
  }
  work(m / 2);
  if (m & 1) {
    int len = 1;
    while (len <= min(n * 2, m)) len <<= 1;
    for (int i = 0; i < len; i++) b[i] = c[i] = 0;
    for (int i = 1; i <= min(n, m / 2); i++)
      b[i] = (pre[0][i] + pre[1][i]) % mod;
    c[1]++;
    for (int i = 1; i <= min(n, m / 2); i++)
      (c[i] += pre[1 - (m / 2) % 2][i]) %= mod,
          (c[i + 1] += (pre[1][i] + pre[0][i])) %= mod;
    cal(a, b, c, len);
    for (int i = 1; i <= min(n, m); i++) {
      nxt[1][i] = a[i];
      if (i <= min(n, m / 2))
        (nxt[1][i] += pre[1][i] + pre[1 - (m / 2) % 2][i]) %= mod;
    }
    for (int i = 1; i <= min(n, m / 2); i++)
      (nxt[1][i + 1] += pre[1][i] + pre[0][i]) %= mod;
    nxt[1][1]++;
    for (int i = 0; i < len; i++) b[i] = c[i] = 0;
    for (int i = 1; i <= min(n, m / 2); i++)
      b[i] = (pre[0][i] + pre[1][i]) % mod;
    for (int i = 1; i <= min(n, m / 2); i++) c[i] = pre[(m / 2) % 2][i];
    cal(a, b, c, len);
    for (int i = 1; i <= min(n, m); i++) {
      nxt[0][i] = a[i];
      if (i <= min(n, m / 2))
        (nxt[0][i] += pre[0][i] + pre[(m / 2) % 2][i]) %= mod;
    }
  } else {
    int len = 1;
    while (len <= min(n * 2, m)) len <<= 1;
    for (int i = 0; i < len; i++) b[i] = c[i] = 0;
    for (int i = 1; i <= min(n, m / 2); i++)
      b[i] = (pre[0][i] + pre[1][i]) % mod;
    for (int i = 1; i <= min(n, m / 2); i++) c[i] = pre[1 - (m / 2) % 2][i];
    cal(a, b, c, len);
    for (int i = 1; i <= min(n, m); i++) {
      nxt[1][i] = a[i];
      if (i <= min(n, m / 2))
        (nxt[1][i] += pre[1][i] + pre[1 - (m / 2) % 2][i]) %= mod;
    }
    for (int i = 0; i < len; i++) b[i] = c[i] = 0;
    for (int i = 1; i <= min(n, m / 2); i++)
      b[i] = (pre[0][i] + pre[1][i]) % mod;
    for (int i = 1; i <= min(n, m / 2); i++) c[i] = pre[(m / 2) % 2][i];
    cal(a, b, c, len);
    for (int i = 1; i <= min(n, m); i++) {
      nxt[0][i] = a[i];
      if (i <= min(n, m / 2))
        (nxt[0][i] += pre[0][i] + pre[(m / 2) % 2][i]) %= mod;
    }
  }
  for (int i = 1; i <= min(n, m); i++) {
    pre[0][i] = nxt[0][i];
    pre[1][i] = nxt[1][i];
    if (i & 1) ans += nxt[1][i];
    if (ans >= mod) ans -= mod;
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &mod);
  m /= 2;
  if (m == 0) return puts("0");
  work(m);
  cout << ans;
}
