#UnknownID7. JIXMPII5J0xaXzV#)*/

JIXMPII5J0xaXzV#)*/

Statement

DLS and JLS are bored with a Math lesson. In order to entertain themselves, DLS took a sheet of paper and drew n n distinct lines, given by equations y=x+pi y = x + p_i for some distinct p1,p2,,pn p_1, p_2, \ldots, p_n .

Then JLS drew on the same paper sheet m m distinct lines given by equations y=x+qi y = -x + q_i for some distinct q1,q2,,qm q_1, q_2, \ldots, q_m .

DLS and JLS are interested in counting how many line pairs have integer intersection points, i.e. points with both coordinates that are integers. Unfortunately, the lesson will end up soon, so DLS and JLS are asking for your help.

Format

Input

The first line contains one integer t t ( 1t1000 1 \le t \le 1000 ), the number of test cases in the input. Then follow the test case descriptions.

The first line of a test case contains an integer n n ( 1n105 1 \le n \le 10^5 ), the number of lines drawn by DLS.

The second line of a test case contains n n distinct integers pi p_i ( 0pi109 0 \le p_i \le 10^9 ) describing the lines drawn by DLS. The integer pi p_i describes a line given by the equation y=x+pi y = x + p_i .

The third line of a test case contains an integer m m ( 1m105 1 \le m \le 10^5 ), the number of lines drawn by JLS.

The fourth line of a test case contains m m distinct integers qi q_i ( 0qi109 0 \le q_i \le 10^9 ) describing the lines drawn by JLS. The integer qi q_i describes a line given by the equation y=x+qi y = -x + q_i .

The sum of the values of n n over all test cases in the input does not exceed 105 10^5 . Similarly, the sum of the values of m m over all test cases in the input does not exceed 105 10^5 .

In hacks it is allowed to use only one test case in the input, so t=1 t=1 should be satisfied.

Output

For each test case in the input print a single integer — the number of line pairs with integer intersection points.

Sample

3
3
1 3 2
2
0 3
1
1
1
1
1
2
1
1
3
1
0