R=range N,M,P=map(int,input().split()) K=N+1 U=[1]*K F=U[:] E=U[:] for i in R(2,K): U[i]=P-P//i*U[P%i]%P F[i],E[i]=F[i-1]*i%P,E[i-1]*U[i]%P Q=[[0]*K,[0]*K] a=0 for j in R(1,M+1): T=Q[j%2] for n in R(1,K):T[n]=[n*(n+1)//2,T[n-1]+Q[1-j%2][n-1]*n][j>1]%P a+=T[N]*E[j]*E[M-j]*F[N-j] print(a*F[M]*E[N]%P)