405843: GYM102134 D Viktoria and resentments

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Viktoria and resentmentstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Viktoria is so easily offended. She was also offended by Alex during their walk. It is known that Alex and Viktoria were walking n minutes. And every minute Viktoria was either offended or not offended by Alex. Since we are all programmers, let's denote these n minutes of Viktoria's state as a string of n bits. So, the i-th bit of the string is 1 if she was offended in the i-th minute, otherwise this bit is 0.

Alex considers that Viktoria takes offense at him too often. And he likes to prove everything. That's why Alex wants to count the number of time periods where her offence was strictly greater than X. A pair of numbers (l, r), where 1 ≤ l ≤ r ≤ n, is considered to be a time period. Viktoria's offense during some period is a ratio of the amount of minutes she took offense to the total amount of minutes in a period. More formally, Viktoria's offense during the period (l, r) is , where cnt1 is an amount of ones in the segment (l, r) of the bit string, and cntall is the total amount of characters in the bit string from the l-th position to the r-th position.

Help Alex to prove to Viktoria that she takes offense too often!

Input

The first line contains the description of X in the form of two space-separated integers: P and Q. (0 ≤ P ≤ 1000, 1 ≤ Q ≤ 1000, P ≤ Q), i. e. X is equal to .

The next line contains a string s. It consists of the characters '0' and '1'. The length of the string is positive and doesn't exceed 200 000.

Output

Output the number of segments (l, r), where Viktoria's offense is strictly greater than X.

ExamplesInput
3 10
10110
Output
13
Input
9 10
010100101101
Output
7

加入题单

算法标签: