Dristor2

Time limit: 0.25s Memory limit: 256MB Input: Output:

Task

This is the legend of the old, long-lost package in Dristor 2.

A long time ago, AAP, MH, MFast and the other package hunters were tasked with finding a lost package in the Dristor 2 station. It is known that there are NN package hunters and MM secret locations in the Dristor 2 station. For each of the NN package hunters, the secret locations he knows how to reach are known. Since none of them know the station well enough, they decided to split up to increase their chances of finding the package.

In one search, every package hunter must check at most one secret location he knows how to reach and no two hunters should check the same secret location. In each search, the number of package hunters that are not checking any of the secret locations is minimized (i.e. the number of secret locations that are checked is maximized). You should count the number of different searches the group can try in order to find the lost package. Since this number can be very large, you should print it modulo 109+910^9 + 9. Two searches are considered different if at least one package hunter checks a different locations in the two searches.

Input

The first line of the input will contain NN and MM. The next NN lines of the input will each contain MM binary values. If the jthj^{th} value on the ithi^{th} line is 11, then the ithi^{th} package hunter knows how to reach the jthj^{th} location. If the value is 00, then the ithi^{th} package hunter does not know how to reach the jthj^{th} location.

Output

You should output the number of different searches the group can try (modulo 109+910^9 + 9).

Restrictions

  • 1N141 \leq N \leq 14
  • 1M1001 \leq M \leq 100
  • For tests worth 2020 points, 1N,M61 \leq N, M \leq 6.
  • For tests worth 1010 more points, each of the NN package hunters knows where all the secret locations are.

Example

stdin

4 4
0 1 1 0
1 1 0 1
1 0 0 0
0 1 1 1

stdout

3

Log in or sign up to be able to send submissions!