Nate has $3$ special types of torches, with colors red, blue, and yellow that combines colors subtractively and not additively. The colors mentioned, as Nate had learned in grade school, are the primary colors. When the light from the primary torches overlap, they have the following behavior:
When an area is affected by two torches of the same color, the color is amplified in that area. Let's call the number of torches that give the same color to an area as the _power_. Light becomes secondary color if and only if the two colors that affect the area are of the same power.
Now, when things get more complicated than the secondary colors, the lights get confused. Normally, when we mix violet paint with red paint, we get the color red-violet. But this is not so for the light from Nate's torches. Let's put another torch in an area affected by one of the secondary colors. If that torch is one of the component colors of the secondary color in the area, the mixed light becomes pink. But when the torch is not one of the component colors, the mixed light becomes brown.
Nate places $k$ of these torches in a field of $m times n$ grid. Each tile of the grid is labeled with coordinate $(x, y)$, from the upper-left hand corner, whose coordinate is $(1, 1)$. Each torch has a color, denoted by _RED_, _BLUE_, and _YELLOW_.
When placed in a field, the torch lights up a square area of side length $s$ with the torch being in the center of that square. Let us call the side length the _range_. The location of the $i$th of the $k$ torches, with color $c_i$, is denoted by $(x_i, y_i)$. If the range of the torch is odd, then $(x_i, y_i)$ corresponds to the center tile of the square area lit up by the torch. If the range of the torch is even, then $(x_i, y_i)$ corresponds to the upper-left tile of the four center tiles of the square area lit up by the torch. The torch itself is placed in the middle of the four center tiles. Refer to the diagram below for a visualization. It is guaranteed that no two torches are placed in the exact same location, because that would be violating Pauli's Exclusion Principle. Nate wants to find out how many tiles _inside_ the $m times n$ grid are lit up with the color $c$.
The first line of input contains three space-separated integers $m$, $n$, and $k$, respectively. The first integer, $m$, is the horizontal length of the grid. The second integer, $n$, is the vertical length of the grid. The third integer, $k$, is the number of torches Nate will place. The next line of input contains $c$, the color that Nate wants. It is guaranteed that $c$ is one of the following: _RED_, _BLUE_, _YELLOW_, _GREEN_, _ORANGE_, _VIOLET_, _BROWN_, _PINK_. Each of the next $k$ lines of input contains four space-separated integers $c_i$, $x_i$, $y_i$, and $s$, respectively. The first integer, $c_i$, is the color of the torch placed. The second integer, $x_i$, is the $x$-coordinate of the center tile. The third integer, $y_i$, is the $y$-coordinate of the center tile. The fourth integer, $s$, is the side length of the square region that the torch lights up. It is guaranteed that $c_i$ is one of _RED_, _BLUE_, and _YELLOW_.
*Constraints*
$1 < m, n <= 50$
$1 <= k <= m times n$
$1 <= x_i <= m$
$1 <= y_i <= n$
$1 <= s <= 50$
Output a single integer, the number of tiles that are lit up as the color $c$.
In the first test case, the red torch has a range of $1$. It is placed in the middle of the $(1, 1)$ tile.
In the second test case, the red torch has a range of $2$. The upper-left tile of the four center tiles is $(1, 1)$. The red torch is placed accordingly. The blue torch has a range of $1$, placed in the middle of the $(1, 1)$ tile. The red and the blue in the $(1, 1)$ tile overlaps, making the $(1, 1)$ tile color violet.
In the third test case, the red torch has a range of $2$. The upper-left tile of the four center tiles is $(2, 2)$. The red torch is placed on the corner of the field. Since we are only interested in the number of tiles lit with red light within the $2 times 2$ field, the answer is $1$.
## Input
The first line of input contains three space-separated integers $m$, $n$, and $k$, respectively. The first integer, $m$, is the horizontal length of the grid. The second integer, $n$, is the vertical length of the grid. The third integer, $k$, is the number of torches Nate will place. The next line of input contains $c$, the color that Nate wants. It is guaranteed that $c$ is one of the following: _RED_, _BLUE_, _YELLOW_, _GREEN_, _ORANGE_, _VIOLET_, _BROWN_, _PINK_. Each of the next $k$ lines of input contains four space-separated integers $c_i$, $x_i$, $y_i$, and $s$, respectively. The first integer, $c_i$, is the color of the torch placed. The second integer, $x_i$, is the $x$-coordinate of the center tile. The third integer, $y_i$, is the $y$-coordinate of the center tile. The fourth integer, $s$, is the side length of the square region that the torch lights up. It is guaranteed that $c_i$ is one of _RED_, _BLUE_, and _YELLOW_.*Constraints*$1 < m, n <= 50$ $1 <= k <= m times n$ $1 <= x_i <= m$ $1 <= y_i <= n$ $1 <= s <= 50$
## Output
Output a single integer, the number of tiles that are lit up as the color $c$.
[samples]
## Note
In the first test case, the red torch has a range of $1$. It is placed in the middle of the $(1, 1)$ tile. In the second test case, the red torch has a range of $2$. The upper-left tile of the four center tiles is $(1, 1)$. The red torch is placed accordingly. The blue torch has a range of $1$, placed in the middle of the $(1, 1)$ tile. The red and the blue in the $(1, 1)$ tile overlaps, making the $(1, 1)$ tile color violet. In the third test case, the red torch has a range of $2$. The upper-left tile of the four center tiles is $(2, 2)$. The red torch is placed on the corner of the field. Since we are only interested in the number of tiles lit with red light within the $2 times 2$ field, the answer is $1$.
**Definitions**
Let $ s \in \{ \text{P}, \text{V}, \text{?} \}^n $, $ t \in \{ \text{P}, \text{V}, \text{?} \}^m $ be the input strings.
A *trend* is a pair $ (s', t') $ where $ s' \in \{ \text{P}, \text{V} \}^n $, $ t' \in \{ \text{P}, \text{V} \}^m $, and $ s' $ (resp. $ t' $) is obtained by replacing each $ \text{?} $ in $ s $ (resp. $ t $) with either $ \text{P} $ or $ \text{V} $.
Let $ c \in \mathbb{Z} $ denote the boy’s current money, starting at $ c = 1 $.
At each day, he selects one available sequence (i.e., one with remaining stages) and processes its next stage:
- $ \text{V} $: $ c \leftarrow c + 1 $
- $ \text{P} $: $ c \leftarrow c - 1 $
Bankruptcy occurs if $ c = 0 $ at any point.
The boy’s strategy:
- If $ c = 1 $: he chooses a stage that does *not* lead to loss (i.e., $ \text{V} $) if any such available stage exists; otherwise, he is forced to choose a $ \text{P} $, leading to bankruptcy.
- If $ c \geq 2 $: he chooses arbitrarily (randomly, but we consider *all possible* choices).
A trend $ (s', t') $ is *safe* if, **no matter the sequence of choices** the boy makes (following his strategy), bankruptcy **never** occurs.
**Constraints**
1. $ 1 \leq n, m \leq 5000 $
2. Each character in $ s $, $ t $ is in $ \{ \text{P}, \text{V}, \text{?} \} $
**Objective**
Count the number of safe trends $ (s', t') $, modulo $ 998244353 $.