ll@N,@M,@P,K=N+1;modint U[K]={1,1},F[K]={1,1},E[K]={1,1},Q[2][9601]={},a=0,t;a.setmod(P);rep(i,2,K)U[i]=-P/i*U[P%i],F[i]=F[i-1]*i,E[i]=E[i-1]*U[i];rep(j,1,M+1){rep(n,1,K)Q[j%2][n]=j<2?t=n*(n+1)/2:Q[j%2][n-1]+Q[1-j%2][n-1]*n;a+=Q[j%2][N]*E[j]*E[M-j]*F[N-j];}wt(a*F[M]*E[N]);