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<iostream>
#define RI int
#define CI const int&
using namespace std;
const int N=105;
int n,m,s,mod,ans,C[N][N],f[N][N][N][2],coef[N][N][N][2];
inline void inc(int& x,CI y)
{
	if ((x+=y)>=mod) x-=mod;
}
inline int sum(CI x,CI y)
{
	int t=x+y; return t>=mod?t-mod:t;
}
inline int sub(CI x,CI y)
{
	int t=x-y; return t<0?t+mod:t;
}
inline int quick_pow(int x,int p=mod-2,int mul=1)
{
	for (;p;p>>=1,x=1LL*x*x%mod) if (p&1) mul=1LL*mul*x%mod; return mul;
}
int main()
{
	RI i,j,k,l; scanf("%d%d%d%d",&n,&m,&s,&mod);
	for (C[0][0]=i=1;i<=max(n,m);++i) for (C[i][0]=j=1;j<=i;++j)
	C[i][j]=sum(C[i-1][j],C[i-1][j-1]);
	for (k=1;k<=s;++k) for (i=0;i<=m;++i)
	{
		int cur=1LL*quick_pow(s-k+1,i)*sub(quick_pow(k,m-i),quick_pow(k-1,m-i))%mod;
		for (coef[k][i][0][0]=j=1;j<=n;++j) coef[k][i][j][0]=1LL*coef[k][i][j-1][0]*cur%mod;
	}
	//for (k=1;k<=s;++k) for (i=0;i<=m;++i) for (j=0;j<=n;++j)
	//printf("%d ",coef[k][i][j][0]); putchar('\n');
	for (k=1;k<=s;++k) for (i=0;i<=n;++i)
	{
		int cur=1LL*quick_pow(k,n-i)*sub(quick_pow(s-k+1,i),quick_pow(s-k,i))%mod;
		for (coef[k][i][0][1]=j=1;j<=m;++j) coef[k][i][j][1]=1LL*coef[k][i][j-1][1]*cur%mod;
	}
	//for (k=1;k<=s;++k) for (i=0;i<=m;++i) for (j=0;j<=n;++j)
	//printf("%d ",coef[k][i][j][1]); putchar('\n');
	for (f[1][0][0][0]=k=1;k<=s;++k) for (i=0;i<=n;++i) for (j=0;j<=m;++j)
	{
		for (l=0;l<=n-i;++l)
		inc(f[k][i+l][j][1],1LL*f[k][i][j][0]*C[n-i][l]%mod*coef[k][j][l][0]%mod);
		for (l=0;l<=m-j;++l)
		inc(f[k+1][i][j+l][0],1LL*f[k][i][j][1]*C[m-j][l]%mod*coef[k][i][l][1]%mod);
	}
	return printf("%d",f[s+1][n][m][0]),0;
}