#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
using namespace std;
namespace ywy {
const long double pi = acos(-1);
typedef struct _fushu {
  long double a;
  long double b;
  _fushu() { a = b = 0; }
  _fushu(long double x, long double y) {
    a = x;
    b = y;
  }
  friend _fushu operator+(const _fushu &a, const _fushu &b) {
    return (_fushu(a.a + b.a, a.b + b.b));
  }
  friend _fushu operator-(const _fushu &a, const _fushu &b) {
    return (_fushu(a.a - b.a, a.b - b.b));
  }
  friend _fushu operator*(const _fushu &a, const _fushu &b) {
    return (_fushu(a.a * b.a - a.b * b.b, a.a * b.b + a.b * b.a));
  }
} fushu;
int hudie[131073];
fushu dks[2][131073], a[131073], b[131073], c[131073];
inline void fft(int n, fushu *f, int op) {
  for (register int i = 0; i < n; i++)
    if (i < hudie[i]) swap(f[i], f[hudie[i]]);
  for (register int bit = 2; bit <= n; bit <<= 1) {
    fushu dk = dks[op][bit];
    for (register int i = 0; i < n; i += bit) {
      fushu dwg = _fushu(1, 0);
      for (register int j = i; j < i + (bit >> 1); j++) {
        fushu cjr = f[j + (bit >> 1)] * dwg;
        f[j + (bit >> 1)] = f[j] - cjr;
        f[j] = f[j] + cjr;
        dwg = dwg * dk;
      }
    }
  }
}
int p;
inline long long Int(long double n) {
  long long up = (long long)n, down = up + 1;
  if (((n - up < 0) ? -(n - up) : n - up) >
      ((n - down < 0) ? -(n - down) : n - down))
    return (down);
  return (up);
}
long long dp[2][30001][2];
int ints[43];
void ywymain() {
  int n, mx;
  cin >> n >> mx >> p;
  if (mx == 1) {
    cout << 0 << endl;
    return;
  }
  for (register int i = 1; i <= 131072; i <<= 1) {
    dks[0][i] = _fushu(cos(2 * pi / i), sin(2 * pi / i));
    dks[1][i] = _fushu(cos(2 * pi / i), -sin(2 * pi / i));
  }
  int ptr = 1;
  mx /= 2;
  while (mx) ints[ptr] = mx, ptr++, mx >>= 1;
  ptr--;
  reverse(ints + 1, ints + 1 + ptr);
  long long ans = 1, tot = 1;
  int cur = 0;
  dp[0][1][1] = dp[0][0][0] = 1;
  int k = 1;
  while (k <= n + n) k <<= 1;
  for (register int i = 0; i < k; i++)
    hudie[i] = (hudie[i >> 1] >> 1) | ((i & 1) ? (k >> 1) : 0);
  for (register int i = 2; i <= ptr; i++) {
    for (register int j = 0; j < k; j++) a[j] = b[j] = c[j] = _fushu();
    for (register int j = 0; j <= n; j++) {
      a[j] = _fushu((dp[cur][j][0] + dp[cur][j][1]) % p, 0);
      b[j] = _fushu(dp[cur][j][0] * (j != 0), 0);
      c[j] = _fushu(dp[cur][j][1] * (j != 0), 0);
    }
    fft(k, a, 0);
    fft(k, b, 0);
    fft(k, c, 0);
    for (register int j = 0; j < k; j++) {
      b[j] = a[j] * b[j];
      c[j] = a[j] * c[j];
    }
    fft(k, b, 1);
    fft(k, c, 1);
    for (register int j = 0; j <= n; j++) {
      dp[cur ^ 1][j][0 ^ (ints[i - 1] & 1)] =
          (Int(b[j].a / k) + dp[cur][j][0 ^ (ints[i - 1] & 1)]) % p;
      dp[cur ^ 1][j][1 ^ (ints[i - 1] & 1)] =
          (Int(c[j].a / k) + dp[cur][j][1 ^ (ints[i - 1] & 1)]) % p;
    }
    cur ^= 1;
    if (ints[i - 1] * 2 != ints[i]) {
      for (register int j = 0; j <= n; j++) {
        if (ints[i] & 1) {
          dp[cur ^ 1][j][0] = dp[cur][j][0];
          if (!j)
            dp[cur ^ 1][j][1] = dp[cur][j][1];
          else
            dp[cur ^ 1][j][1] =
                (dp[cur][j - 1][0] + dp[cur][j - 1][1] + dp[cur][j][1]) % p;
        } else {
          dp[cur ^ 1][j][1] = dp[cur][j][1];
          if (!j)
            dp[cur ^ 1][j][0] = dp[cur][j][0];
          else
            dp[cur ^ 1][j][0] =
                (dp[cur][j - 1][0] + dp[cur][j - 1][1] + dp[cur][j][0]) % p;
        }
      }
      cur ^= 1;
    }
    tot = 0;
    for (register int j = 1; j <= n; j += 2) tot = (tot + dp[cur][j][1]) % p;
    ans = (ans + tot) % p;
  }
  cout << ans << endl;
}
}  // namespace ywy
int main() {
  ywy::ywymain();
  return (0);
}
