#include <bits/stdc++.h>
using namespace std;
const long long N = 507;
const long long INF = 1e9 + 7;
long long n, m, mod;
long long Pow(long long x, long long y) {
  long long ans = 1, now = x;
  while (y) {
    if (y & 1) ans = ans * now % mod;
    now = now * now % mod;
    y >>= 1;
  }
  return ans;
}
long long fac[N], inv[N], f[N], g[N], F[N][N], G[N][N];
long long C(long long x, long long y) {
  return fac[x] * inv[y] % mod * inv[x - y] % mod;
}
int main() {
  scanf("%lld%lld%lld", &n, &m, &mod);
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % mod;
  inv[n] = Pow(fac[n], mod - 2);
  for (long long i = n; i; i--) inv[i - 1] = inv[i] * i % mod;
  f[0] = 1;
  for (long long i = 1; i <= n; i++) {
    f[i] = g[i] = 0;
    for (long long j = 1; j <= i; j++) {
      f[i] =
          (f[i] + f[j - 1] * f[i - j] % mod * C(i - 1, j - 1) % mod * (i + 1)) %
          mod;
      g[i] =
          (g[i] + f[j - 1] * g[i - j] % mod * C(i - 1, j - 1) % mod * (i + 1)) %
          mod;
      g[i] =
          (g[i] + g[j - 1] * f[i - j] % mod * C(i - 1, j - 1) % mod * (i + 1)) %
          mod;
      g[i] = (g[i] + f[j - 1] * f[i - j] % mod * C(i - 1, j - 1) % mod *
                         ((j - 1) * j / 2 + (i - j) * (i - j + 1) / 2)) %
             mod;
    }
  }
  F[0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    F[i][i] = f[i];
    G[i][i] = g[i];
  }
  for (long long i = 0; i <= n - 1; i++) {
    for (long long j = 0; j <= m + 1 - 1; j++) {
      F[i + 1][j] = (F[i + 1][j] + F[i][j]) % mod;
      G[i + 1][j] = (G[i + 1][j] + G[i][j]) % mod;
      for (long long k = 1; k <= n; k++) {
        if (j + k > m || i + k + 1 > n) break;
        F[i + k + 1][j + k] =
            (F[i + k + 1][j + k] + F[i][j] * f[k] % mod * C(j + k, k)) % mod;
        G[i + k + 1][j + k] =
            (G[i + k + 1][j + k] +
             (G[i][j] * f[k] + F[i][j] * g[k]) % mod * C(j + k, k)) %
            mod;
      }
    }
  }
  printf("%lld\n", G[n][m]);
  return 0;
}
