{"raw_statement":[{"iden":"problem statement","content":"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$.\n\n*   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."},{"iden":"constraints","content":"*   $1 \\leq N,M,K \\leq 100$\n*   $10^8 \\leq D \\leq 10^9$\n*   $N,M,K,$ and $D$ are integers.\n*   $D$ is prime."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$ $K$ $D$"},{"iden":"sample input 1","content":"2 2 2 998244353"},{"iden":"sample output 1","content":"35\n\nWe have $1$ way to write integers such that the product of the $NM$ values is $16$, $4$ ways such that the product is $2$, and $11$ ways such that the product is $1$."},{"iden":"sample input 2","content":"2 3 4 998244353"},{"iden":"sample output 2","content":"127090"},{"iden":"sample input 3","content":"31 41 59 998244353"},{"iden":"sample output 3","content":"827794103"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}