Mirko found a matrix with N rows and M columns on the back seat of his car. The first row holds 1,2,…,M, the second row holds M+1,M+2,…,2M, and the same rule continues, so the N-th row holds (N−1)M+1,(N−1)M+2,…,NM.
For N=3 and M=4 the matrix is this one.
The matrix was not interesting enough for Mirko, so K times he picked a row or a column and multiplied every value in it by a non-negative integer. He wants the sum of all values in the final matrix. That sum can be very large, so print it modulo 109+7.