Alice and Bob

각 정점에 토큰을 많아야 하나 놓는 경우 중, 흰 정점의 토큰을 옮기는 Alice가 검은 정점의 토큰을 옮기는 Bob을 최적 플레이로 이기는 배치의 수를 센다.

어려움9게임 이론동적 계획법그래프조합론아직 제출이 없습니다시간 제한1초메모리 제한512 MB

문제

Alice and Bob will play a game by alternating turns with Alice going first. 

They have a directed acyclic graph, such that each edge uvu \to v satisfies u<vu < v.

All vertices in this DAG are colored one of two colors, and vertices have tokens on them (a vertex may contain more than one token).

During her move, Alice will choose a white vertex uu which contains at least one token. Then, she will choose some outgoing edge, uvu \to v, and move one token from vertex uu to the vertex vv.

During his move, Bob will choose a black vertex uu which contains at least one token. Then, he will choose some outgoing edge uvu \to v and move one token from vertex uu to the vertex vv.

The person who can't move loses.

Alice and Bob haven't decided on the configuration of tokens yet, but they have decided that each vertex at the beginning of the game will contain at most one token. Among all 2n2^n placement of tokens, calculate how many of them Alice will win under the optimal play of both players? As this value may be large, find it modulo 998,244,353998\\,244\\,353.

입력

The first line contains two integers n,mn,m (1n300,0mn(n1)21 \leq n \leq 300, 0 \leq m \leq \frac{n(n-1)}{2}): the number of vertices and edges in the graph.

The second line contains a string of length nn. If the ii-th character is `W', then the vertex is white. Otherwise, it will be equal to `B' and be black.

Each of the next mm lines contains two vertices uu, vv (1u<vn)1 \leq u < v \leq n), denoting an edge uvu \to v.

It is guaranteed that the DAG will have no multiple edges.

출력

Print one integer: the number of ways to place at most one token on each vertex such that Alice wins, modulo 998,244,353998\\,244\\,353.

힌트

In the first example, Alice will win in all the cases, where she can make at least one move (because Bob will never be able to move), so the answer is 2522^5 - 2.