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>

using namespace std;

typedef long long ll;

int MOD;

ll pow_mod(ll x,int k) {
  ll ans=1;
  while (k) {
  	if (k&1) ans=ans*x%MOD;
  	x=x*x%MOD;
  	k>>=1;
  }
  return ans;
}

inline void update(int &x,ll y) {
  x=(x+y)%MOD;
}

ll powd[105][10005],facd[105],facv[105];

void pre(int n,int m,int k) {
  for(int i=0;i<=k;i++) {
  	powd[i][0]=1;
  	for(int j=1;j<=n*m;j++) powd[i][j]=powd[i][j-1]*i%MOD;
  }
  facd[0]=1;
  for(int i=1;i<=max(n,m);i++) facd[i]=facd[i-1]*i%MOD;
  facv[max(n,m)]=pow_mod(facd[max(n,m)],MOD-2);
  for(int i=max(n,m)-1;i>=0;i--) facv[i]=facv[i+1]*(i+1)%MOD;
}

int f[2][105][105];
ll trans[105][105];

int main() {
  int n,m,K;
  scanf("%d%d%d%d",&n,&m,&K,&MOD);
  pre(n,m,K);
  int cur=0;
  f[0][0][0]=1;
  for(int i=1;i<=K;i++) {
  	cur^=1;
  	memset(f[cur],0,sizeof(f[cur]));
  	for(int j=0;j<=n;j++)
  	  for(int k=0;k<=m;k++) trans[j][k]=facv[j]*powd[i][j*(m-k)]%MOD*powd[K-i+1][j*k]%MOD;
  	for(int j=0;j<=n;j++)
  	for(int k=0;k<=m;k++)
  	for(int l=0;l<=j;l++)
  	    update(f[cur][j][k],f[cur^1][j-l][k]*trans[l][k]);
  	cur^=1;
  	memset(f[cur],0,sizeof(f[cur]));
  	for(int j=0;j<=m;j++)
  	  for(int k=0;k<=n;k++) trans[j][k]=facv[j]*powd[i][j*(n-k)]%MOD*powd[K-i+1][j*k]%MOD;
  	for(int j=0;j<=n;j++)
  	for(int k=0;k<=m;k++)
  	for(int l=0;l<=k;l++)
  	    update(f[cur][j][k],f[cur^1][j][k-l]*trans[l][j]);
  	cur^=1;
  	memset(f[cur],0,sizeof(f[cur]));
  	for(int j=0;j<=n;j++)
  	  for(int k=0;k<=m;k++) trans[j][k]=facv[j]*powd[i][j*(m-k)]%MOD*powd[K-i][j*k]%MOD*((j&1)?MOD-1:1)%MOD;
  	for(int j=0;j<=n;j++)
  	for(int k=0;k<=m;k++)
  	for(int l=0;l<=j;l++)
  	    update(f[cur][j][k],f[cur^1][j-l][k]*trans[l][k]);
  	cur^=1;
  	memset(f[cur],0,sizeof(f[cur]));
  	for(int j=0;j<=m;j++)
  	  for(int k=0;k<=n;k++) trans[j][k]=facv[j]*powd[i][j*(n-k)]%MOD*powd[K-i][j*k]%MOD*((j&1)?MOD-1:1)%MOD;
  	for(int j=0;j<=n;j++)
  	for(int k=0;k<=m;k++)
  	for(int l=0;l<=k;l++)
  	    update(f[cur][j][k],f[cur^1][j][k-l]*trans[l][j]);
  }
  printf("%lld\n",f[cur][n][m]*facd[n]%MOD*facd[m]%MOD);
  return 0;
}