#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, pos = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') pos = 0;
  for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + ch - '0';
  return pos ? x : -x;
}
int n, m, q, ans, mod;
const int N = 525;
long long dp1[N], dp2[N], dp3[N][N], dp4[N][N];
int c[N][N];
int main() {
  n = read(), m = read(), mod = read();
  c[0][0] = 1;
  for (int i = 1; i <= N - 1; ++i) {
    c[i][0] = 1;
    for (int j = 1; j <= i; ++j) {
      (c[i][j] = c[i - 1][j] + c[i - 1][j - 1]) >= mod ? c[i][j] -= mod : 0;
    }
  }
  dp1[0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) {
      (dp1[i] += 1ll * (i + 1) * c[i - 1][j - 1] % mod * dp1[j - 1] % mod *
                 dp1[i - j] % mod) >= mod
          ? dp1[i] -= mod
          : 0;
      (dp2[i] += 1ll * (c[j][2] + c[i - j + 1][2]) % mod * c[i - 1][j - 1] %
                 mod * dp1[j - 1] % mod * dp1[i - j] % mod) >= mod
          ? dp2[i] -= mod
          : 0;
      (dp2[i] += 1ll * (i + 1) * c[i - 1][j - 1] % mod * dp2[j - 1] % mod *
                 dp1[i - j] % mod) >= mod
          ? dp2[i] -= mod
          : 0;
      (dp2[i] += 1ll * (i + 1) * c[i - 1][j - 1] % mod * dp1[j - 1] % mod *
                 dp2[i - j] % mod) >= mod
          ? dp2[i] -= mod
          : 0;
    }
  }
  dp3[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    dp3[i][i] = dp1[i];
    dp4[i][i] = dp2[i];
    for (int j = 0; j <= i - 1; ++j) {
      dp3[i][j] = dp3[i - 1][j];
      dp4[i][j] = dp4[i - 1][j];
      for (int k = 1; k <= j; ++k) {
        (dp3[i][j] +=
         1ll * c[j][k] * dp3[i - k - 1][j - k] % mod * dp1[k] % mod) >= mod
            ? dp3[i][j] -= mod
            : 0;
        (dp4[i][j] +=
         1ll * c[j][k] * dp4[i - k - 1][j - k] % mod * dp1[k] % mod) >= mod
            ? dp4[i][j] -= mod
            : 0;
        (dp4[i][j] +=
         1ll * c[j][k] * dp3[i - k - 1][j - k] % mod * dp2[k] % mod) >= mod
            ? dp4[i][j] -= mod
            : 0;
      }
    }
  }
  printf("%d\n", dp4[n][m]);
  return 0;
}
