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:
/*
Author: QAQAutomaton
Lang: C++
Code: F.cpp
Mail: lk@qaq-am.com
Blog: https://www.qaq-am.com/
*/
#include<bits/stdc++.h>
#define int long long
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cp;
typedef pair<int,int> pii;
int inf;
const double eps=1e-8;
const double pi=acos(-1.0);
template<class T,class T2>int chkmin(T &a,T2 b){return a>b?a=b,1:0;}
template<class T,class T2>int chkmax(T &a,T2 b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T,class T2>T mmin(T a,T2 b){return a<b?a:b;}
template<class T,class T2>T mmax(T a,T2 b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
template<class T>int dcmp(T a,T b){return a>b;}
template<int *a>int cmp_a(int x,int y){return a[x]<a[y];}
#define min mmin
#define max mmax
#define abs aabs
struct __INIT__{
	__INIT__(){
		memset(&inf,0x3f,sizeof(inf));
	}
}__INIT___;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	template<typename A>
	inline bool read (A &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;else if(c==EOF)return 0;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
		return 1;
	}
	inline bool read (char &x) {
		while((x=gc())==' '||x=='\n' || x=='\r');
		return x!=EOF;
	}
	inline bool read(char *x){
		while((*x=gc())=='\n' || *x==' '||*x=='\r');
		if(*x==EOF)return 0;
		while(!(*x=='\n'||*x==' '||*x=='\r'||*x==EOF))*(++x)=gc();
		*x=0;
		return 1;
	}
	template<typename A,typename ...B>
	inline bool read(A &x,B &...y){
		return read(x)&&read(y...);
	}
	template<typename A>
	inline bool write (A x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
		return 0;
	}
	inline bool write (char x) {
		putc(x);
		return 0;
	}
	inline bool write(const char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	inline bool write(char *x){
		while(*x){putc(*x);++x;}
		return 0;
	}
	template<typename A,typename ...B>
	inline bool write(A x,B ...y){
		return write(x)||write(y...);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: read;
using io :: putc;
using io :: write;
int n,m,k,p;	
int f[105][105];
int inv[10005],fac[10005],invf[10005];
int pw[105][10005],ipw[105][10005];
typedef __uint128_t L;
struct FastMod {
	ull b, m;
	FastMod(ull b) : b(b), m(ull((L(1) << 64) / b)) {}
	ull reduce(ull a) {
		ull q = (ull)((L(m) * a) >> 64);
		ull r = a - q * b; // can be proven that 0 <= r < 2*b
		return r >= b ? r - b : r;
	}
};
FastMod F(1);

void calc(int x,int y,int o,int k){
	/*
	for(int i=1;i<=x;++i){
		int w=0;
		for(int j=0;j<=i;++j)w=(w+(j&1?p-1:1)*pw[o][y*(i-j)]%p*pw[o-1][y*j]%p*invf[j]%p*invf[i-j])%p;
		//i,y
		f[x][y]=(f[x][y]+f[x-i][y]*w%p*pw[k][i*(m-y)])%p;
	}
	for(int j=1;j<=y;++j){
		int w=0;
		for(int k=0;k<=j;++k)w=(w+(k&1?p-1:1)*pw[o][x*(j-k)]%p*pw[o-1][x*k]%p*invf[k]%p*invf[j-k]%p)%p;
		f[x][y]=(f[x][y]+f[x][y-j]%p*w%p*pw[k][j*(n-x)])%p;
	}
	*/
	int nf=0;
	for(int i=0;i<=x;++i){
		for(int j=0;j<=y;++j){
			int w=0;	
			for(int k=0;k<=i;++k)for(int l=0;l<=j;++l){
				w=(w+((k+l)&1?p-1:1)*pw[o][(x-k)*(y-l)-(x-i)*(y-j)]%p*pw[o-1][x*y-(x-k)*(y-l)]%p*invf[k]%p*invf[i-k]%p*invf[l]%p*invf[j-l])%p;
			}
			nf=(nf+f[x-i][y-j]*w%p*pw[k][(n-x+i)*(m-y+j)])%p;
		}
	}
	f[x][y]=nf*ipw[k][(n-x)*(m-y)]%p;
}
void calc(int k,int o){
	for(int i=n;~i;--i)for(int j=m;~j;--j){
		f[i][j]=F.reduce(f[i][j]*pw[k][(n-i)*(m-j)]);
	}
	for(int i=n;~i;--i)for(int j=m;~j;--j){
		int s=0;
		for(int l=0;l<=i;++l){
			s=F.reduce(s+F.reduce(f[i-l][j]*pw[o][l*j])*invf[l]);
		}
		f[i][j]=s;
	}
	for(int i=n;~i;--i)for(int j=m;~j;--j){
		int s=0;
		for(int l=0;l<=j;++l){
//			s=(s+f[i][j-l]*pw[o][l*i]%p*invf[l])%p;
			s=F.reduce(s+F.reduce(f[i][j-l]*pw[o][l*i])*invf[l]);
		}
		f[i][j]=s;
	}
	for(int i=n;~i;--i)for(int j=m;~j;--j){
		int s=0;
		for(int l=0;l<=i;++l){
			if(l&1){
				s-=F.reduce(F.reduce(f[i-l][j]*pw[o-1][l*j])*invf[l]);
				if(s<0)s+=p;
			}
			else{
				s+=F.reduce(F.reduce(f[i-l][j]*pw[o-1][l*j])*invf[l]);
				if(s>=p)s-=p;
			}
//			s=(s+(l&1?1:p-1)*f[i-l][j]%p*pw[o-1][l*j]%p*invf[l])%p;
		}
		f[i][j]=s;
	}
	for(int i=n;~i;--i)for(int j=m;~j;--j){
		int s=0;
		for(int l=0;l<=j;++l){
			if(l&1){
				s-=F.reduce(F.reduce(f[i][j-l]*pw[o-1][l*i])*invf[l]);
				if(s<0)s+=p;
			}
			else{
				s+=F.reduce(F.reduce(f[i][j-l]*pw[o-1][l*i])*invf[l]);
				if(s>=p)s-=p;
			}
			//s=(s+(l&1?1:p-1)*f[i][j-l]%p*pw[o-1][l*i]%p*invf[l])%p;
		}
		f[i][j]=s;
	}


	for(int i=n;~i;--i)for(int j=m;~j;--j){
		f[i][j]=F.reduce(f[i][j]*ipw[k][(n-i)*(m-j)]);
	}
}
signed main(){
#ifdef QAQAutoMaton 
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
	read(n,m,k,p);
	F=FastMod(p);
	int s=max(n*m,k);
	f[0][0]=1;
	fac[0]=fac[1]=inv[1]=invf[0]=invf[1]=1;
	for(int i=2;i<=s;++i){
		fac[i]=F.reduce(fac[i-1]*i);
		inv[i]=F.reduce((p-p/i)*inv[p%i]);
		invf[i]=F.reduce(inv[i]*invf[i-1]);
	}
	for(int i=0;i<=k;++i){
		pw[i][0]=1;
		for(int j=1;j<=s;++j)pw[i][j]=F.reduce(pw[i][j-1]*i);
		ipw[i][0]=1;
		for(int j=1;j<=s;++j)ipw[i][j]=F.reduce(ipw[i][j-1]*inv[i]);
	}
	f[0][0]=1;
	for(int i=1;i<=k;++i){
		calc(i,k+1-i);
		/*
		for(int j=n;~j;--j)
			for(int l=m;~l;--l)
				calc(j,l,k+1-i,i);*/
	}
	write(F.reduce(F.reduce(f[n][m]*fac[n])*fac[m]),'\n');
	return 0;
}