#include <bits/stdc++.h>
const int MAXN = 511;
int f[MAXN][MAXN];
int g[MAXN][MAXN];
int h[MAXN];
int dp[MAXN];
int binom[MAXN][MAXN];
int n, m, ans, p;
inline int add(int a, int b) {
  a += b, a -= (a >= p) ? p : 0;
  return a;
}
inline void incr(int& a, int b) { a = add(a, b); }
int main(void) {
  std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
  std::cin >> n >> m >> p;
  for (int i = 0; i <= n; ++i)
    for (int j = *binom[i] = 1; j <= i; ++j)
      binom[i][j] = add(binom[i - 1][j], binom[i - 1][j - 1]);
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j)
      incr(dp[i], 1ll * dp[j - 1] * dp[i - j] % p * binom[i - 1][j - 1] % p);
    dp[i] = 1ll * dp[i] * (i + 1) % p;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= i; ++j)
      incr(h[i], (1ll * dp[j - 1] * h[i - j] + 1ll * dp[i - j] * h[j - 1]) % p *
                     (i + 1) % p * binom[i - 1][j - 1] % p),
          incr(h[i], 1ll * dp[j - 1] * dp[i - j] % p *
                         (binom[j][2] + binom[i - j + 1][2]) % p *
                         binom[i - 1][j - 1] % p);
  g[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < i; ++j) {
      g[i][j] = g[i - 1][j], f[i][j] = f[i - 1][j];
      for (int k = 1; k <= j; ++k)
        incr(g[i][j], 1ll * g[i - k - 1][j - k] * dp[k] % p * binom[j][k] % p),
            incr(f[i][j], (1ll * g[i - k - 1][j - k] * h[k] +
                           1ll * f[i - k - 1][j - k] * dp[k]) %
                              p * binom[j][k] % p);
    }
    f[i][i] = h[i], g[i][i] = dp[i];
  }
  std::cout << f[n][m] << '\n';
  return 0;
}
