Alice and Bob are playing a game with a string of characters, with Alice going first. The string consists n characters, each of which is one of the first k letters of the alphabet. On a player’s turn, they can either arbitrarily permute the characters in the words, or delete exactly one character in the word (if there is at least one character). In addition, their resulting word cannot have appeared before throughout the entire game. The player unable to make a valid move loses the game.

Given n, k, p, find the number of words with exactly n characters consisting of the first k letters of the alphabet such that Alice will win if both Alice and Bob play optimally. Return this number modulo the prime number p.

Input

The first line of input will contain three integers n, k, p (1 ≤ n ≤ 250 000, 1 ≤ k ≤ 26, 108 ≤ p ≤ 109 + 100, p will be prime).

Output

Print a single integer, the number of winning words for Alice, modulo p.

Example

Input

4 2 100000007


Output

14

Note

There are 14 strings that that Alice can win with. For example, some strings are "bbaa" and "baaa". Alice will lose on strings like "aaaa" or "bbbb".
#include <bits/stdc++.h>
using namespace std;
const int logMax = 20;
const int NMax = 250005;
int DP[logMax][NMax];
int MOD, N, K;
int supra[NMax], cnt;
int Inv[NMax], Fact[NMax];
int power(int n, int p) {
  int sol = 1;
  while (p) {
    if (p & 1) sol = (1LL * sol * n) % MOD;
    p /= 2;
    n = (1LL * n * n) % MOD;
  }
  return sol;
}
void precalcFact() {
  Fact[0] = Inv[0] = 1;
  for (int i = 1; i <= N; i++) {
    Fact[i] = (1LL * Fact[i - 1] * i) % MOD;
    Inv[i] = power(Fact[i], MOD - 2);
  }
}
void Add(int& x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
int Comb(int n, int k) {
  return (((1LL * Fact[n] * Inv[n - k]) % MOD) * Inv[k]) % MOD;
}
void Solve() {
  if (N % 2 == 1) {
    cout << power(K, N) << "\n";
    return;
  }
  DP[0][0] = 1;
  for (int i = 0; i <= N; i++) {
    if ((N & i) != i) continue;
    cnt = 0;
    for (int j = i | (i + 1); j <= N; j = i | (j + 1)) {
      if ((N & j) == j) supra[++cnt] = j;
      if (j == N) break;
    }
    for (int j = 0; j < min(K, 16); j++) {
      if (DP[j][i] == 0) continue;
      for (int k = 1; k <= cnt; k++) {
        Add(DP[j + 1][supra[k]], (1LL * DP[j][i] * Inv[supra[k] - i]) % MOD);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= min(K, 16); i++) {
    Add(ans, (1LL * DP[i][N] * Comb(K, i)) % MOD);
  }
  ans = (1LL * ans * Fact[N]) % MOD;
  ans = (power(K, N) - ans + MOD) % MOD;
  cout << ans << "\n";
}
int main() {
  cin >> N >> K >> MOD;
  precalcFact();
  Solve();
  return 0;
}
