#P7631. [2018年杭电多校]Rikka with Seam
[2018年杭电多校]Rikka with Seam
Rikka with Seam
Problem Description
Input
The first line contains a single integer , the numebr of testcases. For each testcase, the first line contains three numbers $n,m,K(2 \leq n,m \leq 2 \times 10^3, 1\leq K \leq m)$. Then lines follow, each line contains a 01 string of length which describes one row of the matrix. The input guarantees that there are at most testcases with .
Output
For each testcase, output a single line with a single number, the answer modulo .
Sample Input
3
2 2 1
00
10
5 5 1
00100
10101
00100
01000
11101
5 5 2
00100
10101
00100
01000
11101
Sample Output
2
70
199
Source
2018 Multi-University Training Contest 9