Problem: A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence (or, shortly, an RBS) is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example:
- bracket sequences "()()" and "(())" are regular (the resulting expressions are: "(1)+(1)" and "((1+1)+1)");
- bracket sequences ")(", "(" and ")" are not.
You are given a string , which is an RBS. You can apply any number of operations to this string. Each operation can have one of the following types:
- choose some non-empty prefix of and remove it from , so is still an RBS. For example, we can apply this operation as follows: "(())()(())()()" "()()" (the first characters are removed);
- choose some contiguous non-empty substring of and remove it from , so is still an RBS. For example, we can apply this operation as follows: "(())()(())()()" "(())()()()" (the characters from the -th to the -th are removed).
The operation can be applied at most times. Calculate the maximum number of operations you can apply until becomes empty.
Input Format: The first line contains one integer () — the number of test cases.
Each test case is described by two lines. The first line contains two integers and (; ; is even) — the length of and the maximum number of operations of type you can apply.
The second line contains a string of characters '(' and ')'. This string is an RBS.
The sum of over all test cases doesn't exceed .
Output Format: For each test case, print one integer — the maximum number of operations you can apply.