#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
ll mod;
const int maxn = 1e4;
const int N = 1001;
ll fac[maxn], ifac[maxn], inv[maxn];
ll C[N + 1][N + 1];
ll nck(ll n, ll k) {
  if (n < k) return 0;
  if (n < N && k < N) {
    return C[n][k];
  }
  return fac[n] * ifac[k] % mod * ifac[n - k] % mod;
}
void gen_inv() {
  fac[0] = inv[0] = ifac[0] = 1;
  fac[1] = inv[1] = ifac[1] = 1;
  for (int i = 2; i < maxn; i++) {
    fac[i] = fac[i - 1] * i % mod;
    inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
    ifac[i] = ifac[i - 1] * inv[i] % mod;
  }
  for (int i = 0; i < N; i++) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; j++) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
    }
  }
  assert(nck(4, 2) == 6);
}
int n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> mod;
  n++;
  gen_inv();
  vector<ll> dp1(n + 1, 0), dp2(n + 1, 0);
  dp1[0] = 1;
  for (int l = 1; l <= n; l++) {
    for (int i = 0; i < l; i++) {
      ll a = i;
      ll b = l - 1 - i;
      ll pick_left = nck(a + b, a);
      ll ways = dp1[a] * dp1[b] % mod * pick_left % mod;
      ways %= mod;
      ll val = (dp2[a] * dp1[b] % mod + dp2[b] * dp1[a] % mod) % mod *
               pick_left % mod;
      val %= mod;
      dp1[l] += ways * (l + 1) % mod;
      dp1[l] %= mod;
      dp2[l] +=
          (val * (l + 1) % mod +
           ways * (((a * (a + 1) / 2) % mod + (b * (b + 1) / 2) % mod) % mod) %
               mod) %
          mod;
      dp2[l] %= mod;
    }
  }
  vector<vector<ll>> dp3(n + 1, vector<ll>(m + 1, 0));
  vector<vector<ll>> dp4(n + 1, vector<ll>(m + 1, 0));
  dp3[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; j + k <= m && i + 1 + k <= n; k++) {
        ll pick = nck(j + k, k);
        dp3[i + 1 + k][j + k] += (dp3[i][j] * dp1[k] % mod * pick % mod) % mod;
        dp3[i + 1 + k][j + k] %= mod;
        dp4[i + 1 + k][j + k] +=
            (dp3[i][j] * dp2[k] % mod + dp4[i][j] * dp1[k] % mod) % mod * pick %
            mod;
        dp4[i + 1 + k][j + k] %= mod;
      }
    }
  }
  ll ans = dp4[n][m] % mod;
  ans += mod;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
