#include <bits/stdc++.h>
using namespace std;
const int N = 510;
int n, m, P, f[N], g[N], C[N][N], p[N][N], q[N][N];
inline void upd(int &x, int y) { ((x += y) >= P) && (x -= P); }
int main() {
  scanf("%d%d%d", &n, &m, &P);
  f[0] = 1;
  for (int i = (0); i <= (m); ++i) {
    C[i][0] = 1;
    for (int j = (1); j <= (i); ++j)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % P;
  }
  for (int i = (1); i <= (m); ++i)
    for (int j = (1); j <= (i); ++j) {
      upd(f[i],
          1ll * f[j - 1] * f[i - j] % P * (i + 1) % P * C[i - 1][j - 1] % P);
      upd(g[i], (1ll * f[j - 1] * g[i - j] + 1ll * f[i - j] * g[j - 1]) % P *
                    (i + 1) % P * C[i - 1][j - 1] % P);
      upd(g[i], 1ll * (C[j][2] + C[i - j + 1][2]) * f[j - 1] % P * f[i - j] %
                    P * C[i - 1][j - 1] % P);
    }
  p[0][0] = 1;
  for (int i = (1); i <= (n); ++i) {
    for (int j = (0); j <= (min(i - 1, m)); ++j)
      for (int k = (0); k <= (j); ++k) {
        upd(p[i][j], 1ll * p[i - k - 1][j - k] * f[k] % P * C[j][k] % P);
        upd(q[i][j], (1ll * p[i - k - 1][j - k] * g[k] +
                      1ll * q[i - k - 1][j - k] * f[k]) %
                         P * C[j][k] % P);
      }
    if (i <= m) p[i][i] = f[i], q[i][i] = g[i];
  }
  printf("%d\n", q[n][m]);
  return 0;
}
