Problem: For each of the K^{NM} ways to write an integer between 1 and K (inclusive) in every square in a square grid with N rows and M columns, find the value defined below, then compute the sum of all those K^{NM} values, modulo D.

* For each of the NM squares, find the minimum among the N+M-1 integers written in the square's row or the square's column. The value defined for the grid is the product of all these NM values.

Constraints

* 1 \leq N,M,K \leq 100
* 10^8 \leq D \leq 10^9
* N,M,K, and D are integers.
* D is prime.

Input

Input is given from Standard Input in the following format:


N M K D


Output

Print the sum of the K^{NM} values, modulo D.

Examples

Input

2 2 2 998244353


Output

35


Input

2 3 4 998244353


Output

127090


Input

31 41 59 998244353


Output

827794103

Solution (in CPP):

Solution:
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
#define N 110
using namespace std;
ll fac[N*N],inv[N*N],f[2][N][N],g[N][N],mod,mul[N][N*N];
int n,m,k;
ll ksm(ll a,ll b=mod-2)
{
	if(b==0) return 1;
	if(b==1) return a;
	ll q=ksm(a,b>>1);
	if(b&1) return q*q%mod*a%mod;
	return q*q%mod;
}
int main()
{
	scanf("%d%d%d%lld",&n,&m,&k,&mod);
	for(int i=0;i<=k;i++)
	{
		mul[i][0]=1;
		for(int j=1;j<=n*m;j++) mul[i][j]=mul[i][j-1]*i%mod;
	}
	int nm=max(n,m);
	fac[0]=1;
	for(int i=1;i<=nm;i++) fac[i]=fac[i-1]*i%mod;
	inv[nm]=ksm(fac[nm]);
	for(int i=nm-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
	int u=0,p=1;
	f[u][0][0]=1;
	for(int l=1;l<=k;l++)
	{
		u^=1,p^=1;
		memset(f[u],0,sizeof(f[u]));
		for(int i=0;i<=n;i++)
			for(int j=0;j<=m;j++)
			if(i&1) g[i][j]=inv[i]*mul[l-1][i*(m-j)]%mod*mul[k-l+1][i*j]%mod*(mod-1)%mod;
			else g[i][j]=inv[i]*mul[l-1][i*(m-j)]%mod*mul[k-l+1][i*j]%mod;
		for(int i=0;i<=n;i++)
			for(int j=0;j<=m;j++)
				for(int k=0;k<=i;k++)
				(f[u][i][j]+=f[p][i-k][j]*g[k][j]%mod)%=mod;
		
		u^=1,p^=1;
		memset(f[u],0,sizeof(f[u]));
		for(int i=0;i<=m;i++)
			for(int j=0;j<=n;j++)
			if(i&1) g[i][j]=inv[i]*mul[l-1][i*(n-j)]%mod*mul[k-l+1][i*j]%mod*(mod-1)%mod;
			else g[i][j]=inv[i]*mul[l-1][i*(n-j)]%mod*mul[k-l+1][i*j]%mod;
		for(int i=0;i<=n;i++)
			for(int j=0;j<=m;j++)
				for(int k=0;k<=j;k++)
				(f[u][i][j]+=f[p][i][j-k]*g[k][i]%mod)%=mod;
		
		u^=1,p^=1;
		memset(f[u],0,sizeof(f[u]));
		for(int i=0;i<=n;i++)
			for(int j=0;j<=m;j++)
			g[i][j]=inv[i]*mul[l][i*(m-j)]%mod*mul[k-l+1][i*j]%mod;
		for(int i=0;i<=n;i++)
			for(int j=0;j<=m;j++)
				for(int k=0;k<=i;k++)
				(f[u][i][j]+=f[p][i-k][j]*g[k][j]%mod)%=mod;
		
		u^=1,p^=1;
		memset(f[u],0,sizeof(f[u]));
		for(int i=0;i<=m;i++)
			for(int j=0;j<=n;j++)
			g[i][j]=inv[i]*mul[l][i*(n-j)]%mod*mul[k-l+1][i*j]%mod;
		for(int i=0;i<=n;i++)
			for(int j=0;j<=m;j++)
				for(int k=0;k<=j;k++)
				(f[u][i][j]+=f[p][i][j-k]*g[k][i]%mod)%=mod;
	}
	printf("%lld",f[u][n][m]*fac[n]%mod*fac[m]%mod);
	return 0;
}