#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int n, m, MOD, C[N][N], f[N], g[N], dp1[N][N], dp2[N][N];
inline int PLUS(int x, int y) {
  x += y;
  return x >= MOD ? x - MOD : x;
}
int main() {
  cin >> n >> m >> MOD;
  for (int i = 0; i <= m; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++) C[i][j] = PLUS(C[i - 1][j - 1], C[i - 1][j]);
  }
  f[0] = 1;
  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 * g[j - 1] * f[i - j] % MOD * (i + 1) +
                      1ll * f[j - 1] * g[i - j] % MOD * (i + 1) +
                      1ll * (j * (j - 1) / 2 + (i - j + 1) * (i - j) / 2) *
                          f[j - 1] % MOD * f[i - j]) %
                         MOD * C[i - 1][j - 1]) %
             MOD;
  dp1[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= min(m, i); j++) {
      dp1[i][j] = dp1[i - 1][j], dp2[i][j] = dp2[i - 1][j];
      for (int k = 1; k <= j; k++)
        dp1[i][j] = (dp1[i][j] + 1ll * dp1[max(i - k - 1, 0)][j - k] * f[k] %
                                     MOD * C[j][k]) %
                    MOD,
        dp2[i][j] = (dp2[i][j] + (1ll * dp2[max(i - k - 1, 0)][j - k] * f[k] +
                                  1ll * dp1[max(i - k - 1, 0)][j - k] * g[k]) %
                                     MOD * C[j][k]) %
                    MOD;
    }
  return cout << dp2[n][m] << endl, 0;
}
