Problem: You are given a garland consisting of lamps. States of the lamps are represented by the string of length . The -th character of the string equals '0' if the -th lamp is turned off or '1' if the -th lamp is turned on. You are also given a positive integer .
In one move, you can choose one lamp and change its state (i.e. turn it on if it is turned off and vice versa).
The garland is called -periodic if the distance between each pair of adjacent turned on lamps is exactly . Consider the case . Then garlands "00010010", "1001001", "00010" and "0" are good but garlands "00101001", "1000001" and "01001100" are not. Note that the garland is not cyclic, i.e. the first turned on lamp is not going after the last turned on lamp and vice versa.
Your task is to find the minimum number of moves you need to make to obtain -periodic garland from the given one.
You have to answer independent test cases.
Input Format: The first line of the input contains one integer () — the number of test cases. Then test cases follow.
The first line of the test case contains two integers and () — the length of and the required period. The second line of the test case contains the string consisting of characters '0' and '1'.
It is guaranteed that the sum of over all test cases does not exceed ().
Output Format: For each test case, print the answer — the minimum number of moves you need to make to obtain -periodic garland from the given one.