Problem: You are given string of length consisting of 0-s and 1-s. You build an infinite string as a concatenation of an infinite number of strings , or For example, if 10010, then 100101001010010...
Calculate the number of prefixes of with balance equal to . The balance of some string is equal to , where is the number of occurrences of 0 in , and is the number of occurrences of 1 in . The number of such prefixes can be infinite; if it is so, you must say that.
A prefix is a string consisting of several first letters of a given string, without any reorders. An empty prefix is also a valid prefix. For example, the string "abcd" has 5 prefixes: empty string, "a", "ab", "abc" and "abcd".
Input Format: The first line contains the single integer () — the number of test cases.
Next lines contain descriptions of test cases — two lines per test case. The first line contains two integers and (, ) — the length of string and the desired balance, respectively.
The second line contains the binary string (, ).
It's guaranteed that the total sum of doesn't exceed .
Output Format: Print integers — one per test case. For each test case print the number of prefixes or if there is an infinite number of such prefixes.
Note: In the first test case, there are 3 good prefixes of : with length , and .