#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const int N = 65600;
complex<long double> oddc[N], evenc[N];
long long odd[N], even[N];
int Odd[N], Even[N];
int R[N], n, C = 1, mo, ans;
void FFT(complex<long double> *a, int f) {
  for (int i = (int)(0); i <= (int)(C - 1); i++)
    if (i < R[i]) swap(a[i], a[R[i]]);
  for (int d = 1; d < C; d <<= 1) {
    complex<long double> wn(cos(pi / d), f * sin(pi / d));
    for (int i = 0; i < C; i += (d << 1)) {
      complex<long double> w(1, 0);
      for (int j = i; j < i + d; j++, w *= wn) {
        complex<long double> y = a[j + d] * w;
        a[j + d] = a[j] - y;
        a[j] += y;
      }
    }
  }
}
void dtoc(long long *d, complex<long double> *c) {
  for (int i = (int)(0); i <= (int)(C - 1); i++) c[i] = (complex<long double>)0;
  for (int i = (int)(0); i <= (int)(n); i++) c[i] = d[i];
  FFT(c, 1);
}
void ctod(complex<long double> *c, long long *d) {
  FFT(c, -1);
  for (int i = (int)(0); i <= (int)(C - 1); i++) c[i] /= C;
  for (int i = (int)(0); i <= (int)(n); i++)
    d[i] = (long long)(c[i].real() + 0.5);
}
void updans() {
  for (int i = 1; i <= n; i += 2) ans = (ans + odd[i]) % mo;
}
void solve(int mx) {
  if (mx == 1) {
    even[0] = 1;
    odd[0] = 0;
    odd[1] = 1;
    updans();
    return;
  }
  solve(mx / 2);
  for (int i = (int)(0); i <= (int)(n); i++) Odd[i] = odd[i];
  for (int i = (int)(0); i <= (int)(n); i++) Even[i] = even[i];
  dtoc(odd, oddc);
  dtoc(even, evenc);
  for (int i = (int)(0); i <= (int)(C - 1); i++) {
    complex<long double> v1 = (oddc[i] + evenc[i]) * oddc[i];
    complex<long double> v2 =
        (oddc[i] + evenc[i]) * (evenc[i] - (complex<long double>)1);
    if (!(mx & 2))
      oddc[i] = v1, evenc[i] = v2;
    else
      evenc[i] = v1, oddc[i] = v2;
  }
  ctod(oddc, odd);
  ctod(evenc, even);
  for (int i = (int)(n + 1); i <= (int)(2 * n); i++) odd[i] = even[i] = 0;
  for (int i = (int)(0); i <= (int)(n); i++) {
    odd[i] = (odd[i] + Odd[i]) % mo;
    even[i] = (even[i] + Even[i]) % mo;
  }
  if (mx & 1)
    for (int i = (int)(n); i >= (int)(1); i--)
      odd[i] = (odd[i] + odd[i - 1] + even[i - 1]) % mo;
  updans();
}
int main() {
  int mx, L = 0;
  scanf("%d%d%d", &n, &mx, &mo);
  if (mx == 1) return puts("0"), 0;
  for (; C <= 2 * n; C <<= 1, L++)
    ;
  for (int i = (int)(1); i <= (int)(C - 1); i++)
    R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));
  solve(mx / 2);
  printf("%d\n", ans);
}
