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>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

unsigned int mod = 1;
struct ModInt{
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;

	uint v;
	ModInt():v(0){}
	ModInt(ll _v):v(normS(_v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ModInt& operator++(int){ return *this=*this+1;}
	ModInt& operator--(int){ return *this=*this-1;}
	ll extgcd(ll a,ll b,ll &x,ll &y) const{
		ll p[]={a,1,0},q[]={b,0,1};
		while(*q){
			ll t=*p/ *q;
			rep(i,3) swap(p[i]-=t*q[i],q[i]);
		}
		if(p[0]<0) rep(i,3) p[i]=-p[i];
		x=p[1],y=p[2];
		return p[0];
	}
	ModInt inv() const {
		ll x,y;
		extgcd(v,mod,x,y);
		return make(normS(x+mod));
	}
	ModInt pow(ll p) const {
		if(p<0) return inv().pow(-p);
		ModInt a = 1;
		ModInt x = *this;
		while(p){
			if(p&1) a *= x;
			x *= x;
			p >>= 1;
		}
		return a;
	}
	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt;
V<mint> fact,ifact;

void InitFact(int N){
	fact.resize(N);
	ifact.resize(N);
	fact[0] = 1;
	rep1(i,N-1) fact[i] = fact[i-1] * i;
	ifact[N-1] = fact[N-1].inv();
	for(int i=N-2;i>=0;i--) ifact[i] = ifact[i+1] * (i+1);
}

mint pw[101][10001];
int bsr(int x) { return 31 - __builtin_clz(x); }
using D = double;
const D pi = acos(-1);
using Pc = complex<D>;

void fft(bool type, vector<Pc> &c){	//multiply : false -> mult -> true
	static vector<Pc> buf[30];
	int N = c.size();
	int s = bsr(N);
	assert(1<<s == N);
	if(buf[s].empty()){
		buf[s]=vector<Pc>(N);
		rep(i,N) buf[s][i] = polar<D>(1,i*2*pi/N);
	}
	vector<Pc> a(N),b(N);
	copy(begin(c),end(c),begin(a));
	rep1(i,s){
		int W = 1<<(s-i);
		for(int y=0;y<N/2;y+=W){
			Pc now = buf[s][y];
			if(type) now = conj(now);
			rep(x,W){
				auto l =       a[y<<1 | x];
				auto r = Pc(now.real() * a[y<<1 |x | W].real() - now.imag() * a[y<<1 |x | W].imag(), now.real() * a[y<<1 |x | W].imag() + now.imag() * a[y<<1 |x | W].real());
				b[y | x]        = l+r;
				b[y | x | N>>1] = l-r;
			}
		}
		swap(a,b);
	}
	copy(begin(a),end(a),begin(c));
}


/*
	long long/mint 用
	最後roundしてキャストする
*/

vector<Pc> b0[2],b1[2];

template<class Mint>
vector<Mint> multiply_fft(const vector<Mint>& x,int which){
	const int B = 15;
	const int K = 2;
	int S = x.size();
	int N = 1; while(N<S) N*=2;
	vector<Pc> a[K],b[K];
	rep(t,K){
		a[t] = vector<Pc>(N);
		rep(i,x.size()) a[t][i] = Pc( (x[i].v >> (t*B)) & ((1<<B)-1) , 0 );
		fft(false,a[t]);

		if(which == 0) b[t] = b0[t];
		else b[t] = b1[t];
	}
	vector<Mint> z(S);
	vector<Pc> c(N);
	Mint base = 1;
	rep(t,K+K-1){
		fill_n(begin(c),N,Pc(0,0));
		rep(xt,K){
			int yt = t-xt;
			if(0<=yt && yt<K){
				rep(i,N) c[i] += a[xt][i] * b[yt][i];
			}
		}
		fft(true,c);
		rep(i,S){
			c[i] *= 1.0/N;
			z[i] += Mint(ll(round(c[i].real()))) * base;
		}
		base *= 1<<B;
	}
	return z;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int H,W,K;
	cin >> H >> W >> K >> mod;

	rep(i,101){
		pw[i][0] = 1;
		rep1(j,10000) pw[i][j] = pw[i][j-1] * i;
	}
	InitFact(1000);

 	mint cur[101][101] = {};
	mint nxt[101][101] = {};
	cur[0][0] = 1;

	{
		const int X = 201;
		V<mint> f(X*X);
		rep(i,H+1) rep(j,W+1){
			f[i*X+j] = ifact[i] * ifact[j];
		}

		const int B = 15;
		const int K = 2;
		int S = f.size();
		int N = 1; while(N<S) N*=2;
		vector<Pc> b[K];
		rep(t,K){
			b[t] = vector<Pc>(N);
			rep(i,f.size()) b[t][i] = Pc( (f[i].v >> (t*B)) & ((1<<B)-1) , 0 );
			fft(false,b[t]);
			b0[t] = b[t];
		}
	}
	{
		const int X = 201;
		V<mint> f(X*X);
		rep(i,H+1) rep(j,W+1){
			f[i*X+j] = ifact[i] * ifact[j] * ((i+j)&1 ? -1 : 1);
		}

		const int B = 15;
		const int K = 2;
		int S = f.size();
		int N = 1; while(N<S) N*=2;
		vector<Pc> b[K];
		rep(t,K){
			b[t] = vector<Pc>(N);
			rep(i,f.size()) b[t][i] = Pc( (f[i].v >> (t*B)) & ((1<<B)-1) , 0 );
			fft(false,b[t]);
			b1[t] = b[t];
		}
	}

	rep(t,K){
		rep(a,H+1) rep(b,W+1) cur[a][b] = cur[a][b] * fact[H-a] * fact[W-b] / pw[K-t][a*b] * pw[t+1][(H-a) * (W-b)];
		{
			const int B = 201;
			V<mint> f(B*B);
			rep(i,H+1) rep(j,W+1){
				f[i*B+j] = cur[i][j];
			}
			auto h = multiply_fft(f,0);
			rep(a,H+1) rep(b,W+1) nxt[a][b] = h[a*B+b];

		}
		rep(c,H+1) rep(d,W+1) nxt[c][d] *= ifact[H-c] * ifact[W-d] * pw[K-t][c*d] / pw[t+1][(H-c) * (W-d)];
		rep(a,H+1) rep(b,W+1) cur[a][b] = nxt[a][b], nxt[a][b] = 0;

		if(t == K-1){
			rep(a,H+1) rep(b,W+1) nxt[a][b] = cur[a][b];
		}else{
			rep(a,H+1) rep(b,W+1) cur[a][b] = cur[a][b] * fact[H-a] * fact[W-b] / pw[K-t-1][a*b] * pw[t+1][(H-a) * (W-b)];
			{
				const int B = 201;
				V<mint> f(B*B);
				rep(i,H+1) rep(j,W+1){
					f[i*B+j] = cur[i][j];
				}
				auto h = multiply_fft(f,1);
				rep(a,H+1) rep(b,W+1) nxt[a][b] = h[a*B+b];

			}
			rep(c,H+1) rep(d,W+1) nxt[c][d] *= ifact[H-c] * ifact[W-d] * pw[K-t-1][c*d] / pw[t+1][(H-c) * (W-d)];
		}
		rep(a,H+1) rep(b,W+1) cur[a][b] = nxt[a][b], nxt[a][b] = 0;

	}
	cout << cur[H][W] << endl;

}