Problem Setting
시간 제한1초메모리 제한1024 MB
어떤 검증자도 어려운 문제 뒤에 쉬운 문제를 보지 않도록 정렬할 수 있는 N개 문제의 비어 있지 않은 부분집합의 수를 센다.
문제
Farmer John created () problems. He then recruited () 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 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 .
입력
The first line contains and .
The next lines each contain a string of length . The th character of this string is E if the test-solver thinks the th problem is easy, or H otherwise.
출력
The number of distinct problemsets FJ can form, modulo .