PivotOJ

Problem Setting

시간 제한: 1000ms메모리 제한: 1024MB출처: USACO 2023 February PlatinumBOJ 27841

문제

Farmer John created NN (1N1051\le N\le 10^5) problems. He then recruited MM (1M201\le M\le 20) test-solvers, each of which rated every problem as "easy" or "hard."

His goal is now to create a problemset arranged in increasing order of difficulty, consisting of some subset of his NN problems arranged in some order. There must exist no pair of problems such that some test-solver thinks the problem later in the order is easy but the problem earlier in the order is hard.

Count the number of distinct nonempty problemsets he can form, modulo 109+710^9+7.

입력

The first line contains NN and MM.

The next MM lines each contain a string of length NN. The iith character of this string is E if the test-solver thinks the iith problem is easy, or H otherwise.

출력

The number of distinct problemsets FJ can form, modulo 109+710^9+7.

예제

예제 1

입력
3 1
EHE
출력
9

예제 2

입력
10 6
EHEEEHHEEH
EHHHEEHHHE
EHEHEHEEHH
HEHEEEHEEE
HHEEHEEEHE
EHHEEEEEHE
출력
33
코드를 제출하려면 로그인하세요.