#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int get_random() {
  static uniform_int_distribution<int> dist(0, 1e9 + 6);
  return dist(rng);
}
template <class T>
void make_unique(T& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
int geti() {
  int x;
  cin >> x;
  return x;
}
long long getll() {
  long long x;
  cin >> x;
  return x;
}
double getd() {
  double x;
  cin >> x;
  return x;
}
const int MAXN = 500 + 100;
void solve(int tt) {}
long long mod;
struct mint {
  long long x;
  mint() : x(0) {}
  mint(long long _x) { x = _x >= 0 ? _x % mod : _x % mod + mod; }
  template <class T>
  mint operator^(T b) const {
    if (!b) return 1;
    mint tmp = (*this) ^ (b / 2);
    return b % 2 ? tmp * tmp * (*this) : tmp * tmp;
  }
  mint inv() const {
    static unordered_map<long long, long long> inv_dp;
    if (inv_dp.count(x))
      return inv_dp[x];
    else if (inv_dp.size() < 100000)
      return mint(inv_dp[x] = ((*this) ^ (mod - 2)).x);
    else
      return (*this) ^ (mod - 2);
  }
  mint operator+(const mint& b) const { return (x + b.x) % mod; }
  mint operator-(const mint& b) const { return (x - b.x + mod) % mod; }
  mint operator*(const mint& b) const { return (x * b.x) % mod; }
  mint operator/(const mint& b) const { return (*this) * b.inv(); }
  mint& operator+=(const mint& b) {
    x = (x + b.x) % mod;
    return *this;
  }
  mint& operator-=(const mint& b) {
    x = (x - b.x + mod) % mod;
    return *this;
  }
  mint& operator*=(const mint& b) {
    x = (x * b.x) % mod;
    return *this;
  }
  mint& operator/=(const mint& b) {
    x = (x * b.inv().x) % mod;
    return *this;
  }
  bool operator==(const mint& b) const { return x == b.x; }
  bool operator!=(const mint& b) const { return x != b.x; }
};
mint comb[MAXN][MAXN];
void gen_comb(int n) {
  for (int i = 0; i <= n; i++) {
    comb[i][0] = comb[i][i] = 1;
    for (int j = 1; j < i; j++)
      comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
  }
}
string to_string(const mint& x) { return to_string(x.x); }
mint a[MAXN], c[MAXN];
mint dp[MAXN][MAXN][2];
mint dpc[MAXN][MAXN][2];
long long s1(long long l, long long r) {
  if (l > r) return 0;
  return (l + r) * (r - l + 1) / 2;
}
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n, m;
  cin >> n >> m >> mod;
  gen_comb(MAXN - 1);
  a[0] = 0;
  c[0] = 1;
  a[1] = 0;
  c[1] = 2;
  for (auto i = (2); i < (m + 1); i++) {
    mint tmp = 0;
    mint tmpc = 0;
    for (auto l = (0); l < (i); l++) {
      long long r = i - 1 - l;
      tmp += c[l] * c[r] * (s1(1, l) + s1(1, r)) * comb[i - 1][l] +
             (a[l] * c[r] + a[r] * c[l]) * comb[i - 1][l] * (i + 1);
      tmpc += c[l] * c[r] * (i + 1) * comb[i - 1][l];
    }
    a[i] = tmp;
    c[i] = tmpc;
  };
  ;
  ;
  ;
  dpc[0][0][0] = 1;
  for (auto i = (1); i < (n + 1); i++) {
    for (auto j = (0); j < (m + 1); j++) {
      if (j > i) continue;
      dpc[i][j][0] = dpc[i - 1][j][0] + dpc[i - 1][j][1];
      for (auto k = (1); k < (j + 1); k++) {
        dpc[i][j][1] += c[k] * comb[j][k] * dpc[i - k][j - k][0];
      }
    }
  }
  for (auto i = (1); i < (n + 1); i++) {
    for (auto j = (0); j < (m + 1); j++) {
      if (j > i) continue;
      dp[i][j][0] = dp[i - 1][j][0] + dp[i - 1][j][1];
      for (auto k = (1); k < (j + 1); k++) {
        dp[i][j][1] += a[k] * comb[j][k] * dpc[i - k][j - k][0] +
                       dp[i - k][j - k][0] * c[k] * comb[j][k];
      }
    }
  }
  cout << (dp[n][m][0] + dp[n][m][1]).x << endl;
  return 0;
}
