10992: Fluorescent 2
[Creator : ]
Description
In ICPCCamp, there are $n$ switches and $m$ bulbs.The $m$ bulbs are
Bobo knows in advance an $n \times m$ binary matrix $C_{i, j}$. When the $i$-th switch is pressed, all the bulbs $j$ satisfying $C_{i, j}= 1$ flip its state between
Let $f(S)$ be the number of bulbs staying
ON
at the beginning. Bobo knows in advance an $n \times m$ binary matrix $C_{i, j}$. When the $i$-th switch is pressed, all the bulbs $j$ satisfying $C_{i, j}= 1$ flip its state between
ON
and OFF
. Let $f(S)$ be the number of bulbs staying
ON
after the switches in set $S$ is pressed. Find the sum of $f(S)^3$ (cubic of $f(S)$) modulo ($10^9+7$) over all $2^n$ possible choices of $S$. Input
The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains two integers $n, m$.
The $i$-th of the following $n$ lines contains $m$ integers $C_{i, 1}, C_{i, 2}, ..., C_{i, m}$.
The first line of each test case contains two integers $n, m$.
The $i$-th of the following $n$ lines contains $m$ integers $C_{i, 1}, C_{i, 2}, ..., C_{i, m}$.
Output
For each test case, print an integer which denotes the result.
Constraints
$1 ≤ n ≤ 50$
$1 ≤ m ≤ 1000$
$C_{i, j}\in \{0, 1\}$
The number of test cases does not exceed $500$
The number of test cases with $m > 50$ does not exceed $1$.
$1 ≤ m ≤ 1000$
$C_{i, j}\in \{0, 1\}$
The number of test cases does not exceed $500$
The number of test cases with $m > 50$ does not exceed $1$.
Sample 1 Input
2 2
01
10
2 3
110
011
Sample 1 Output
10
30
For the first sample, there are $2^2= 4$ choices of $S$.
* $S = \emptyset,\ f(S) = 2,\ f(S)^3 = 8$.
* $S = \{1\},\ f(S) = 1,\ f(S)^3 = 1$.
* $S = \{2\},\ f(S) = 1,\ f(S)^3 = 1$.
* $S = \{1, 2\},\ f(S) = 0,\ f(S)^3 = 0$.
Thus, the result is $8 + 1 + 1 + 0 = 10$.
* $S = \emptyset,\ f(S) = 2,\ f(S)^3 = 8$.
* $S = \{1\},\ f(S) = 1,\ f(S)^3 = 1$.
* $S = \{2\},\ f(S) = 1,\ f(S)^3 = 1$.
* $S = \{1, 2\},\ f(S) = 0,\ f(S)^3 = 0$.
Thus, the result is $8 + 1 + 1 + 0 = 10$.