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<stdio.h>
#include<algorithm>
using namespace std;
typedef unsigned long long wolf;
int mod=1000000009;
int c[110][110];
wolf s[2600][42];
wolf u=1;
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++)for(int j=0;j<b;j++){
		scanf("%d",&c[i][j]);
		s[i*b+j][40]=c[i][j];
	}
	for(int i=0;i<a;i++)for(int j=0;j<b;j++){
		for(int k=0;k<a;k++)for(int l=0;l<b;l++){
			if(i==k||j==l||(i+j)==(k+l)||(i-j)==(k-l)){
				int L=i*b+j;
				int R=k*b+l;
				s[L][R/64]^=(u<<(R%64));
			}
		}
	}
	int rank=0;
	for(int i=0;i<a*b;i++){
		int at=-1;
		for(int j=rank;j<a*b;j++){
			if(s[j][i/64]&(u<<(i%64))){at=j;break;}
		}
		if(!~at)continue;
		for(int j=0;j<42;j++)swap(s[at][j],s[rank][j]);
		for(int j=rank+1;j<a*b;j++){
			if(s[j][i/64]&(u<<(i%64))){
				for(int k=0;k<42;k++)s[j][k]^=s[rank][k];
			}
		}
		rank++;
	}
	
	bool ok=true;
	for(int i=0;i<a*b;i++){
		bool OK=false;
		for(int j=0;j<40;j++)if(s[i][j])OK=true;
		if(!OK&&s[i][40])ok=false;
	}
	if(!ok){
		printf("0\n");return 0;
	}
	int ret=1;
	for(int i=0;i<a*b-rank;i++){
		ret=ret*2%mod;
	}
	printf("%d\n",ret);
}