406549: GYM102439 C Cockroach Racing
Description
Julia organizes the largest cockroach race ever. It's a fun and exotic job where the main and the only problem is to place cockroaches in the correct order at the start. Once it's done, everything is cockroach gods will. It is known that, chalk written numbers on the cockroaches backs can have leading zeros, and most crucially, the numbers of cockroaches at the start must form an increasing sequence. It's not known who and why came up with this rule. Anyway, we just have to obey. But unfortunately chalk erases easily, so here and there only vague spots remained instead of some digits. Since Julia is a true professional and doesn't want to break the rule, she is trying to restore accidentally erased digits. Let's calculate the sum of all the possible numbers of cockroaches for all possible sequences.
InputThe first line contains two integers $$$n$$$ and $$$m$$$ — the ammount of cockroaches and the length of their numbers. Next $$$n$$$ lines contain numbers patterns. Each pattern is formed using digits '0' to '9' and/or '?' symbol.
$$$$$$1 \le n, m \le 50$$$$$$
OutputOutput the sum of all the possible numbers of cockroaches for all the possible sequences modulo $$$10^9+7$$$.
ExamplesInput2 2 ?? ??Output
490050Input
2 3 4?? ??2Output
6403775Input
4 1 0 ? 4 8Output
42