Professor Zhang has an $n \times m$ zero matrix(i.e. a matrix consisting of all 0s). Professor Zhang changes $k$ elements in the matrix into 1.
Given a permutation $p$ of $\{1,2,3,4\}$, Professor Zhang wants to find the number of such submatrices that:
1. the number of 1s in the submatrix is exactly 4.
2. let the positions of the 1s in the submatrix be $(r_1,c_1),(r_2,c_2),(r_3,c_3),(r_4,c_4)$, then $r_1 < r_2 < r_3 < r_4$ and $(p_i - p_j) \cdot (c_i - c_j) > 0$ for all $1 \le i < j \le 4$.
3. no other submatrices inside the submatrix meet the above two conditions.