#ABC292G. [ABC292G] Count Strictly Increasing Sequences

[ABC292G] Count Strictly Increasing Sequences

Score : 600600 points

Problem Statement

You are given a sequence S1,,SNS_1,\ldots,S_N of length-MM strings consisting of digits (0123456789) and ?.

There are 10q10^q ways to replace the occurrences of ? with digits independently, where qq is the total number of ? in S1,,SNS_1,\ldots,S_N. Among them, how many satisfy S1<S2<<SNS_1\lt S_2 \lt \ldots \lt S_N when the resulting strings are seen as integers? Find this count modulo 998244353998244353.

The resulting strings may have leading zeros. For instance, 0000000292 is seen as 292292.

Constraints

  • 2N402 \leq N \leq 40
  • 1M401 \leq M \leq 40
  • NN and MM are integers.
  • SiS_i is a string of length MM consisting of digits and ?.

Input

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

NN MM

S1S_1

\vdots

SNS_N

Output

Print the answer.

3 2
?0
??
05
4

Here are the four desired replacements.

  • Replace the first character of S1S_1 with 0, and the first and second characters of S2S_2 with 0 and 1, respectively.
  • Replace the first character of S1S_1 with 0, and the first and second characters of S2S_2 with 0 and 2, respectively.
  • Replace the first character of S1S_1 with 0, and the first and second characters of S2S_2 with 0 and 3, respectively.
  • Replace the first character of S1S_1 with 0, and the first and second characters of S2S_2 with 0 and 4, respectively.
2 1
0
0
0
10 10
1?22??37?4
1??8?0??49
3?02??8044
51?4?8?7??
5?9?20???2
68?7?6?800
?3??2???23
?442312158
??2??921?8
????5?96??
137811792

Find the count modulo 998244353998244353.