Problem: There was a girl who had a hobby of Othello. I enjoy Othello with my family when I have time.

One day, the girl tried to play Othello as usual. However, everyone was so busy that no one played. So I came up with a game that can be played by one person using Othello's board and spinning top.

problem

Othello pieces are arranged so that the top surface is black or white in all the squares of the vertical \\ (R \\) ​​square and the horizontal \\ (C \\) square.

Consider repeating the operation of "selecting a certain square and turning over all the pieces in the vertical, horizontal, and diagonal directions" as shown in the figure below. Find the number of operations that make the tops of all the pieces white. However, the following conditions must be met.

* You cannot operate the same square twice
* Do not distinguish the order of operations
* It is possible to continue the operation after the top surface of all the pieces has turned white.



<image>

input

The integer \\ (R \\) ​​and the integer \\ (C \\) are given on the first line, separated by blanks.

Subsequently, \\ (R \\) ​​lines are given \\ (C \\) integer values ​​(0 or 1), respectively. The \\ (c \\) th integer on the \\ (r \\) line represents the state of the square (r, c).

1 indicates that the upper surface is black, and 0 indicates that the upper surface is white.

output

If you can make the top surface of all the pieces on the board white, output the remainder of dividing the number of such operations by \\ (1000000009 (= 10 ^ 9 + 9) \\) on one line.

If you can't make the tops of all the pieces on the board white, print \\ (0 \\) on one line.

Constraint

* \\ (1 \ leq R \ leq 50, 1 \ leq C \ leq 50 \\)



Sample input / output

Input 1


13
1 1 1


Output 1


Four


\\ (\\ {(1,1) \\}, \\ {(1,2) \\}, \\ {(1,3) \\}, \\ {(1,1), (1) , 2), (1,3) \\} \\).

Input 2


13
1 0 1


Output 2


0


Input 3


twenty four
0 1 0 1
1 0 1 0


Output 3


1






Example

Input

1 3
1 1 1


Output

4

Solution (in CPP):

Solution:
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int elementaryMatrix(vector<bitset<2501> >& mat)
{
    const int n = mat.size();
    const int m = mat[0].size();
    int y = 0;
    int x = 0;
    while(y < n && x < m){
        int tmp = -1;
        for(int i=y; i<n; ++i){
            if(mat[i][x] == 1){
                tmp = i;
                break;
            }
        }
        if(tmp != -1){
            swap(mat[y], mat[tmp]);
            for(int i=y+1; i<n; ++i){
                if(mat[i][x])
                    mat[i] ^= mat[y];
            }
            ++ y;
        }
        ++ x;
    }
    mat.resize(y);
    return y;
}

const int MOD = 1000000009;

long long power(int a, int b)
{
    long long ret = 1;
    long long tmp = a;
    while(b > 0){
        if(b & 1){
            ret *= tmp;
            ret %= MOD;
        }
        tmp *= tmp;
        tmp %= MOD;
        b >>= 1;
    }
    return ret;
}

int main()
{
    int r, c;
    cin >> r >> c;
    vector<bitset<2501> > mat(r*c);
    for(int i=0; i<r; ++i){
        for(int j=0; j<c; ++j){
            int tmp;
            cin >> tmp;
            mat[i*c+j][r*c] = (tmp == 1);
        }
    }
    
    for(int i=0; i<r*c; ++i){
        for(int j=0; j<9; ++j){
            if(j == 4)
                continue;
            int y = i / c;
            int x = i % c;
            while(0 <= y && y < r && 0 <= x && x < c){
                mat[i][y*c+x] = true;
                y += j / 3 - 1;
                x += j % 3 - 1;
            }
        }
    }

    int rank = elementaryMatrix(mat);
    long long ret = 0;
    if(!mat[rank-1][r*c] || mat[rank-1].count() != 1)
        ret = power(2, r*c - rank);
    cout << ret << endl;

    return 0;
}