You have a strip with $$$n$$$ cells, numbered $$$1, 2, \ldots n$$$, each colored either black or white. You have a paint brush of length $$$k$$$, and a cost array $$$c_1, c_2, \ldots c_{n-k+1}$$$. You repeat the following step until all cells are black:
What is the total expected cost?
The first line contains two integers $$$n (1 \leq n \leq 4000)$$$ and $$$k(1 \leq k \leq n$$$).
The second line contains a string of length $$$n$$$ consisting of W and B, describing the initial colors of the cells $$$1, 2, \ldots n$$$.
The third line contains $$$n - k + 1$$$ space separated integers $$$c_1, c_2, \ldots c_{n-k+1}$$$.
Print a single line, containing the expected cost modulo $$$998244353$$$. It can be proved that the expected cost is rational, and can be written in the form $$$\frac{P}{Q}$$$, where $$$Q \neq 0 \pmod {998244353}$$$
4 2 WBWW 3 1 1
499122184
The expected value of the cost is $$$15/2$$$