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<bits/stdc++.h>
clock_t t=clock();
namespace my_std{
	using namespace std;
	#define pii pair<int,int>
	#define fir first
	#define sec second
	#define MP make_pair
	#define rep(i,x,y) for (int i=(x);i<=(y);i++)
	#define drep(i,x,y) for (int i=(x);i>=(y);i--)
	#define go(x) for (int i=head[x];i;i=edge[i].nxt)
	#define templ template<typename T>
	#define sz 111
	typedef long long ll;
	typedef double db;
	ll mod;
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	templ inline T rnd(T l,T r) {return uniform_int_distribution<T>(l,r)(rng);}
	templ inline bool chkmax(T &x,T y){return x<y?x=y,1:0;}
	templ inline bool chkmin(T &x,T y){return x>y?x=y,1:0;}
	templ inline void read(T& t)
	{
		t=0;char f=0,ch=getchar();double d=0.1;
		while(ch>'9'||ch<'0') f|=(ch=='-'),ch=getchar();
		while(ch<='9'&&ch>='0') t=t*10+ch-48,ch=getchar();
		if(ch=='.'){ch=getchar();while(ch<='9'&&ch>='0') t+=d*(ch^48),d*=0.1,ch=getchar();}
		t=(f?-t:t);
	}
	template<typename T,typename... Args>inline void read(T& t,Args&... args){read(t); read(args...);}
	char __sr[1<<21],__z[20];int __C=-1,__zz=0;
	inline void Ot(){fwrite(__sr,1,__C+1,stdout),__C=-1;}
	inline void print(register int x)
	{
		if(__C>1<<20)Ot();if(x<0)__sr[++__C]='-',x=-x;
		while(__z[++__zz]=x%10+48,x/=10);
		while(__sr[++__C]=__z[__zz],--__zz);__sr[++__C]='\n';
	}
	void file()
	{
		#ifdef NTFOrz
		freopen("a.in","r",stdin);
		#endif
	}
	inline void chktime()
	{
		#ifdef NTFOrz
		cout<<(clock()-t)/1000.0<<'\n';
		#endif
	}
	ll ksm(ll x,int y){ll ret=1;for (;y;y>>=1,x=x*x%mod) if (y&1) ret=ret*x%mod;return ret;}
	ll inv(ll x){return ksm(x,mod-2);}
//	inline ll mul(ll a,ll b){ll d=(ll)(a*(double)b/mod+0.5);ll ret=a*b-d*mod;if (ret<0) ret+=mod;return ret;}
}
using namespace my_std;

ll fac[sz],_fac[sz];
void init(){_fac[0]=fac[0]=1;rep(i,1,sz-1) _fac[i]=inv(fac[i]=fac[i-1]*i%mod);}
//ll C(int n,int m){return n>=m&&m>=0?fac[n]*_fac[m]%mod*_fac[n-m]%mod;}

int n,m,K;
int pw[sz][sz*sz];
int f[2][sz][sz],w[sz][sz];

int main()
{
	file();
	read(n,m,K,mod);
	init();
	rep(i,0,K) rep(j,0,n*m) pw[i][j]=ksm(i,j);
	int cur=0;
	f[cur][0][0]=1;
	drep(i,K,1)
	{
		cur^=1;
		rep(j,0,n) rep(k,0,m) f[cur][j][k]=0;
		rep(k,0,m) rep(l,0,n) w[k][l]=pw[K-i+1][l*(m-k)]*_fac[l]%mod*pw[i][l*k]%mod;
		rep(j,0,n) rep(k,0,m) rep(l,0,n-j) (f[cur][j+l][k]+=1ll*f[cur^1][j][k]*w[k][l]%mod)%=mod;
		
		cur^=1;
		rep(j,0,n) rep(k,0,m) f[cur][j][k]=0;
		rep(j,0,n) rep(l,0,m) w[j][l]=pw[K-i+1][l*(n-j)]*_fac[l]%mod*pw[i][l*j]%mod;
		rep(j,0,n) rep(k,0,m) rep(l,0,m-k) (f[cur][j][k+l]+=1ll*f[cur^1][j][k]*w[j][l]%mod)%=mod;
		
		if (i!=1){
		cur^=1;
		rep(j,0,n) rep(k,0,m) f[cur][j][k]=0;
		rep(k,0,m) rep(l,0,n) w[k][l]=pw[K-i+1][l*(m-k)]*_fac[l]%mod*((l&1)?mod-1:1)%mod*pw[i-1][l*k]%mod;
		rep(j,0,n) rep(k,0,m) rep(l,0,n-j) (f[cur][j+l][k]+=1ll*f[cur^1][j][k]*w[k][l]%mod)%=mod;}
		
		if (i!=1){
		cur^=1;
		rep(j,0,n) rep(k,0,m) f[cur][j][k]=0;
		rep(j,0,n) rep(l,0,m) w[j][l]=pw[K-i+1][l*(n-j)]*_fac[l]%mod*((l&1)?mod-1:1)%mod*pw[i-1][l*j]%mod;
		rep(j,0,n) rep(k,0,m) rep(l,0,m-k) (f[cur][j][k+l]+=1ll*f[cur^1][j][k]*w[j][l]%mod)%=mod;}
	}
	chktime();
	ll ans=1ll*fac[n]*fac[m]%mod*f[cur][n][m]%mod;
	cout<<ans;
	return 0;
}