#cf16exhibitionfinalh. [cf16_exhibition_final_h]AB=C Problem
[cf16_exhibition_final_h]AB=C Problem
Problem Statement
#nck { width: 30px; height: auto; }
Snuke received two matrices and as birthday presents. Each of the matrices is an by matrix that consists of only and .
Then he computed the product of the two matrices, . Since he performed all computations in modulo two, was also an by matrix that consists of only and . For each , you are given , the -element of the matrix .
However, Snuke accidentally ate the two matrices and , and now he only knows . Compute the number of possible (ordered) pairs of the two matrices and , modulo .
Constraints
- is either or .
Input
The input is given from Standard Input in the following format:
:
Output
Print the number of possible (ordered) pairs of two matrices and (modulo ).
Sample Input 1
2
0 1
1 0
Sample Output 1
6
Sample Input 2
10
1 0 0 1 1 1 0 0 1 0
0 0 0 1 1 0 0 0 1 0
0 0 1 1 1 1 1 1 1 1
0 1 0 1 0 0 0 1 1 0
0 0 1 0 1 1 1 1 1 1
1 0 0 0 0 1 0 0 0 0
1 1 1 0 1 0 0 0 0 1
0 0 0 1 0 0 1 0 1 0
0 0 0 1 1 1 0 0 0 0
1 0 1 0 0 1 1 1 1 1
Sample Output 2
741992411