Snuke received two matrices, A and B, as birthday presents. Each of these matrices is an ( N \times N ) matrix consisting only of 0s and 1s. He computed the product of the two matrices, resulting in matrix ( C ), defined as ( C = AB ). All computations are performed modulo 2, meaning that elements of the resulting matrix ( C ) also consist solely of 0s and 1s.
Given the resulting matrix ( C ), your task is to compute the number of possible ordered pairs of matrices ( (A, B) ) such that their product equals ( C ), modulo ( 10^9 + 7 ).
Input Format
The first line contains an integer ( N ) (1 ≤ ( N ) ≤ 100), the size of the matrices.
The next ( N ) lines each contain ( N ) integers (0 or 1), representing the elements of matrix ( C ).
Output Format
Output a single integer representing the number of valid ordered pairs of matrices ( (A, B) ) such that ( C = AB ), modulo ( 10^9 + 7 ).
Example
Input
text
2
1 0
0 1
Output
text
2
Explanation
In this example, there are two pairs of matrices ( (A, B) ) such that their product results in matrix ( C ).
Solution Directory
Please place your solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.