#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int data = 0, w = 1;
  char ch = 0;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') w = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') data = data * 10 + ch - '0', ch = getchar();
  return data * w;
}
int f[505], g[505], c[505][505], mod, F1[505][505], G1[505][505];
void fix(int &x) {
  x -= mod;
  x += x >> 31 & mod;
}
int main() {
  int n = read(), m = read();
  mod = read();
  f[0] = 1;
  for (int i = 0; i <= n; i++) c[i][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) fix(c[i][j] = c[i - 1][j - 1] + c[i - 1][j]);
  f[0] = 1, g[0] = 0;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= i; j++)
      f[i] = (f[i] + 1ll * f[j - 1] * f[i - j] % mod * c[i - 1][j - 1] % mod *
                         (i + 1)) %
             mod,
      g[i] =
          (g[i] +
           1ll * f[j - 1] * g[i - j] % mod * c[i - 1][j - 1] % mod * (i + 1) +
           1ll * g[j - 1] * f[i - j] % mod * c[i - 1][j - 1] % mod * (i + 1) +
           1ll * f[j - 1] * f[i - j] % mod * c[i - 1][j - 1] % mod *
               (j * (j - 1) / 2 + (i - j + 1) * (i - j) / 2)) %
          mod;
  if (n == m) return cout << g[n] << "\n", 0;
  F1[0][0] = 1, G1[0][0] = 0;
  for (int i = 0; i <= m - 1; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 1; k <= m - i; k++)
        F1[i + k][j + 1] =
            (F1[i + k][j + 1] + 1ll * F1[i][j] * f[k] % mod * c[i + k][i]) %
            mod,
                      G1[i + k][j + 1] =
                          (G1[i + k][j + 1] +
                           1ll * G1[i][j] * f[k] % mod * c[i + k][i] +
                           1ll * F1[i][j] * g[k] % mod * c[i + k][i]) %
                          mod;
  int ans = 0;
  for (int i = 1; i <= m; i++)
    ans = (ans + 1ll * G1[m][i] * c[n - m + 1][i]) % mod;
  cout << ans << '\n';
  return 0;
}
