QOJ.ac

QOJ

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

#15225. Bracelet

統計

oql has some beads of the forms 00, 01, and 11. As a craft enthusiast, oql wants to string them into a bracelet and has carefully designed the pattern and drawn a blueprint.

The pattern of the bracelet can be abstracted as a string $S$ consisting of 0 and 1, where the ends are connected.

However, a cat named Iris passed by, and now there are only $n$, $m$, and $k$ beads of the three types remaining, respectively.

oql is very sad, but still decides to try his best to complete the bracelet, or at least a continuous part of it. He wants to know the maximum length of a continuous part he can complete now.

Obviously, you should not break the beads. However, you can flip the beads: for 00 and 11, there is no change after flipping; for 01, it becomes 10 after flipping.

Input

The first line contains three space-separated integers $n, m, k$ ($0 \le n, m, k \le 10^6$), representing the number of 00, 01, and 11 beads, respectively.

The second line contains a string $S$ consisting of 0 and 1 ($1 \le |S| \le 10^6$), representing the pattern of the bracelet.

Output

A single integer representing the maximum length oql can complete.

Examples

Input 1

0 2 3
01001111

Output 1

6

Input 2

1 2 3
0

Output 2

0

Input 3

1 1 3
0101000011

Output 3

6

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.