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