QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB
[0]

# 3759. Parity of Tuples (Easy)

Statistics

Bobo has n m-tuple v1,v2,,vn, where vi=(ai,1,ai,2,,ai,m). He wants to find count(x) which is the number of vi where ai,jx has odd number of ones in its binary notation for all j. Note that denotes the bitwise-and.

Find 2k1x=0count(x)3x modulo (109+7) for given k.

Input

The input consists of several test cases and is terminated by end-of-file.

The first line of each test case contains three integers n, m and k.

The ith of the following n lines contains m integers ai,1,ai,2,,ai,m.

  • 1n104
  • 1m10
  • 1k30
  • 0ai,j<2k.
  • There are at most 100 test cases, and at most 1 of them have n>103 or m>5.

Output

For each test case, print an integer which denotes the result.

Sample Input

1 2 2
3 3
1 2 2
1 3
3 3 4
1 2 3
4 5 6
7 8 9

Sample Output

12
3
1122012