Today is the final contest of INOI (Iranian National Olympiad in Informatics). The contest room is a row with n computers. All computers are numbered with integers from 1 to n from left to right. There are m participants, numbered with integers from 1 to m.

We have an array a of length m where a_{i} (1 ≤ a_i ≤ n) is the computer behind which the i-th participant wants to sit.

Also, we have another array b of length m consisting of characters 'L' and 'R'. b_i is the side from which the i-th participant enters the room. 'L' means the participant enters from the left of computer 1 and goes from left to right, and 'R' means the participant enters from the right of computer n and goes from right to left.

The participants in the order from 1 to m enter the room one by one. The i-th of them enters the contest room in the direction b_i and goes to sit behind the a_i-th computer. If it is occupied he keeps walking in his direction until he reaches the first unoccupied computer. After that, he sits behind it. If he doesn't find any computer he gets upset and gives up on the contest.

The madness of the i-th participant is the distance between his assigned computer (a_i) and the computer he ends up sitting behind. The distance between computers i and j is equal to |i - j|.

The values in the array a can be equal. There exist n^m ⋅ 2^m possible pairs of arrays (a, b).

Consider all pairs of arrays (a, b) such that no person becomes upset. For each of them let's calculate the sum of participants madnesses. Find the sum of all these values.

You will be given some prime modulo p. Find this sum by modulo p.

Input

The only line contains three integers n, m, p (1 ≤ m ≤ n ≤ 500, 10^8 ≤ p ≤ 10 ^ 9 + 9).

It is guaranteed, that the number p is prime.

Output

Print only one integer — the required sum by modulo p.

Examples

Input


3 1 1000000007


Output


0


Input


2 2 1000000009


Output


4


Input


3 2 998244353


Output


8


Input


20 10 1000000009


Output


352081045

Note

In the first test, there are three possible arrays a: \{1\}, \{2\}, and  \{3\} and two possible arrays b: \{L\} and \{R\}. For all six pairs of arrays (a, b), the only participant will sit behind the computer a_1, so his madness will be 0. So the total sum of madnesses will be 0.

In the second test, all possible pairs of arrays (a, b), such that no person becomes upset are:

  * (\{1, 1\}, \{L, L\}), the sum of madnesses is 1; 
  * (\{1, 1\}, \{R, L\}), the sum of madnesses is 1; 
  * (\{2, 2\}, \{R, R\}), the sum of madnesses is 1; 
  * (\{2, 2\}, \{L, R\}), the sum of madnesses is 1; 
  * all possible pairs of a ∈ \{\{1, 2\}, \{2, 1\}\} and b ∈ \{\{L, L\}, \{R, L\}, \{L, R\}, \{R, R\}\}, the sum of madnesses is 0. 



So, the answer is 1 + 1 + 1 + 1 + 0 … = 4.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  string sep = "";
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << ']';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename A>
ostream &operator<<(ostream &os, const set<A> &s) {
  os << '{';
  string sep = "";
  for (const auto &x : s) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const map<A, B> &m) {
  os << '{';
  string sep = "";
  for (const auto &x : m)
    os << sep << x.first << " -> " << x.second, sep = ", ";
  return os << '}';
}
constexpr int inf = 0x3f3f3f3f;
constexpr int maxn = 510;
int mod;
int fat[maxn], inv[maxn], inv_fat[maxn];
void calc() {
  fat[0] = fat[1] = inv[1] = inv_fat[0] = inv_fat[1] = 1;
  for (int i = 2; i < maxn; i++) {
    fat[i] = (int)(1ll * fat[i - 1] * i % mod);
    inv[i] = mod - (int)(1ll * (mod / i) * inv[mod % i] % mod);
    inv_fat[i] = (int)(1ll * inv_fat[i - 1] * inv[i] % mod);
  }
}
inline int choose(int a, int b) {
  return (int)(1ll * fat[a] * (1ll * inv_fat[b] * inv_fat[a - b] % mod) % mod);
}
inline ll p(int x) { return 1ll * x * (x + 1) / 2; }
int f[maxn], c[maxn], dp1[maxn][maxn], dp2[maxn][maxn];
int main() {
  int n, m;
  scanf("%d %d %d", &n, &m, &mod);
  calc();
  f[0] = 1;
  for (int i = 1; i <= m; i++) {
    for (int j = 0; j < i; j++) {
      f[i] += (int)((1ll * choose(i - 1, j) * f[j] % mod) * f[i - 1 - j] % mod);
      if (f[i] >= mod) f[i] -= mod;
      c[i] += (int)((1ll * (i + 1) * choose(i - 1, j) % mod) *
                    ((1ll * f[j] * c[i - 1 - j] % mod) +
                     (1ll * f[i - 1 - j] * c[j] % mod) % mod) %
                    mod);
      if (c[i] >= mod) c[i] -= mod;
      c[i] += (int)((1ll * choose(i - 1, j) * (p(j) + p(i - 1 - j)) % mod) *
                    (1ll * f[j] * f[i - 1 - j] % mod) % mod);
      if (c[i] >= mod) c[i] -= mod;
    }
    f[i] = (int)(1ll * f[i] * (i + 1) % mod);
  }
  dp1[0][0] = 1;
  for (int k = 1; k <= n; k++) {
    dp1[k][0] = 1;
    for (int i = 1; i <= min(m, k); i++) {
      dp1[k][i] = dp1[k - 1][i];
      for (int j = 1; j <= i; j++) {
        dp1[k][i] += (int)((1ll * f[j] * dp1[max(k - j - 1, 0)][i - j] % mod) *
                           choose(i, j) % mod);
        if (dp1[k][i] >= mod) dp1[k][i] -= mod;
      }
      dp2[k][i] = dp2[k - 1][i];
      for (int j = 1; j <= i; j++) {
        dp2[k][i] += (int)((1ll * c[j] * dp1[max(k - j - 1, 0)][i - j] % mod) *
                           choose(i, j) % mod);
        if (dp2[k][i] >= mod) dp2[k][i] -= mod;
        dp2[k][i] += (int)((1ll * f[j] * dp2[max(k - j - 1, 0)][i - j] % mod) *
                           choose(i, j) % mod);
        if (dp2[k][i] >= mod) dp2[k][i] -= mod;
      }
    }
  }
  printf("%d\n", dp2[n][m]);
}
