#include <bits/stdc++.h>
using namespace std;
int mod;
int n, m;
const int maxn = 505;
int f[maxn], h[maxn], g[maxn][maxn], t[maxn][maxn];
int C[maxn][maxn];
int main() {
  cin >> n >> m >> mod;
  C[0][0] = 1;
  for (int i = (1); i < (n + 1); ++i) {
    C[i][0] = 1;
    for (int j = (1); j < (i + 1); ++j) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
  f[0] = 1;
  h[0] = 0;
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = (0); j < (i); ++j) {
      f[i] = (f[i] + (long long)f[i - 1 - j] * f[j] % mod * (i + 1) % mod *
                         C[i - 1][j] % mod) %
             mod;
    }
  }
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = (0); j < (i); ++j) {
      h[i] = (h[i] + (long long)f[j] * f[i - 1 - j] % mod * C[i - 1][j] % mod *
                         ((j + 1) * j / 2 + (i - 1 - j) * (i - j) / 2) % mod) %
             mod;
      h[i] = (h[i] + (long long)C[i - 1][j] * (i + 1) % mod * f[i - 1 - j] %
                         mod * h[j] % mod) %
             mod;
      h[i] = (h[i] + (long long)C[i - 1][j] * (i + 1) % mod * f[j] % mod *
                         h[i - 1 - j] % mod) %
             mod;
    }
  }
  g[0][0] = 1;
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = (0); j < (i); ++j) {
      g[i][j] = g[i - 1][j];
      for (int l = 1; l <= j; ++l) {
        g[i][j] = (g[i][j] + (long long)C[j][l] * g[i - 1 - l][j - l] % mod *
                                 g[l][l] % mod) %
                  mod;
      }
    }
    g[i][i] = f[i];
  }
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = (0); j < (i); ++j) {
      t[i][j] = t[i - 1][j];
      for (int l = 1; l <= j; ++l) {
        t[i][j] = (t[i][j] + (long long)C[j][l] * t[i - 1 - l][j - l] % mod *
                                 f[l] % mod) %
                  mod;
        t[i][j] = (t[i][j] + (long long)C[j][l] * h[l] % mod *
                                 g[i - 1 - l][j - l] % mod) %
                  mod;
      }
    }
    t[i][i] = h[i];
  }
  cout << t[n][m] << endl;
}
