#include <bits/stdc++.h>
using namespace std;
const int MAXN = 510;
int MOD;
class Mint {
 public:
  Mint() : v(0) {}
  Mint(int _v) : v(_v) {}
  int v;
};
Mint operator+(const Mint& a, const Mint& b) {
  Mint c;
  c.v = (a.v + b.v) % MOD;
  return c;
}
Mint operator*(const Mint& a, const Mint& b) {
  Mint c;
  c.v = (1LL * a.v * b.v) % MOD;
  return c;
}
Mint f1[MAXN], f2[MAXN], f3[MAXN][MAXN], f4[MAXN][MAXN];
Mint s[MAXN], c[MAXN][MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m >> MOD;
  c[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    s[i] = s[i - 1] + i;
    c[i][0] = c[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
    }
  }
  f1[0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) {
      f1[i] = f1[i] + f1[j - 1] * f1[i - j] * (i + 1) * c[i - 1][j - 1];
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) {
      f2[i] = f2[i] + (i + 1) * c[i - 1][j - 1] *
                          (f2[j - 1] * f1[i - j] + f2[i - j] * f1[j - 1]);
      f2[i] = f2[i] +
              f1[j - 1] * f1[i - j] * c[i - 1][j - 1] * (s[j - 1] + s[i - j]);
    }
  }
  f3[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    f3[i][0] = 1;
    for (int j = 1; j <= i; ++j) {
      for (int k = 0; k <= j; ++k) {
        if (i == k) {
          f3[i][j] = f3[i][j] + f1[k];
        } else {
          f3[i][j] = f3[i][j] + f3[i - k - 1][j - k] * f1[k] * c[j][k];
        }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) {
      f4[i][j] = f4[i - 1][j];
      for (int k = 1; k <= j; ++k) {
        if (i > k) {
          f4[i][j] = f4[i][j] + f4[i - k - 1][j - k] * f1[k] * c[j][k] +
                     f3[i - k - 1][j - k] * f2[k] * c[j][k];
        } else {
          f4[i][j] = f4[i][j] + f2[k];
        }
      }
    }
  }
  cout << f4[n][m].v << endl;
  return 0;
}
