#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   int n, a, P, len, rev[N];   int Lim;   int f[2][N], g[2][N];   const long double PI = acos(-1.0);   struct Complex {     long double x, y;     Complex() {}     Complex(long double _x, long double _y) {       x = _x;       y = _y;     }     Complex conj() { return Complex(x, -y); }     Complex operator+(const Complex rhs) const {       return Complex(x + rhs.x, y + rhs.y);     }     Complex operator-(const Complex rhs) const {       return Complex(x - rhs.x, y - rhs.y);     }     Complex operator*(const Complex rhs) const {       return Complex(x * rhs.x - y * rhs.y, x * rhs.y + y * rhs.x);     }   } w[N], w2[N];   inline void FFT(Complex *F, int len, int type) {     for (int i = 0; i < len; i++)       if (i < rev[i]) swap(F[i], F[rev[i]]);     for (int k = 2; k <= len; k <<= 1)       for (int j = 0; j < len; j += k) {         for (int i = j; i < j + (k / 2); i++) {           Complex cur = type == 1 ? w[(k / 2) + (i - j)] : w2[(k / 2) + (i - j)];           Complex u = F[i], v = cur * F[i + (k / 2)];           F[i] = u + v;           F[i + (k / 2)] = u - v;         }       }     if (type == -1)       for (int i = 0; i < len; i++) F[i].x /= len, F[i].y /= len;   }   Complex A[N], B[N], C[N], D[N];   inline void MTT(int *F, int *G, int k) {     for (int i = 0; i < len; i++) A[i] = B[i] = C[i] = D[i] = Complex(0, 0);     Lim = int(sqrt(P) + 1);     for (int i = 0; i < k; i++) {       A[i] = Complex(F[i] / Lim, F[i] % Lim);       C[i] = Complex(G[i] / Lim, G[i] % Lim);     }     FFT(A, len, 1);     FFT(C, len, 1);     for (int i = 1; i < len; i++) B[len - i] = A[i].conj();     B[0] = A[0].conj();     for (int i = 1; i < len; i++) D[len - i] = C[i].conj();     D[0] = C[0].conj();     for (int i = 0; i < len; i++) {       Complex aa = (A[i] + B[i]) * Complex(0.5, 0),               bb = (A[i] - B[i]) * Complex(0, -0.5),               cc = (C[i] + D[i]) * Complex(0.5, 0),               dd = (C[i] - D[i]) * Complex(0, -0.5);       A[i] = (aa * cc) + Complex(0, 1) * (aa * dd + bb * cc), B[i] = bb * dd;     }     FFT(A, len, -1);     FFT(B, len, -1);     for (int i = 0; i < k; i++) {       long long aa = (long long)(A[i].x + 0.5) % P,                 bb = (long long)(A[i].y + 0.5) % P,                 cc = (long long)(B[i].x + 0.5) % P;       F[i] = (1ll * aa * Lim * Lim % P + 1ll * bb * Lim % P + cc % P) % P;       F[i] = (F[i] + P) % P;     }   }   int ans = 0;   inline void solve(int a, int k) {     if (a == 1) {       f[1][1] = ans = 1;       return;     }     solve(a >> 1, k);     memset(g, 0, sizeof g);     g[0][0] = g[1][0] = 1;     for (int i = 1; i < k; i++) g[0][i] = g[1][i] = (f[0][i] + f[1][i]) % P;     MTT(g[0], f[(a >> 1) & 1], k);     MTT(g[1], f[((a >> 1) & 1) ^ 1], k);     for (int i = 0; i < k; i++)       f[0][i] = (f[0][i] + g[0][i]) % P, f[1][i] = (f[1][i] + g[1][i]) % P;     if (a & 1) {       for (int i = k - 1; i; i--)         f[1][i] = (f[1][i] + f[0][i - 1] + f[1][i - 1]) % P;       f[1][1] = (f[1][1] + 1) % P;     }     for (int i = 1; i < k; i += 2) ans = (ans + f[1][i]) % P;   }   int main() {     scanf( %d%d%d , &n, &a, &P);     if (a == 1) return puts( 0 ), 0;     len = 1;     while (len <= n * 2) len <<= 1;     for (int i = 0; i < len; i++) {       rev[i] = rev[i >> 1] >> 1;       if (i & 1) rev[i] |= len >> 1;     }     for (int i = 1; i < len; i <<= 1) {       w[i] = Complex(1, 0);       for (int j = 1; j < i; j++)         w[i + j] = (((j & 31) == 1) ? Complex(cos(PI * j / i), sin(PI * j / i))                                     : w[i + j - 1] * w[i + 1]);     }     for (int i = 0; i < len; i++) w2[i] = w[i].conj();     solve(a >> 1, n + 1);     printf( %d n , ans);   }