Local Maxima

아직 제출이 없습니다시간 제한4초메모리 제한512 MB

문제

Given an n×mn \times m integer matrix AA, a local maximum of AA is a location (i,j)(i, j) (1in1 \le i \le n and 1jm1 \le j \le m) such that A_i,jA\_{i, j} is no smaller than any other integer on the ii-th row or on the jj-th column.

For example, in the 3×33 \times 3 matrix [254 216 222],\begin{bmatrix} 2 & 5 & 4 \\\ 2 & 1 & 6 \\\ 2 & 2 & 2 \end{bmatrix}\text{,} there are three local maxima: locations (1,2)(1, 2), (2,3)(2, 3), and (3,1)(3, 1) with values 55, 66, and 22, repectively.

An n×mn \times m integer matrix AA is good if and only if it satisfies the following two conditions:

  • There is exactly one local maximum in AA.
  • Each integer from 11 to n×mn \times m occurs exactly once in AA.

Given nn, mm, and a prime number PP, your task is to count the number of good matrices of size n×mn \times m modulo PP.

입력

The first line contains three integers, nn, mm, and PP, where 1n,m30001 \le n, m \le 3000 and 108P109+710^8 \le P \le 10^9 + 7. It is guaranteed that PP is prime.

출력

Output a single line with a single integer: the number of good matrices modulo PP.