#include<bits/stdc++.h>
const int maxn = 1010;
typedef long long ll;
int n, k, mod;
int g[maxn], f[maxn];
int C[maxn][maxn];
inline void reduce(int & x){ x += x >> 31 & mod; }
inline void exp(int * g) {
	memcpy(f, g, sizeof f);
	for(int i = 0;i <= n + 1;++i) {
		for(int j = 0;j < i;++j) {
			g[i] = (g[i] + (ll) f[j] * g[i - j - 1] % mod * C[i][j]) % mod;
		}
	}
}
int main() {
	std::cin >> n >> k >> mod;
	for(int i = 0;i < maxn;++i) for(int j = C[i][0] = 1;j <= i;++j)
		reduce(C[i][j] = C[i - 1][j] + C[i - 1][j - 1] - mod);
	std::fill(g, g + n + 2, 1);
	for(int i = 1;i < k;++i) exp(g);
	std::cout << g[n] << '\n';
}
