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<bits/stdc++.h>
using namespace std;
using ll = long long;
using Mat = vector<bitset<2501>>;

int h,w;

int calc(Mat mat) {
  int n = mat.size();
  int res = 0;
  for(int i = 0; i < n; i++) {
    int pivot = -1;
    for(int j = res; j < n; j++) {
      if(mat[j][i]) { pivot = j; break; }
    }
    if(pivot == -1) continue;
    swap(mat[res], mat[pivot]);
    for(int j = res + 1; j < n; j++) if(mat[j][i]) mat[j] ^= mat[res];
    res++;
  }
  int ng = 0;
  for(int i = res; i < n; i++) ng |= mat[i][h * w];
  if(ng) return -1;
  return res;
}

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> h >> w;
  Mat mat(h * w);
  for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) {
    int c; cin >> c;
    mat[i * w + j][h * w] = c;
  }
  for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) {
    for(int k = 0; k < h; k++) for(int l = 0; l < w; l++) {
      if(i == k || j == l || (i + j) == (k + l) || (i - j) == (k - l)) {
        mat[i * w + j][k * w + l] = 1;
      }
    }
  }
  int rnk = calc(mat);
  if(rnk < 0) return (cout << 0 << endl, 0);
  ll ans = 1;
  constexpr int mod = 1e9 + 9;
  for(int i = 0; i < h * w - rnk; i++) ans = ans * 2 % mod;
  cout << ans << endl;
}