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<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
int n,m,k;
ll f[105][105],c[105][105],MOD,pw[105][10005];
ll pw1n[105][105][105],pw1m[105][105][105],pw2n[105][105][105],pw2m[105][105][105];
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
int main()
{
	scanf("%d%d%d%lld",&n,&m,&k,&MOD);
	for(int i=1;i<=k;i++)
	{
		pw[i][0]=1;
		for(int j=1;j<=n*m;j++)pw[i][j]=pw[i][j-1]*i%MOD;
	}
	for(int i=0;i<=k;i++)
	{
		for(int x=0;x<=n;x++)
		for(int y=0;y<=m;y++)
		{
			pw1n[i][x][y]=pw[i][x*y]*pw[k-i+1][x*(m-y)]%MOD;
			pw1m[i][y][x]=pw[i][y*x]*pw[k-i+1][y*(n-x)]%MOD;
			pw2n[i][x][y]=pw[i][x*y]*pw[k-i][x*(m-y)]%MOD;
			pw2m[i][y][x]=pw[i][y*x]*pw[k-i][y*(n-x)]%MOD;
		}
	}
	c[0][0]=1;
	for(int i=0;i<=100;i++)
	for(int j=0;j<=100;j++)
	{
		if(c[i][j]>=MOD)c[i][j]-=MOD;
		c[i+1][j+1]+=c[i][j];
		c[i+1][j]+=c[i][j];
	}
	f[0][0]=1;
	for(int i=1;i<=k;i++)
	{
		for(int x=n;x>=0;x--)
		for(int y=m;y>=0;y--)
		{
			for(int j=1;j<=x;j++)
			{
				f[x][y]=(f[x][y]+f[x-j][y]*c[n-x+j][j]%MOD*pw1n[k-i+1][j][y])%MOD;
			}
		}
		for(int x=n;x>=0;x--)
		for(int y=m;y>=0;y--)
		{
			for(int j=1;j<=y;j++)
			{
				f[x][y]=(f[x][y]+f[x][y-j]*c[m-y+j][j]%MOD*pw1m[k-i+1][j][x])%MOD;
			}
		}
		for(int x=n;x>=0;x--)
		for(int y=m;y>=0;y--)
		{
			for(int j=1;j<=x;j++)
			{
				if(j&1)f[x][y]=(f[x][y]-f[x-j][y]*c[n-x+j][j]%MOD*pw2n[k-i][j][y])%MOD;
				else f[x][y]=(f[x][y]+f[x-j][y]*c[n-x+j][j]%MOD*pw2n[k-i][j][y])%MOD;
			}
		}
		for(int x=n;x>=0;x--)
		for(int y=m;y>=0;y--)
		{
			for(int j=1;j<=y;j++)
			{
				if(j&1)f[x][y]=(f[x][y]-f[x][y-j]*c[m-y+j][j]%MOD*pw2m[k-i][j][x])%MOD;
				else f[x][y]=(f[x][y]+f[x][y-j]*c[m-y+j][j]%MOD*pw2m[k-i][j][x])%MOD;
			}
		}
	}
	if(f[n][m]<0)f[n][m]+=MOD;
	printf("%lld\n",f[n][m]);
	return 0;
}