QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 1024 MB 満点: 100

#4893. Imbalance

統計

A binary string is defined as balanced if and only if it contains an equal number of 0s and 1s.

Given $n$, $k$, and a binary string $S$ of length $m$, find the number of binary strings of length $n$ that have $S$ as a prefix and do not contain any balanced substring of length $k$. Output the answer modulo $998244353$.

Input

The first line contains three integers $n$, $k$, and $m$, representing the total length of the string, the constraint on the balanced substring, and the length of $S$, respectively.

The next line contains a binary string $S$ of length $m$.

Output

Output a single integer representing the answer modulo $998244353$.

Examples

Input 1

5 4 2
01

Output 1

3

Input 2

13 6 0

Output 2

996

Constraints

For $100\%$ of the data, it is guaranteed that $1\le m+1\le k\le n\le 114$ and $k$ is even.

Subtask ID$n\le$Special PropertiesScoreDependencies
$1$$20$$10$
$2$$114$$k\le 20$$10$$1$
$3$$66$$30$$1$
$4$$114$$m=0$$20$
$5$$114$$30$$2,3,4$

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.