#abc295h. [abc295_h]E or m

[abc295_h]E or m

Problem Statement

We have a grid AA with NN rows and MM columns. Initially, 00 is written on every square.
Let us perform the following operation.

  • For each integer ii such that 1leileN1 \\le i \\le N, in the ii-th row, turn the digits in zero or more leftmost squares into 11.
  • For each integer jj such that 1lejleM1 \\le j \\le M, in the jj-th column, turn the digits in zero or more topmost squares into 11.

Let SS be the set of grids that can be obtained in this way.

You are given a grid XX with NN rows and MM columns consisting of 0, 1, and ?.
There are 2q2^q grids that can be obtained by replacing each ? with 0 or 1, where qq is the number of ? in XX. How many of them are in SS?
This count can be enormous, so find it modulo 998244353998244353.

Constraints

  • NN and MM are integers.
  • 1leN,Mle181 \\le N,M \\le 18
  • XX is a grid with NN rows and MM columns consisting of 0, 1, and ?.

Input

The input is given from Standard Input in the following format:

NN MM X1,1X1,2dotsX1,MX_{1,1} X_{1,2} \\dots X_{1,M} X2,1X2,2dotsX2,MX_{2,1} X_{2,2} \\dots X_{2,M} vdots\\vdots XN,1XN,2dotsXN,MX_{N,1} X_{N,2} \\dots X_{N,M}

Output

Print an integer representing the answer.


Sample Input 1

2 3
0?1
?1?

Sample Output 1

6

The following six grids are in SS.

011  011  001
010  011  110

001  011  011
111  110  111

Sample Input 2

5 3
101
010
101
010
101

Sample Output 2

0

XX may have no ?, and the answer may be 00.


Sample Input 3

18 18
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????
??????????????????

Sample Output 3

462237431

Be sure to find the count modulo 998244353998244353.