from collections import * N, M, P = map(int, input().split()) def conv(a, b): res = [0] * (len(a) + len(b) - 1) for i in range(len(a)): for j in range(len(b)): res[i + j] = (res[i + j] + a[i] * b[j] % P) % P return res n = min(1000000, P - 1) fact = [1 for i in range(n + 1)] for i in range(1, n + 1): fact[i] = fact[i - 1] * i % P fact_inv = [1 for i in range(n + 1)] fact_inv[-1] = pow(fact[-1], P - 2, P) for i in range(n, 0, -1): fact_inv[i - 1] = fact_inv[i] * i % P def binom(n, r): if n < r or n < 0 or r < 0: return 0 res = fact_inv[n - r] * fact_inv[r] % P res *= fact[n] res %= P return res F = deque([[1, i] for i in range(1, N + 1)]) for i in range(N - 1): f = F.popleft() g = F.popleft() h = conv(f, g) while len(h) > M + 1: h.pop() F.append(h) f = F[0][:] ans = 0 for i in range(1, M + 1): res = fact[M - i] * binom(M, i) % P res = res * binom(N - i, M - i) % P res = res * f[i] % P ans = (ans + res) % P X = fact[N] * fact_inv[N - M] % P print(ans * pow(X, P - 2, P) % P)