A binary string is a string that consists of only the character and . For example: are binary strings.
Bob was given a problem to solve by his teacher. The problem is about binary strings. As Bob has recently started learning about strings, he is not quite sure if he can solve the problem. But maybe he can if you give him some hints
The problem as follows: You are given two binary string and . Consider a set that contains all the indices such that . Similarly, let that contains all the indices such that . Now you have to find the sum of for all and such that belongs to and belongs to .
More formally, find the value of
To give hints to Bob, you show him only this value but not the actual solution or how to do it.
For example, let Then, and So the answer is:
Note that denotes the absolute value of
The first line contains an integer the number of test cases .
For each test case, the first line contains an integer — the size of the binary string and . The next two line contains the binary string and respectively.
It is guaranteed that both and are binary string. It is also guaranteed that the sum of over all test cases does not exceed
For each test case, print the value described above.
Input | Output |
---|---|
3 2 01 01 3 101 110 6 101010 011011 | 0 4 24 |