#include <bits/stdc++.h>
using namespace std;
const long long maxn = 512;
long long n, m, M;
long long c[maxn][maxn];
long long p[maxn][maxn];
long long me, you;
long long g(long long a, long long b) {
  if (!b) return 1;
  return p[a + 1][b - 1] * p[2][b] % M * (a + 1 - b) % M;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> M;
  for (long long i = 0; i < maxn; i++)
    for (long long j = 0; j <= i; j++)
      if (j)
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % M;
      else
        c[i][j] = 1;
  for (long long i = 0; i < maxn; i++)
    for (long long j = 0; j < maxn; j++)
      if (j)
        p[i][j] = p[i][j - 1] * i % M;
      else
        p[i][j] = 1;
  for (long long i = 2; i <= m; i++)
    for (long long d = 1; d < i; d++) {
      me = d * (d + 1) / 2 * c[i - 1][d] % M * p[d + 1][d - 1] % M *
           g(n + 1 - (d + 1) - 1, i - (d + 1)) % M * p[2][d] % M *
           p[n + 1][m - i] % M * p[2][m - i] % M;
      you = (you + me + me) % M;
    }
  cout << you * (n + 1 - m) % M << endl;
  return 0;
}
