A Suica Graph is defined as an undirected graph that can be constructed using the following procedures.
Here are some examples of Suica Graphs:
![]() | ![]() |
You are given a Suica Graph. For each vertex, you can color it red or blue. Please count how many different Harmony colorings there are. Since the answer could be large, you only need to output the remainder of the answer modulo by $$$998244353$$$.
A coloring is called Harmony if and only if:
In other words, a coloring is Harmony if and only if the induced subgraph of red vertices is connected, the induced subgraph of blue vertices is connected, and both of them are not empty graphs (i.e., having at least one vertex).
Two coloring ways are considered different if and only if there exists a vertex colored differently in the two coloring ways.
The first line of the input is the parameter $$$N, S$$$, seperated by space. $$$N, S$$$ are the number of stripe chains and the length of stem chain, respectively. The second line consists of $$$N$$$ integers $$$l_1, l_2, \dots, l_N$$$.
Output a single integer between $$$0$$$ and $$$998244352$$$ represent the remainder of the number of different coloring ways.
4 1 2 2 2 2
188
3 3 1 1 1
28
9 159 114 514 191 918 103 314 159 265 358
37949969