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

Then JLS drew on the same paper sheet $m$ distinct lines given by equations $y = -x + q_i$ for some distinct $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.


-----Input-----

The first line contains one integer $t$ ($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$ ($1 \le n \le 10^5$), the number of lines drawn by DLS.

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

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

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

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

In hacks it is allowed to use only one test case in the input, so $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. 


-----Example-----
Input
3
3
1 3 2
2
0 3
1
1
1
1
1
2
1
1

Output
3
1
0



-----Note-----

The picture shows the lines from the first test case of the example. Black circles denote intersection points with integer coordinates. [Image]

Difficulty: EASY

Solutions:
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	p_o = 0
	p_e = 0
	for x in p:
		if x % 2 == 0:
			p_e += 1
		else:
			p_o += 1
	q_o = 0
	q_e = 0
	for x in q:
		if x % 2 == 0:
			q_e += 1
		else:
			q_o += 1
	print(q_o * p_o + q_e * p_e)


for _ in range(int(input())):
	np = int(input())
	even_q = 0
	odd_q = 0
	p = [1 for i in input().split() if int(i) % 2 == 0]
	nq = int(input())
	q = [1 for i in input().split() if int(i) % 2 == 0]
	even_p = sum(p)
	odd_p = np - even_p
	even_q = sum(q)
	odd_q = nq - even_q
	print(even_p * even_q + odd_p * odd_q)


am = int(input())
e = 0
o = 0
e1 = 0
o1 = 0
intersectsAm = 0
for i in range(am):
	input()
	pLines = input().split()
	input()
	nLines = input().split()
	intersectsAm = 0
	e = 0
	o = 0
	e1 = 0
	o1 = 0
	for n in pLines:
		if int(n) % 2 == 0:
			e += 1
		else:
			o += 1
	for n in nLines:
		if int(n) % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	print(e * e1 + o * o1)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	cnt_p0 = 0
	cnt_p1 = 0
	cnt_q0 = 0
	cnt_q1 = 0
	for i in range(n):
		if p[i] % 2 == 0:
			cnt_p0 += 1
		else:
			cnt_p1 += 1
	for i in range(m):
		if q[i] % 2 == 0:
			cnt_q0 += 1
		else:
			cnt_q1 += 1
	print(cnt_p0 * cnt_q0 + cnt_p1 * cnt_q1)


def main():

	def solve():
		int(input())
		pp = [int(p) for p in input().split()]
		int(input())
		qq = [int(q) for q in input().split()]
		ppe = [p for p in pp if p % 2 == 0]
		qqe = [q for q in qq if q % 2 == 0]
		result = len(ppe) * len(qqe) + (len(pp) - len(ppe)) * (len(qq) - len(qqe))
		print(result)
	q = int(input())
	for _ in range(q):
		solve()
main()


def rin():
	return int(input())

def rlist(n):
	return [int(i) for i in input().split()]

def main():
	n = rin()
	p = rlist(n)
	m = rin()
	q = rlist(m)
	ple = sum((i / i for i in p if i % 2 == 1))
	pchan = n - ple
	qle = sum((i / i for i in q if i % 2 == 1))
	qchan = m - qle
	res = int(qle * ple + qchan * pchan)
	print(res)
for _ in range(rin()):
	main()


inp = int(input())
for i in range(inp):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	odd_count1 = 0
	odd_count2 = 0
	for e in range(n):
		if l1[e] % 2:
			odd_count1 += 1
	for e in range(m):
		if l2[e] % 2:
			odd_count2 += 1
	ans = odd_count1 * odd_count2 + (n - odd_count1) * (m - odd_count2)
	print(ans)


t = int(input())
for a in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	cnt = 0
	evencnt = 0
	oddcnt = 0
	for i in range(m):
		if q[i] % 2 == 0:
			evencnt += 1
		else:
			oddcnt += 1
	for i in range(n):
		if p[i] % 2 == 0:
			cnt += evencnt
		else:
			cnt += oddcnt
	print(cnt)


for _ in [0] * int(input()):
	a = [0, 0]
	n = input()
	for x in [int(x) for x in input().split()]:
		a[x % 2] += 1
	b = [0, 0]
	n = input()
	for x in [int(x) for x in input().split()]:
		b[x % 2] += 1
	print(a[0] * b[0] + a[1] * b[1])


def ii():
	return int(input())

def ss():
	return [x for x in input()]

def si():
	return [int(x) for x in input().split()]

def mi():
	return map(int, input().split())
for i in range(ii()):
	a = ii()
	sa = [int(x) % 2 for x in input().split()].count(0)
	sa = [sa, a - sa]
	b = ii()
	sb = [int(x) % 2 for x in input().split()].count(0)
	sb = [sb, b - sb]
	print(sa[0] * sb[0] + sa[1] * sb[1])


t = int(input())
for i in range(t):
	n = int(input())
	p_i = list(map(int, input().split()))
	p_i_odd = [x for x in p_i if x % 2 != 0]
	p_i_even = [x for x in p_i if x % 2 == 0]
	m = int(input())
	q_i = list(map(int, input().split()))
	q_i_odd = [x for x in q_i if x % 2 != 0]
	q_i_even = [x for x in q_i if x % 2 == 0]
	print(len(q_i_even) * len(p_i_even) + len(q_i_odd) * len(p_i_odd))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(t,) = I()
while t:
	t -= 1
	(n,) = I()
	a = I()
	(m,) = I()
	b = I()
	c1 = sum([i % 2 for i in a])
	c2 = sum([i % 2 for i in b])
	print(c1 * c2 + (n - c1) * (m - c2))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	k = list(map(int, input().split()))
	(o1, e1, o2, e2) = (0, 0, 0, 0)
	for i in l:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in k:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


a = int(input())
for i in range(a):
	n = int(input())
	z = list(map(int, input().split()))
	DO = 0
	DE = 0
	JO = 0
	JE = 0
	for i in range(len(z)):
		if z[i] % 2 == 0:
			DE = DE + 1
		else:
			DO = DO + 1
	k = int(input())
	al = list(map(int, input().split()))
	for i in range(len(al)):
		if al[i] % 2 == 1:
			JO = JO + 1
		else:
			JE = JE + 1
	print(DE * JE + DO * JO)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	odd_p = 0
	odd_q = 0
	for i in p:
		if i % 2 == 1:
			odd_p += 1
	for i in q:
		if i % 2 == 1:
			odd_q += 1
	print(odd_p * odd_q + (len(p) - odd_p) * (len(q) - odd_q))


cases = int(input())
for _ in range(cases):
	input()
	evens1 = 0
	odds1 = 0
	evens2 = 0
	odds2 = 0
	for n in input().split(' '):
		n = int(n)
		if n % 2 == 0:
			evens1 += 1
		else:
			odds1 += 1
	input()
	for n in input().split(' '):
		n = int(n)
		if n % 2 == 0:
			evens2 += 1
		else:
			odds2 += 1
	print(evens1 * evens2 + odds1 * odds2)


t = int(input())
for _ in range(t):
	even = [0, 0]
	odd = [0, 0]
	n = int(input())
	p = list(map(int, input().split(' ')))
	m = int(input())
	q = list(map(int, input().split(' ')))
	for v in p:
		if v % 2 == 0:
			even[0] += 1
		else:
			odd[0] += 1
	for v in q:
		if v % 2 == 0:
			even[1] += 1
		else:
			odd[1] += 1
	total = even[0] * even[1] + odd[0] * odd[1]
	print(total)


from bisect import bisect
from collections import defaultdict
from math import gcd, sqrt, ceil, inf
from collections import Counter
import sys
sys.setrecursionlimit(1000000)
from bisect import bisect
from collections import defaultdict
from math import gcd, sqrt, ceil, inf, factorial, log2
from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	count1 = 0
	for i in l2:
		if i % 2 == 0:
			count1 += 1
	count2 = m - count1
	ans = 0
	for i in l1:
		if i % 2 == 0:
			ans += count1
		else:
			ans += count2
	print(ans)


def read():
	return list(map(int, input().split()))
[t] = read()
for q in range(t):
	read()
	a = read()
	read()
	b = read()
	h = [0, 0]
	g = [0, 0]
	for x in a:
		h[x % 2] += 1
	for x in b:
		g[x % 2] += 1
	print(h[0] * g[0] + h[1] * g[1])


t = int(input())
for i in range(t):
	n = int(input())
	p = input()
	p = p.split()
	p = list(map(int, p))
	m = int(input())
	q = input()
	q = q.split()
	q = list(map(int, q))
	op = 0
	ep = 0
	oq = 0
	eq = 0
	for j in range(n):
		if p[j] % 2 == 0:
			ep += 1
		else:
			op += 1
	for j in range(m):
		if q[j] % 2 == 0:
			eq += 1
		else:
			oq += 1
	ans = ep * eq + op * oq
	print(ans)


for t in range(int(input())):
	n1 = int(input())
	l1 = list(map(int, input().strip().split()))
	n2 = int(input())
	l2 = list(map(int, input().strip().split()))
	o1 = []
	e1 = []
	o2 = []
	e2 = []
	for i in range(len(l1)):
		if l1[i] % 2 == 0:
			e1.append(l1[i])
		if l1[i] % 2 == 1:
			o1.append(l1[i])
	for j in range(len(l2)):
		if l2[j] % 2 == 0:
			e2.append(l2[j])
		if l2[j] % 2 == 1:
			o2.append(l2[j])
	a = len(o1)
	b = len(e1)
	c = len(o2)
	d = len(e2)
	if a == 0 or c == 0:
		if b == 0 or d == 0:
			print(0)
		else:
			print(b * d)
	if b == 0 or d == 0:
		if a != 0 and c != 0:
			print(a * c)
	if a != 0 and b != 0 and (c != 0) and (d != 0):
		print(a * c + b * d)


for i in range(int(input())):
	oddcount = 0
	evencount = 0
	n = int(input())
	N = list(map(int, input().split()))
	m = int(input())
	M = list(map(int, input().split()))

	def isodd(n):
		if n % 2 != 0:
			return 1
		else:
			return 2
	N = list(map(isodd, N))
	M = list(map(isodd, M))
	oddcount = N.count(1) * M.count(1)
	evencount = N.count(2) * M.count(2)
	print(oddcount + evencount)


from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	n = ri()
	U = rl()
	m = ri()
	D = rl()
	t1 = [0, 0]
	t2 = [0, 0]
	for u in U:
		t1[u % 2] += 1
	for d in D:
		t2[d % 2] += 1
	print(t1[0] * t2[0] + t1[1] * t2[1])
mode = 'T'
if mode == 'T':
	t = ri()
	for i in range(t):
		solve()
else:
	solve()


T = int(input())
for _ in range(T):
	N = int(input())
	P = list(map(int, input().split()))
	M = int(input())
	Q = list(map(int, input().split()))
	ans = 0
	p_ki = 0
	p_gu = 0
	q_ki = 0
	q_gu = 0
	for i in range(N):
		if P[i] % 2 == 0:
			p_gu += 1
		else:
			p_ki += 1
	for i in range(M):
		if Q[i] % 2 == 0:
			q_gu += 1
		else:
			q_ki += 1
	ans = p_ki * q_ki + p_gu * q_gu
	print(ans)


for _ in range(int(input())):
	n = int(input())
	first = list(map(int, input().split()))
	m = int(input())
	second = list(map(int, input().split()))
	e1 = 0
	o1 = 0
	for i in first:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	e2 = 0
	o2 = 0
	for j in second:
		if j % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	odd1 = 0
	ev1 = 0
	for i in range(n):
		if l[i] % 2 == 0:
			ev1 += 1
		else:
			odd1 += 1
	odd2 = 0
	ev2 = 0
	for i in range(m):
		if l2[i] % 2 == 0:
			ev2 += 1
		else:
			odd2 += 1
	print(odd1 * odd2 + ev1 * ev2)


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = [int(x) for x in input().split()]
		m = int(input())
		q = [int(x) for x in input().split()]
		p_even_num = 0
		p_odd_num = 0
		for i in p:
			if i % 2 == 0:
				p_even_num += 1
			else:
				p_odd_num += 1
		q_even_num = 0
		q_odd_num = 0
		for i in q:
			if i % 2 == 0:
				q_even_num += 1
			else:
				q_odd_num += 1
		print(p_even_num * q_even_num + p_odd_num * q_odd_num)
main()


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split(' ')))
	m = int(input())
	q = list(map(int, input().split(' ')))
	first_odd = 0
	for j in p:
		if j % 2 == 1:
			first_odd += 1
	first_even = n - first_odd
	second_odd = 0
	for j in q:
		if j % 2 == 1:
			second_odd += 1
	second_even = m - second_odd
	print(first_odd * second_odd + first_even * second_even)


for _ in range(int(input())):
	n = int(input())
	ar1 = list(map(int, input().split()))
	m = int(input())
	ar2 = list(map(int, input().split()))
	(x1, y1) = (0, 0)
	for elem in ar1:
		if elem % 2 == 0:
			x1 += 1
		else:
			y1 += 1
	(x2, y2) = (0, 0)
	for elem in ar2:
		if elem % 2 == 0:
			x2 += 1
		else:
			y2 += 1
	print(x1 * x2 + y1 * y2)


import sys

def I():
	return sys.stdin.readline().rstrip()
t = int(I())
for _ in range(t):
	n = int(I())
	p = sum((i & 1 for i in map(int, I().split())))
	m = int(I())
	q = sum((i & 1 for i in map(int, I().split())))
	a = p * q + (n - p) * (m - q)
	print(a)


q = int(input(''))
for z in range(0, q):
	n = int(input(''))
	a = list(map(int, input().split()))
	m = int(input(''))
	b = list(map(int, input().split()))
	l = 0
	p = 0
	for i in range(0, n):
		if a[i] % 2 == 0:
			l += 1
		else:
			p += 1
	w = 0
	for i in range(0, m):
		if b[i] % 2 == 0:
			w += l
		else:
			w += p
	print(w)


import sys
line_count = 0
for line in sys.stdin.readlines():
	if line_count == 0:
		t = int(line.split()[0])
	elif line_count % 4 == 1:
		n = int(line.split()[0])
	elif line_count % 4 == 2:
		p_even = 0
		p_odd = 0
		inputs = line.split()
		for i in range(n):
			value = int(inputs[i][-1])
			if value % 2 == 0:
				p_even += 1
			else:
				p_odd += 1
	elif line_count % 4 == 3:
		m = int(line.split()[0])
	elif line_count % 4 == 0:
		q_even = 0
		q_odd = 0
		inputs = line.split()
		for j in range(m):
			value = int(inputs[j][-1])
			if value % 2 == 0:
				q_even += 1
			else:
				q_odd += 1
		print(p_even * q_even + p_odd * q_odd)
	if line_count == 4 * t:
		break
	line_count += 1


t = int(input())
for _ in range(t):
	n = int(input())
	pi = list(map(int, input().split()))
	m = int(input())
	qi = list(map(int, input().split()))
	count = 0
	(pares1, pares2) = (0, 0)
	(impares1, impares2) = (0, 0)
	for (ind1, i) in enumerate(pi):
		if i % 2 == 0:
			pares1 += 1
		else:
			impares1 += 1
	for (ind2, j) in enumerate(qi):
		if j % 2 == 0:
			pares2 += 1
		else:
			impares2 += 1
	count = pares1 * pares2 + impares1 * impares2
	print(count)


(I, N) = (input, int)
for _ in [0] * N(I()):
	n = N(I())
	f = sum([int(j) % 2 for j in I().split()])
	m = N(I())
	z = sum([int(j) % 2 for j in I().split()])
	print(f * z + (n - f) * (m - z))


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	even = 0
	for i in p:
		if i % 2 == 0:
			even += 1
	m = int(input())
	q = list(map(int, input().split()))
	even1 = 0
	for i in q:
		if i % 2 == 0:
			even1 += 1
	count = even * even1 + (n - even) * (m - even1)
	print(count)


n = int(input())
for _ in range(n):
	dls = int(input())
	d = list(map(int, input().split()))
	jls = int(input())
	j = list(map(int, input().split()))
	do = 0
	for i in d:
		do += i % 2
	jo = 0
	for i in j:
		jo += i % 2
	de = dls - do
	je = jls - jo
	odd = do * jo
	even = de * je
	print(odd + even)


def answer():
	n = int(input())
	ps = map(int, input().split(' '))
	p_even = 0
	for p in ps:
		if p % 2 == 0:
			p_even += 1
	p_odd = n - p_even
	m = int(input())
	qs = map(int, input().split(' '))
	q_even = 0
	for q in qs:
		if q % 2 == 0:
			q_even += 1
	q_odd = m - q_even
	out = p_even * q_even + p_odd * q_odd
	return out
for _ in range(int(input())):
	out = answer()
	print(out)


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	o1 = len([i for i in l1 if i % 2 == 1])
	o2 = len([i for i in l2 if i % 2 == 1])
	(e1, e2) = (n - o1, m - o2)
	c = o1 * o2 + e1 * e2
	print(c)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = list(map(int, input().strip().split()))
		m = int(input())
		q = list(map(int, input().strip().split()))
		cnt1 = [0, 0]
		cnt2 = [0, 0]
		for p_ in p:
			cnt1[p_ % 2] += 1
		for q_ in q:
			cnt2[q_ % 2] += 1
		ans = cnt1[0] * cnt2[0] + cnt1[1] * cnt2[1]
		print(ans)
main()


for _ in range(int(input())):
	n = int(input())
	(*P,) = map(int, input().split())
	m = int(input())
	(*Q,) = map(int, input().split())
	even = odd = 0
	for p in P:
		if p % 2 == 0:
			even += 1
		else:
			odd += 1
	print(sum(([even, odd][q % 2] for q in Q)))


t = int(input())
for i in range(t):
	n = int(input())
	a = len(list(filter(lambda x: x % 2 == 0, list(map(int, input().split())))))
	m = int(input())
	b = len(list(filter(lambda x: x % 2 == 0, list(map(int, input().split())))))
	print(a * b + (n - a) * (m - b))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	l1 = list(map(int, input().split()))
	o = 0
	e = 0
	o1 = 0
	e1 = 0
	for i in l:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	for i in l1:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	ans = 0
	if e1 > 0:
		if e > 0:
			ans += e1 * e
		else:
			ans += 0
	if o1 > 0:
		if o > 0:
			ans += o * o1
		else:
			ans += 0
	print(ans)


vezes = int(input())
for __ in range(vezes):
	dic1 = {}
	dic1['pares'] = 0
	dic1['impar'] = 0
	dic2 = {}
	dic2['pares'] = 0
	dic2['impar'] = 0
	n = int(input())
	linhasDLS = input().split()
	for linha in linhasDLS:
		if int(linha) % 2 == 0:
			dic1['pares'] += 1
		else:
			dic1['impar'] += 1
	m = int(input())
	linhasJLS = input().split()
	for linha in linhasJLS:
		if int(linha) % 2 == 0:
			dic2['pares'] += 1
		else:
			dic2['impar'] += 1
	resultado = dic1['pares'] * dic2['pares'] + dic1['impar'] * dic2['impar']
	print(resultado)


t = int(input())
out = []
for i in range(t):
	n = int(input())
	p = list(map(lambda x: int(x) % 2, input().split()))
	m = int(input())
	q = list(map(lambda x: int(x) % 2, input().split()))
	count = p.count(0) * q.count(0) + p.count(1) * q.count(1)
	out.append(str(count))
print('\n'.join(out))


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		dls = list(map(int, input().split()))
		m = int(input())
		jls = list(map(int, input().split()))
		(d_odd, d_even, j_odd, j_even) = (0, 0, 0, 0)
		for j in dls:
			if j % 2 == 0:
				d_even += 1
			else:
				d_odd += 1
		for j in jls:
			if j % 2 == 0:
				j_even += 1
			else:
				j_odd += 1
		print(d_odd * j_odd + d_even * j_even)
except:
	pass


t = int(input())
while t:
	t -= 1
	n = int(input())
	px = [int(x) % 2 for x in input().strip().split(' ')]
	m = int(input())
	nx = [int(x) % 2 for x in input().strip().split(' ')]
	pz = px.count(0) * nx.count(0)
	iz = px.count(1) * nx.count(1)
	print(pz + iz)


t = int(input())
while t > 0:
	c = 0
	t -= 1
	e1 = 0
	o1 = 0
	e2 = 0
	o2 = 0
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	i = 0
	while i < n:
		if a[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
		i += 1
	i = 0
	while i < m:
		if b[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
		i += 1
	c = e1 * e2 + o1 * o2
	print(c)


t = int(input().strip())
for k in range(t):
	n = int(input().strip())
	nnum = list(map(int, input().strip().split()))
	m = int(input().strip())
	mnum = list(map(int, input().strip().split()))
	nes = 0
	mes = 0
	for k in nnum:
		if k % 2 == 0:
			nes += 1
	for k in mnum:
		if k % 2 == 0:
			mes += 1
	print(mes * nes + (n - nes) * (m - mes))


for t in range(int(input())):
	n1 = int(input())
	l1 = list(map(int, input().strip().split()))
	n2 = int(input())
	l2 = list(map(int, input().strip().split()))
	o1 = []
	e1 = []
	o2 = []
	e2 = []
	for i in range(len(l1)):
		if l1[i] % 2 == 0:
			e1.append(l1[i])
		if l1[i] % 2 == 1:
			o1.append(l1[i])
	for j in range(len(l2)):
		if l2[j] % 2 == 0:
			e2.append(l2[j])
		if l2[j] % 2 == 1:
			o2.append(l2[j])
	print(len(o1) * len(o2) + len(e1) * len(e2))


from functools import reduce
for t in range(int(input())):
	n = int(input())
	p = list(map(lambda x: int(x), input().split()))
	if len(p) != n:
		exit()
	m = int(input())
	q = list(map(lambda x: int(x), input().split()))
	if len(q) != m:
		exit()
	even_p = reduce(lambda x, y: x + 1 if y % 2 == 0 else x, p, 0)
	odd_p = n - even_p
	even_q = reduce(lambda x, y: x + 1 if y % 2 == 0 else x, q, 0)
	odd_q = m - even_q
	print(even_p * even_q + odd_p * odd_q)


def read():
	return list(map(int, input().split()))

def run():
	[n] = read()
	p = read()
	[m] = read()
	q = read()
	a = [0, 0]
	for x in p:
		a[x % 2] += 1
	b = [0, 0]
	for x in q:
		b[x % 2] += 1
	return a[0] * b[0] + a[1] * b[1]
[t] = read()
for i in range(t):
	print(run())


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	d = list(map(int, input().split()))
	(x, y, s) = (0, 0, 0)
	for i in range(n):
		if l[i] % 2 == 0:
			x = x + 1
		else:
			y += 1
	for i in range(m):
		if d[i] % 2 == 0:
			s = s + x
		else:
			s = s + y
	print(s)


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	c = int(input())
	d = list(map(int, input().split()))
	(x, z, v, n) = (0, 0, 0, 0)
	for i in b:
		if i % 2 == 0:
			x += 1
		else:
			z += 1
	for i in d:
		if i % 2 == 0:
			v += 1
		else:
			n += 1
	print(x * v + z * n)


t = int(input())
for _ in range(t):
	p_par = 0
	p_impar = 0
	q_par = 0
	q_impar = 0
	n = int(input())
	lista_p = list(map(int, input().split()))
	for i in lista_p:
		if i & 1:
			p_impar += 1
		else:
			p_par += 1
	m = int(input())
	lista_q = list(map(int, input().split()))
	for i in lista_q:
		if i & 1:
			q_impar += 1
		else:
			q_par += 1
	print(q_par * p_par + p_impar * q_impar)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	m = int(input())
	B = list(map(int, input().split()))
	(Ap, Ai) = (0, 0)
	for i in range(n):
		Ap += not A[i] % 2
		Ai += A[i] % 2
	(Bp, Bi) = (0, 0)
	for i in range(m):
		Bp += not B[i] % 2
		Bi += B[i] % 2
	print(Ap * Bp + Ai * Bi)


for tc in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	q = int(input())
	lis2 = list(map(int, input().split()))
	countE1 = 0
	countO1 = 0
	countE2 = 0
	countO2 = 0
	for i in lis:
		if i % 2 == 0:
			countE1 += 1
		else:
			countO1 += 1
	for i in lis2:
		if i % 2 == 0:
			countE2 += 1
		else:
			countO2 += 1
	print(countO1 * countO2 + countE1 * countE2)


R = lambda : list(map(int, input().split()))
(t,) = R()
for i in '!' * t:
	(ch_n, ch_m) = (0, 0)
	(n,) = R()
	a = R()
	for i2 in range(n):
		if a[i2] % 2 == 0:
			ch_n += 1
	(m,) = R()
	a = R()
	for i2 in range(m):
		if a[i2] % 2 == 0:
			ch_m += 1
	print(ch_m * ch_n + (n - ch_n) * (m - ch_m))


import sys
T = int(input())
for i in range(T):
	a = int(sys.stdin.readline())
	A = list(map(int, sys.stdin.readline().split()))
	b = int(sys.stdin.readline())
	B = list(map(int, sys.stdin.readline().split()))
	X = []
	Y = []
	for i in range(len(A)):
		X.append(A[i] % 2)
	for i in range(len(B)):
		Y.append(B[i] % 2)
	count = 0
	count = count + X.count(0) * Y.count(0)
	count = count + X.count(1) * Y.count(1)
	print(count)


from math import ceil
for _ in range(int(input())):
	s = 0
	imp = 0
	p = 0
	imp1 = 0
	p1 = 0
	n = int(input())
	l = list(map(int, input().split()))
	r = int(input())
	l1 = list(map(int, input().split()))
	for x in l:
		if x % 2 == 0:
			p += 1
		else:
			imp += 1
	for x in l1:
		if x % 2 == 0:
			p1 += 1
		else:
			imp1 += 1
	print(p * p1 + imp * imp1)


t = int(input())
for test in range(t):
	n = int(input())
	odd1 = len([int(x) for x in input().split() if int(x) % 2])
	even1 = n - odd1
	m = int(input())
	odd2 = len([int(x) for x in input().split() if int(x) % 2])
	even2 = m - odd2
	print(odd1 * odd2 + even1 * even2)


t = int(input())
while t:
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	odd_count_p = len(list(filter(lambda x: x % 2 != 0, p)))
	odd_count_q = len(list(filter(lambda x: x % 2 != 0, q)))
	even_count_p = n - odd_count_p
	even_count_q = m - odd_count_q
	ans = odd_count_p * odd_count_q + even_count_q * even_count_p
	print(ans)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	for i in p:
		if i % 2 != 0:
			c1 += 1
	for j in q:
		if j % 2 != 0:
			c2 += 1
	ans = c1 * c2 + (m - c2) * (n - c1)
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	oddp = 0
	oddq = 0
	for i in range(n):
		if p[i] % 2:
			oddp += 1
	evenp = n - oddp
	for j in range(m):
		if q[j] % 2:
			oddq += 1
	evenq = m - oddq
	print(oddq * oddp + evenp * evenq)


for _ in range(int(input())):
	n1 = int(input())
	l1 = list(map(int, input().split()))
	n2 = int(input())
	l2 = list(map(int, input().split()))
	even1 = even2 = odd1 = odd2 = 0
	cnt = 0
	for i in l1:
		if i % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in l2:
		if i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	if even1 == 0 or even2 == 0:
		cnt += 0
	else:
		cnt += even1 * even2
	if odd1 == 0 or odd2 == 0:
		cnt += 0
	else:
		cnt += odd1 * odd2
	print(cnt)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	m = int(input())
	li1 = list(map(int, input().split()))
	e1 = 0
	o1 = 0
	e2 = 0
	o2 = 0
	for i in li:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in li1:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


n = int(input())
for i in range(n):
	n1 = int(input())
	list1 = [int(x) for x in input().split(' ')]
	n2 = int(input())
	list2 = [int(x) for x in input().split(' ')]
	c11 = 0
	c12 = 0
	c21 = 0
	c22 = 0
	for t in list1:
		if t % 2 == 0:
			c12 += 1
		else:
			c11 += 1
	for t in list2:
		if t % 2 == 0:
			c22 += 1
		else:
			c21 += 1
	print(c11 * c21 + c12 * c22)


import sys
from math import ceil
cin = sys.stdin.buffer.readline
for _ in range(int(cin())):
	n = int(cin())
	(nop, nep, noq, neq) = (0, 0, 0, 0)
	p = list(map(int, cin().split()))
	m = int(cin())
	q = list(map(int, cin().split()))
	for el in p:
		if el % 2 == 0:
			nep += 1
		else:
			nop += 1
	for el in q:
		if el % 2 == 0:
			neq += 1
		else:
			noq += 1
	print(neq * nep + noq * nop)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(p0, q0, p1, q1) = (0, 0, 0, 0)
	for i in range(n):
		if p[i] % 2 == 0:
			p0 += 1
		else:
			p1 += 1
	for i in range(m):
		if q[i] % 2 == 0:
			q0 += 1
		else:
			q1 += 1
	ans = p0 * q0 + p1 * q1
	print(ans)


t = int(input())
for y in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	ne = no = 0
	me = mo = 0
	for i in a:
		if i % 2 == 0:
			ne += 1
		else:
			no += 1
	for i in b:
		if i % 2 == 0:
			me += 1
		else:
			mo += 1
	print(me * ne + mo * no)


t = int(input())
for i in range(t):
	n = int(input())
	x = input()
	p = []
	p = x.split(' ')
	m = input()
	x1 = input()
	q = []
	q = x1.split(' ')
	c_p_even = 0
	c_p_odd = 0
	for j in range(len(p)):
		p[j] = int(p[j])
		if p[j] % 2 == 0:
			c_p_even = c_p_even + 1
		else:
			c_p_odd = c_p_odd + 1
	c_q_even = 0
	c_q_odd = 0
	for j in range(len(q)):
		q[j] = int(q[j])
		if q[j] % 2 == 0:
			c_q_even = c_q_even + 1
		else:
			c_q_odd = c_q_odd + 1
	print(c_q_odd * c_p_odd + c_q_even * c_p_even)


t = int(input())
for i in range(t):
	n = int(input())
	ns = sum([int(x) % 2 for x in input().split()])
	m = int(input())
	ms = sum([int(x) % 2 for x in input().split()])
	print(ns * ms + (n - ns) * (m - ms))


def solve(arr1, arr2, dls, jls):
	odd_dls = len([k for k in arr1 if k & 1])
	odd_jls = len([m for m in arr2 if m & 1])
	(even_dls, even_jls) = (dls - odd_dls, jls - odd_jls)
	return even_dls * even_jls + odd_dls * odd_jls
for _ in range(int(input())):
	dls = int(input())
	dls_arr = list(map(int, input().split()))
	jls = int(input())
	jls_arr = list(map(int, input().split()))
	print(solve(dls_arr, jls_arr, dls, jls))


n = int(input())
for _ in range(n):
	x = int(input())
	p = sum((i % 2 for i in map(int, input().split())))
	y = int(input())
	q = sum((i % 2 for i in map(int, input().split())))
	print((x - p) * (y - q) + p * q)


t = input()
for i in range(int(t)):
	sum = 0
	alist = []
	odd1 = 0
	odd2 = 0
	even1 = 0
	even2 = 0
	for i in range(2):
		c = input()
		k = input()
		alist.append(k.split(' '))
	for j in alist[0]:
		if int(j) % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for k in alist[1]:
		if int(k) % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	sum = odd1 * odd2 + even1 * even2
	print(sum)


import sys
import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True
t = ii()
for i in range(t):
	n = ii()
	p = li()
	m = ii()
	q = li()
	po = pe = qo = qe = 0
	for i in range(n):
		if p[i] % 2 == 0:
			po += 1
		else:
			pe += 1
	for i in range(m):
		if q[i] % 2 == 0:
			qo += 1
		else:
			qe += 1
	print(qo * po + qe * pe)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	co0 = 0
	for i in range(n):
		co0 += p[i] % 2 == 0
	co1 = n - co0
	co2 = 0
	for i in range(m):
		co2 += q[i] % 2 == 0
	co3 = m - co2
	print(co0 * co2 + co1 * co3)


n = int(input())
for i in range(n):
	d = int(input())
	k_d = list(map(float, input().split(' ')))
	j = int(input())
	k_j = list(map(float, input().split(' ')))
	res = 0
	ch_d = 0
	nch_d = 0
	ch_j = 0
	nch_j = 0
	for i in k_d:
		if i % 2 == 0:
			ch_d += 1
		else:
			nch_d += 1
	for i in k_j:
		if i % 2 == 0:
			ch_j += 1
		else:
			nch_j += 1
	res += ch_d * ch_j
	res += nch_d * nch_j
	print(res)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	pOdd = sum([v & 1 for v in p])
	pEven = n - pOdd
	r = 0
	for v in q:
		r += pOdd if v & 1 else pEven
	print(r)


t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	m = int(input())
	B = [int(x) for x in input().split()]
	a = [0, 0]
	b = [0, 0]
	for i in A:
		if i % 2 == 0:
			a[1] += 1
		else:
			a[0] += 1
	for i in B:
		if i % 2 == 0:
			b[1] += 1
		else:
			b[0] += 1
	print(a[0] * b[0] + a[1] * b[1])


t = int(input())
for _ in range(t):
	n1 = int(input())
	l1 = [int(x) & 1 for x in input().split()]
	n2 = int(input())
	l2 = [int(x) & 1 for x in input().split()]
	sumn = sum(l1)
	sumn2 = sum(l2)
	print(sumn * sumn2 + (n1 - sumn) * (n2 - sumn2))


number = int(input())
count = 0
answer = ''
for i in range(number):
	num1 = int(input())
	arr1 = list(map(int, input().split()))
	num2 = int(input())
	arr2 = list(map(int, input().split()))
	arr1 = [x % 2 for x in arr1]
	arr2 = [x % 2 for x in arr2]
	count = arr1.count(1) * arr2.count(1) + arr1.count(0) * arr2.count(0)
	answer += str(count) + '\n'
	count = 0
print(answer)


t = int(input())
for i in range(t):
	q_even = 0
	q_odd = 0
	p_even = 0
	p_odd = 0
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	for j in range(n):
		if p[j] % 2 == 0:
			p_even += 1
		else:
			p_odd += 1
	for j in range(m):
		if q[j] % 2 == 0:
			q_even += 1
		else:
			q_odd += 1
	print(q_odd * p_odd + q_even * p_even)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	op = sum([1 for x in p if x & 1])
	oq = sum([1 for x in q if x & 1])
	print(op * oq + (n - op) * (m - oq))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(oa, ea) = (0, 0)
	for i in range(len(l)):
		if l[i] % 2:
			oa += 1
		else:
			ea += 1
	(ob, eb) = (0, 0)
	for i in range(len(q)):
		if q[i] % 2:
			ob += 1
		else:
			eb += 1
	ans = 0
	if oa != 0 and ob != 0:
		ans += oa * ob
	if eb != 0 and ea != 0:
		ans += ea * eb
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	cnt_odd = [0, 0]
	cnt_even = [0, 0]
	for i in range(n):
		if p[i] % 2 != 0:
			cnt_odd[0] += 1
		else:
			cnt_even[0] += 1
	for i in range(m):
		if q[i] % 2 != 0:
			cnt_odd[1] += 1
		else:
			cnt_even[1] += 1
	ans = cnt_odd[0] * cnt_odd[1] + cnt_even[0] * cnt_even[1]
	print(ans)


for _ in range(int(input())):
	(p, q) = ([], [])
	(pe, po, qe, qo) = (0, 0, 0, 0)
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	for i in p:
		if i % 2 == 0:
			pe += 1
		else:
			po += 1
	for i in q:
		if i % 2 == 0:
			qe += 1
		else:
			qo += 1
	z = po * qo + pe * qe
	print(z)


for _ in [0] * int(input()):
	a = [[0, 0], [0, 0]]
	for i in range(2):
		input()
		for x in [int(x) for x in input().split()]:
			a[i][x % 2] += 1
	print(sum([a[0][i] * a[1][i] for i in range(2)]))


import sys
input = sys.stdin.readline

def read_i():
	return list(map(int, input().split()))

def read_is(n=1):
	return [read_i() for _ in range(n)]
t = int(input())
for _ in range(t):
	n = int(input())
	ps = read_i()
	m = int(input())
	qs = read_i()
	e0 = sum([1 for x in ps if x % 2 == 0])
	o0 = len(ps) - e0
	e1 = sum([1 for x in qs if x % 2 == 0])
	o1 = len(qs) - e1
	print(e0 * e1 + o0 * o1)


t = int(input())
for i in range(t):
	n = int(input())
	p = sum([int(x) % 2 for x in input().split()])
	m = int(input())
	q = sum([int(x) % 2 for x in input().split()])
	print(p * q + (m - q) * (n - p))


n = int(input())
for _ in range(n):
	_ = input()
	p = list(map(int, input().split(' ')))
	_ = input()
	q = list(map(int, input().split(' ')))
	even_p = len(list(filter(lambda x: x % 2 == 0, p)))
	even_q = len(list(filter(lambda x: x % 2 == 0, q)))
	res = even_p * even_q + (len(p) - even_p) * (len(q) - even_q)
	print(res)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	podd = 0
	peven = 0
	qodd = 0
	qeven = 0
	for i in range(n):
		if p[i] % 2 == 0:
			peven += 1
		else:
			podd += 1
	for i in range(m):
		if q[i] % 2 == 0:
			qeven += 1
		else:
			qodd += 1
	ok = True
	if ok:
		print(podd * qodd + peven * qeven)
	else:
		print(0)


for _ in range(int(input())):
	odd = even = odd1 = even1 = 0
	j = int(input())
	ls = map(int, input().split())
	m = int(input())
	ls1 = map(int, input().split())
	for x in ls:
		if x & 1:
			odd += 1
		else:
			even += 1
	for k in ls1:
		if k & 1:
			odd1 += 1
		else:
			even1 += 1
	ans = even * even1 + odd * odd1
	print(ans)


def iip(pl, ql):
	evns = lambda l: sum([i % 2 == 0 for i in l])
	odds = lambda l: sum([i % 2 == 1 for i in l])
	return evns(pl) * evns(ql) + odds(pl) * odds(ql)
t = int(input())
for i in range(t):
	_ = input()
	pl = list(map(int, input().split()))
	_ = input()
	ql = list(map(int, input().split()))
	print(iip(pl, ql))


t = int(input())
for test in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	p = sum(map(lambda x: x % 2, p))
	q = sum(map(lambda x: x % 2, q))
	print(p * q + (n - p) * (m - q))


t = int(input())
kq = []
for i in range(t):
	(n1, n0, m1, m0) = (0, 0, 0, 0)
	n = int(input())
	dn = [int(c) for c in input().split()]
	for j in range(n):
		if dn[j] % 2 == 0:
			n0 = n0 + 1
	n1 = n - n0
	m = int(input())
	dm = [int(c) for c in input().split()]
	for j in range(m):
		if dm[j] % 2 == 0:
			m0 = m0 + 1
	m1 = m - m0
	kq.append(m1 * n1 + m0 * n0)
for i in range(t):
	print(kq[i])


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	e1 = e2 = o1 = o2 = 0
	for i in range(n):
		if a[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in range(m):
		if b[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


def main():
	t = int(input())
	for i in range(0, t):
		n = int(input())
		p_array = list(map(int, input().split(' ')))
		m = int(input())
		q_array = list(map(int, input().split(' ')))
		p_even = 0
		p_odd = 0
		for j in range(0, n):
			if p_array[j] % 2 == 0:
				p_even += 1
			else:
				p_odd += 1
		q_even = 0
		q_odd = 0
		for j in range(0, m):
			if q_array[j] % 2 == 0:
				q_even += 1
			else:
				q_odd += 1
		result = p_even * q_even + p_odd * q_odd
		print(result)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	m = int(input())
	q = [int(i) for i in input().split()]
	e1 = 0
	o1 = 0
	for i in range(n):
		if p[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	e2 = 0
	o2 = 0
	for i in range(m):
		if q[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(min(e1, e2) * max(e1, e2) + min(o1, o2) * max(o1, o2))


t = int(input())
for k in range(0, t):
	n = int(input())
	ni = list(map(int, input().split()))
	m = int(input())
	mi = list(map(int, input().split()))
	odn = 0
	evn = 0
	evm = 0
	odm = 0
	count = 0
	for i in range(0, n):
		if ni[i] % 2 == 0:
			evn = evn + 1
		else:
			odn = odn + 1
	for i in range(0, m):
		if mi[i] % 2 == 0:
			evm = evm + 1
		else:
			odm = odm + 1
	count = evn * evm + odn * odm
	print(count)


times = int(input())
for i in range(times):
	num_DLS = int(input())
	DLS_rows = input().split(' ')
	num_JLS = int(input())
	JLS_rows = input().split(' ')
	DLS_par = 0
	JLS_par = 0
	for j in range(num_DLS):
		if int(DLS_rows[j]) % 2 == 0:
			DLS_par = DLS_par + 1
	for j in range(num_JLS):
		if int(JLS_rows[j]) % 2 == 0:
			JLS_par = JLS_par + 1
	print(JLS_par * DLS_par + (num_DLS - DLS_par) * (num_JLS - JLS_par))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
for _ in range(int(inp())):
	n = iinp()
	a = lmp()
	m = iinp()
	b = lmp()
	(c1, c2) = [0] * 2
	for i in range(max(n, m)):
		if i < n:
			c1 += a[i] % 2
		if i < m:
			c2 += b[i] % 2
	print(c1 * c2 + (n - c1) * (m - c2))


for i in range(int(input())):
	n = int(input())
	arr1 = list(map(int, input().split()))
	m = int(input())
	arr2 = list(map(int, input().split()))
	(odd1, even1, odd2, even2) = (0, 0, 0, 0)
	for i in arr1:
		if i % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in arr2:
		if i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(odd1 * odd2 + even1 * even2)


t = int(input())
for i in range(t):
	n = int(input())
	array = [int(s) for s in input().split()]
	m = int(input())
	array2 = [int(s) for s in input().split()]
	chet_1 = 0
	nechet_1 = 0
	for elem in array:
		if elem % 2:
			nechet_1 += 1
		else:
			chet_1 += 1
	chet_2 = 0
	nechet_2 = 0
	for elem in array2:
		if elem % 2:
			nechet_2 += 1
		else:
			chet_2 += 1
	print(chet_1 * chet_2 + nechet_2 * nechet_1)


import sys
import os
from io import IOBase, BytesIO

def main():
	from collections import Counter
	for tc in range(int(input())):
		n = int(input())
		a = get_array()
		for i in range(n):
			if a[i] % 2 == 1:
				a[i] = 1
			else:
				a[i] = 0
		m = int(input())
		b = get_array()
		for i in range(m):
			if b[i] % 2 == 1:
				b[i] = 1
			else:
				b[i] = 0
		d1 = Counter(a)
		d2 = Counter(b)
		ans = 0
		if 0 in d1 and 0 in d2:
			ans += d1[0] * d2[0]
		if 1 in d1 and 1 in d2:
			ans += d1[1] * d2[1]
		print(ans)
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()
main()


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	evenP = 0
	oddP = 0
	evenQ = 0
	oddQ = 0
	for i in p:
		if i % 2 == 0:
			evenP += 1
		else:
			oddP += 1
	for j in q:
		if j % 2 == 0:
			evenQ += 1
		else:
			oddQ += 1
	total = evenP * evenQ + oddP * oddQ
	print(total)


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
inf = 1e+18
div = 998244353
for _ in range(inn()):
	n = inn()
	a = arr()
	oa = 0
	ea = 0
	for i in a:
		if i % 2 == 0:
			ea += 1
		else:
			oa += 1
	m = inn()
	b = arr()
	ob = 0
	eb = 0
	for i in b:
		if i % 2 == 0:
			eb += 1
		else:
			ob += 1
	print(oa * ob + ea * eb)


for _ in range(int(input())):
	n1 = int(input())
	s1 = sum(map(lambda x: int(x) % 2, input().split()))
	a1 = n1 - s1
	n2 = int(input())
	s2 = sum(map(lambda x: int(x) % 2, input().split()))
	a2 = n2 - s2
	print(s1 * s2 + a1 * a2)


t = int(input())
for x in range(t):
	n = int(input())
	A = [int(a) for a in input().split()]
	m = int(input())
	B = [int(b) for b in input().split()]
	(oa, ea, ob, eb) = (0, 0, 0, 0)
	for i in A:
		if i % 2 == 1:
			oa += 1
		else:
			ea += 1
	for i in B:
		if i % 2 == 1:
			ob += 1
		else:
			eb += 1
	print(oa * ob + ea * eb)


t = int(input())
while t != 0:
	n = int(input())
	p = input()
	p = p.split(' ')
	ep = 0
	op = 0
	for i in range(n):
		if int(p[i]) % 2 == 0:
			ep += 1
		else:
			op += 1
	m = int(input())
	q = input()
	q = q.split(' ')
	eq = 0
	oq = 0
	for i in range(m):
		if int(q[i]) % 2 == 0:
			eq += 1
		else:
			oq += 1
	print(op * oq + ep * eq)
	t -= 1


def read_coefficients():
	num_lines = int(input())
	evens = 0
	odds = 0
	for c in input().split():
		c = int(c)
		if c % 2 == 0:
			evens += 1
		else:
			odds += 1
	return (evens, odds)
num_tests = int(input())
for test in range(num_tests):
	(pos_even, pos_odd) = read_coefficients()
	(neg_even, neg_odd) = read_coefficients()
	answer = pos_even * neg_even + pos_odd * neg_odd
	print(answer)


for x in range(int(input())):
	(a, k) = (int(input()), len(list(filter(lambda x: int(x) % 2, input().split()))))
	(b, l) = (int(input()), len(list(filter(lambda x: int(x) % 2, input().split()))))
	print(k * l + (a - k) * (b - l))


t = int(input())
for i in range(t):
	n = int(input())
	l1 = [int(x) for x in input().split()]
	m = int(input())
	l2 = [int(x) for x in input().split()]
	o1 = 0
	o2 = 0
	e1 = 0
	e2 = 0
	for i in range(n):
		if l1[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in range(m):
		if l2[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(o1 * o2 + e1 * e2)


for _ in range(int(input())):
	(i, j, k, l) = (0, 0, 0, 0)
	a = int(input())
	la = [int(x) for x in input().split()]
	b = int(input())
	lb = [int(x) for x in input().split()]
	for x in la:
		if x % 2 == 0:
			i += 1
		else:
			j += 1
	for x in lb:
		if x % 2 == 0:
			k += 1
		else:
			l += 1
	print(i * k + j * l)


for _ in range(int(input())):
	n1 = int(input())
	p = list(map(int, input().split()))
	n2 = int(input())
	q = list(map(int, input().split()))
	(o1, o2, e1, e2) = (0, 0, 0, 0)
	for i in p:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in q:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


for _ in range(int(input())):
	n1 = int(input())
	arr1 = list(map(int, input().split()))
	n2 = int(input())
	arr2 = list(map(int, input().split()))
	e1 = 0
	o1 = 0
	for i in arr1:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	e2 = 0
	o2 = 0
	for i in arr2:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


for _ in range(int(input())):
	n = int(input())
	N = list(map(int, input().split()))
	m = int(input())
	M = list(map(int, input().split()))
	n0 = 0
	n1 = 0
	m0 = 0
	m1 = 0
	for i in range(n):
		if N[i] % 2 == 0:
			n0 += 1
		else:
			n1 += 1
	for i in range(m):
		if M[i] % 2 == 0:
			m0 += 1
		else:
			m1 += 1
	print(m0 * n0 + n1 * m1)


from sys import stdin

def input():
	return stdin.readline()[:-1]

def intput():
	return int(input())

def sinput():
	return input().split()

def intsput():
	return map(int, sinput())
t = intput()
for _ in range(t):
	n = intput()
	p = intsput()
	m = intput()
	q = intsput()
	oddp = 0
	for x in p:
		if x % 2:
			oddp += 1
	oddq = 0
	for x in q:
		if x % 2:
			oddq += 1
	evenp = n - oddp
	evenq = m - oddq
	print(evenp * evenq + oddp * oddq)


tests = int(input())
for test in range(tests):
	n = int(input())
	pi = list(map(int, input().split()))
	m = int(input())
	qi = list(map(int, input().split()))
	pi2 = 0
	pi1 = 0
	qi2 = 0
	qi1 = 0
	result = 0
	for el in pi:
		if el % 2 == 0:
			pi2 += 1
		else:
			pi1 += 1
	for el in qi:
		if el % 2 == 0:
			qi2 += 1
		else:
			qi1 += 1
	result += pi2 * qi2
	result += pi1 * qi1
	print(result)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(e1, e2) = (0, 0)
	for i in range(n):
		if p[i] % 2 == 0:
			e1 += 1
	for i in range(m):
		if q[i] % 2 == 0:
			e2 += 1
	print(e1 * e2 + (n - e1) * (m - e2))


T = int(input())
for _ in range(0, T):
	n = int(input())
	s1 = [int(x) for x in input().split()]
	m = int(input())
	s2 = [int(x) for x in input().split()]
	c1 = 0
	c2 = 0
	for i in range(0, len(s1)):
		if abs(s1[i]) % 2 == 0:
			c2 += 1
		else:
			c1 += 1
	ans = 0
	for i in range(0, len(s2)):
		if abs(s2[i]) % 2 == 0:
			ans += c2
		else:
			ans += c1
	print(ans)


for a0 in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(p_odd, p_eve) = (0, 0)
	(q_odd, q_eve) = (0, 0)
	for i in p:
		if i & 1 == 0:
			p_eve += 1
		else:
			p_odd += 1
	for i in q:
		if i & 1 == 0:
			q_eve += 1
		else:
			q_odd += 1
	print(p_eve * q_eve + p_odd * q_odd)


t = int(input())
for i in range(t):
	z1 = 0
	f1 = 0
	z2 = 0
	f2 = 0
	s = 0
	n = int(input())
	p = [int(z) for z in input().split(' ')]
	m = int(input())
	q = [int(z) for z in input().split(' ')]
	for j in range(n):
		if p[j] % 2 == 0:
			z1 = z1 + 1
		else:
			f1 = f1 + 1
	for k in range(m):
		if q[k] % 2 == 0:
			z2 = z2 + 1
		else:
			f2 = f2 + 1
	s = z1 * z2 + f1 * f2
	print(s)


t = int(input())
for item in range(t):
	n = int(input())
	p = [int(i) for i in input().split(' ')]
	m = int(input())
	q = [int(i) for i in input().split(' ')]
	count = 0
	n_odd = 0
	n_even = 0
	n_zero = 0
	m_odd = 0
	m_even = 0
	m_zero = 0
	for j in range(n):
		if p[j] % 2 == 0:
			n_even += 1
		elif p[j] == 0:
			n_zero += 1
		else:
			n_odd += 1
	for k in range(m):
		if q[k] % 2 == 0:
			m_even += 1
		elif q[k] == 0:
			m_zero += 1
		else:
			m_odd += 1
	count = m_zero * (n_zero + n_even) + m_odd * n_odd + m_even * (n_zero + n_even)
	print(count)


T = int(input())
answer = ''
for t in range(T):
	n = int(input())
	P = list(map(int, input().split(' ')))
	m = int(input())
	Q = list(map(int, input().split(' ')))
	p1 = p2 = q1 = q2 = 0
	for p in P:
		if p % 2 == 0:
			p2 += 1
		else:
			p1 += 1
	for q in Q:
		if q % 2 == 0:
			q2 += 1
		else:
			q1 += 1
	answer += str(p1 * q1 + p2 * q2) + '\n'
print(answer)


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	p = [int(el) for el in sys.stdin.readline().strip().split()]
	ch_p = 0
	nch_p = 0
	for pi in p:
		if pi % 2 == 0:
			ch_p += 1
		else:
			nch_p += 1
	m = int(sys.stdin.readline().strip())
	q = [int(el) for el in sys.stdin.readline().strip().split()]
	ch_q = 0
	nch_q = 0
	for qi in q:
		if qi % 2 == 0:
			ch_q += 1
		else:
			nch_q += 1
	print(ch_p * ch_q + nch_p * nch_q)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
for _ in range(get_int()):
	n1 = get_int()
	p = get_int_list()
	n2 = get_int()
	q = get_int_list()
	lst1 = [0, 0]
	lst2 = [0, 0]
	for i in range(n1):
		if p[i] % 2 == 0:
			lst1[0] += 1
		else:
			lst1[1] += 1
	for j in range(n2):
		if q[j] % 2 == 0:
			lst2[0] += 1
		else:
			lst2[1] += 1
	print(lst1[0] * lst2[0] + lst1[1] * lst2[1])


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	even = even1 = odd = odd1 = 0
	for j in range(n):
		even += a[j] % 2 == 0
		odd += a[j] % 2 == 1
	for j in range(m):
		even1 += b[j] % 2 == 0
		odd1 += b[j] % 2 == 1
	print(even * even1 + odd * odd1)


from sys import stdin, stdout
input = stdin.readline

def MAP():
	return map(int, input().split())

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def main():
	for i in range(int(input())):
		_1 = int(input())
		__ = [0, 0, 0, 0]
		ls = list(map(int, input().split()))
		for j in range(_1):
			if ls[j] % 2 == 0:
				__[0] += 1
			else:
				__[1] += 1
		_1 = int(input())
		ls = list(map(int, input().split()))
		for j in range(_1):
			if ls[j] % 2 == 0:
				__[2] += 1
			else:
				__[3] += 1
		print(sum([__[0] * __[2], __[1] * __[3]]))
main()


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	p = set([int(x) for x in input().split()])
	m = int(input())
	q = set([int(x) for x in input().split()])
	o1 = 0
	e1 = 0
	for i in p:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	o2 = 0
	e2 = 0
	for i in q:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	ans = o1 * o2 + e1 * e2
	print(ans)


import sys
input = sys.stdin.readline
for case in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	cntle1 = 0
	cntchan1 = 0
	cntle2 = 0
	cntchan2 = 0
	for i in range(n):
		if a[i] % 2 == 0:
			cntchan1 += 1
		else:
			cntle1 += 1
	for i in range(m):
		if b[i] % 2 == 0:
			cntchan2 += 1
		else:
			cntle2 += 1
	print(cntchan1 * cntchan2 + cntle1 * cntle2)


t = int(input())
p = []
q = []
for i in range(t):
	n = input()
	p.extend((int(x) for x in input().split()))
	m = input()
	q.extend((int(x) for x in input().split()))
	nrpp = 0
	nrpi = 0
	nrqp = 0
	nrqi = 0
	for x in p:
		if x % 2 == 0:
			nrpp += 1
		else:
			nrpi += 1
	for x in q:
		if x % 2 == 0:
			nrqp += 1
		else:
			nrqi += 1
	nr = nrpp * nrqp + nrpi * nrqi
	print(nr)
	p.clear()
	q.clear()


T = int(input())
for i in range(T):
	N = int(input())
	ps = list(map(int, input().split()))
	M = int(input())
	qs = list(map(int, input().split()))
	peven = 0
	podd = 0
	for i in ps:
		if i % 2 == 0:
			peven += 1
		else:
			podd += 1
	qeven = 0
	qodd = 0
	for i in qs:
		if i % 2 == 0:
			qeven += 1
		else:
			qodd += 1
	print(qeven * peven + qodd * podd)


import math

def solve(p_s, q_s):
	p_mod2s = [0, 0]
	q_mod2s = [0, 0]
	for p in p_s:
		if p % 2 == 0:
			p_mod2s[0] += 1
		else:
			p_mod2s[1] += 1
	for q in q_s:
		if q % 2 == 0:
			q_mod2s[0] += 1
		else:
			q_mod2s[1] += 1
	return p_mod2s[0] * q_mod2s[0] + p_mod2s[1] * q_mod2s[1]
t = int(input())
for _ in range(t):
	n = int(input())
	dls_s = [int(r) for r in input().split(' ')]
	m = int(input())
	jls_s = [int(r) for r in input().split(' ')]
	print(solve(dls_s, jls_s))


def solve(n, ps, m, qs):
	(nodd, neven) = (0, 0)
	for q in qs:
		if q % 2 == 0:
			neven += 1
		else:
			nodd += 1
	nint = 0
	for p in ps:
		if p % 2 == 0:
			nint += neven
		else:
			nint += nodd
	print(nint)
ntests = int(input())
for _ in range(ntests):
	n = int(input())
	ps = map(int, input().split())
	m = int(input())
	qs = map(int, input().split())
	solve(n, ps, m, qs)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		p = LI()
		m = I()
		q = LI()
		a = [0, 0]
		b = [0, 0]
		for c in p:
			a[c % 2] += 1
		for c in q:
			b[c % 2] += 1
		rr.append(sum((c * d for (c, d) in zip(a, b))))
	return JA(rr, '\n')
print(main())


t = int(input())
for i in range(t):
	pe = 0
	po = 0
	n = int(input())
	plist = list(map(int, input().split()))
	for p in plist:
		if p % 2 == 0:
			pe += 1
		else:
			po += 1
	qe = 0
	qo = 0
	n = int(input())
	qlist = list(map(int, input().split()))
	for q in qlist:
		if q % 2 == 0:
			qe += 1
		else:
			qo += 1
	print(qo * po + qe * pe)


def read():
	n = int(input())
	par = impar = 0
	for x in input().split():
		x = int(x)
		if x % 2 == 0:
			par += 1
		else:
			impar += 1
	return (par, impar)
t = int(input())
for i in range(t):
	(par1, impar1) = read()
	(par2, impar2) = read()
	print(par1 * par2 + impar1 * impar2)


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	l_n = list(map(int, sys.stdin.readline().split()))
	m = int(input())
	l_m = list(map(int, sys.stdin.readline().split()))
	cnt = 0
	even_n = len(list(filter(lambda x: x % 2 == 0, l_n)))
	even_m = len(list(filter(lambda x: x % 2 == 0, l_m)))
	odd_n = len(list(filter(lambda x: x % 2 != 0, l_n)))
	odd_m = len(list(filter(lambda x: x % 2 != 0, l_m)))
	evens = even_m * even_n
	odds = odd_n * odd_m
	print(evens + odds)


n = int(input())
for j in range(n):
	d = int(input())
	c = list(map(int, input().split()))
	j = int(input())
	e = list(map(int, input().split()))
	cec = 0
	coc = 0
	cee = 0
	coe = 0
	for elem in c:
		if elem % 2 == 0:
			cec += 1
		else:
			coc += 1
	for elem in e:
		if elem % 2 == 0:
			cee += 1
		else:
			coe += 1
	print(cec * cee + coe * coc)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = int(input())
	p = [int(x) for x in input().split()]
	odda = 0
	oddp = 0
	evena = 0
	evenp = 0
	for i in a:
		if i & 1:
			odda += 1
		else:
			evena += 1
	for i in p:
		if i & 1:
			oddp += 1
		else:
			evenp += 1
	print(odda * oddp + evena * evenp)


for _ in range(int(input())):
	n = int(input())
	p = sorted(list(map(int, input().split())))
	m = int(input())
	q = sorted(list(map(int, input().split())))
	(ep, op, eq, oq) = (0, 0, 0, 0)
	for i in p:
		if i == 0:
			ep += 1
		elif i % 2 == 0:
			ep += 1
		else:
			op += 1
	for i in q:
		if i == 0:
			eq += 1
		elif i % 2 == 0:
			eq += 1
		else:
			oq += 1
	print(oq * op + eq * ep)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	if min(p) >= 0 and min(q) >= 0:
		evn = oddn = evm = oddm = 0
		for i in range(n):
			if p[i] % 2 == 0:
				evn += 1
			else:
				oddn += 1
		for i in range(m):
			if q[i] % 2 == 0:
				evm += 1
			else:
				oddm += 1
		print(evn * evm + oddn * oddm)


for _ in range(int(input())):
	a = int(input())
	p = list(map(int, input().split()))
	b = int(input())
	q = list(map(int, input().split()))
	o1 = len([x for x in p if x % 2 != 0])
	o2 = len([x for x in q if x % 2 != 0])
	e1 = len([x for x in p if x % 2 == 0])
	e2 = len([x for x in q if x % 2 == 0])
	print(o1 * o2 + e1 * e2)


cases = int(input())
for tc in range(cases):
	pn = int(input())
	p = [int(num) % 2 for num in input().split()]
	qn = int(input())
	q = [int(num) % 2 for num in input().split()]
	count = p.count(0) * q.count(0)
	count += p.count(1) * q.count(1)
	print(count)


x = int(input())
for __ in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	k0 = 0
	k1 = 0
	for i in a:
		if i % 2 == 0:
			k0 += 1
		else:
			k1 += 1
	k2 = 0
	k3 = 0
	for i in b:
		if i % 2 == 0:
			k2 += 1
		else:
			k3 += 1
	print(k0 * k2 + k1 * k3)


tc = int(input())
outs = []
for i in range(tc):
	n1 = int(input())
	c1 = [int(x) for x in input().split()]
	n2 = int(input())
	c2 = [int(x) for x in input().split()]
	count = 0
	t1 = [0, 0]
	for x1 in c1:
		if x1 % 2 == 0:
			t1[0] += 1
		else:
			t1[1] += 1
	t2 = [0, 0]
	for x2 in c2:
		if x2 % 2 == 0:
			t2[0] += 1
		else:
			t2[1] += 1
	count = t1[0] * t2[0] + t1[1] * t2[1]
	outs.append(count)
for i in outs:
	print(i)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))[:n]
	m = int(input())
	q = list(map(int, input().split()))[:m]
	odd_p = sum([1 for i in p if i & 1])
	even_p = n - odd_p
	odd_q = sum([1 for i in q if i & 1])
	even_q = m - odd_q
	ac = 0
	for i in p:
		if i & 1:
			ac += odd_q
		else:
			ac += even_q
	print(ac)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	n1 = int(input())
	a1 = list(map(int, input().split()))
	n2 = int(input())
	a2 = list(map(int, input().split()))
	c11 = 0
	c12 = 0
	c21 = 0
	c22 = 0
	for i in range(0, n1):
		if a1[i] % 2 == 1:
			c11 = c11 + 1
		else:
			c12 = c12 + 1
	for i in range(0, n2):
		if a2[i] % 2 == 1:
			c21 = c21 + 1
		else:
			c22 = c22 + 1
	print(c12 * c22 + c21 * c11)


import sys
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for _ in range(t):
	n = int(input())
	P = list(map(int, input().split()))
	m = int(input())
	Q = list(map(int, input().split()))
	(pe, qe) = (0, 0)
	for p in P:
		if p % 2 == 0:
			pe += 1
	for q in Q:
		if q % 2 == 0:
			qe += 1
	ans = pe * qe + (n - pe) * (m - qe)
	print(ans)


for i in range(int(input())):
	input()
	X = list(map(int, input().split()))
	input()
	X1 = list(map(int, input().split()))
	(Even1, Even2, Odd1, Odd2) = (len(list(filter(lambda x: x % 2 == 0, X))), len(list(filter(lambda x: x % 2 == 0, X1))), len(list(filter(lambda x: x % 2 == 1, X))), len(list(filter(lambda x: x % 2 == 1, X1))))
	print(Even1 * Even2 + Odd1 * Odd2)


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		p = getlist()
		m = int(input())
		q = getlist()
		a = 0
		b = 0
		c = 0
		d = 0
		for i in range(n):
			if p[i] % 2 == 0:
				a += 1
			else:
				b += 1
		for i in range(m):
			if q[i] % 2 == 0:
				c += 1
			else:
				d += 1
		ans = a * c + b * d
		print(ans)
main()


ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
import math
for _ in range(ii()):
	n = ii()
	p = il()
	m = ii()
	q = il()
	d = 0
	x = 0
	y = 0
	z = 0
	for i in range(n):
		if p[i] % 2 == 0:
			x = x + 1
		else:
			d = d + 1
	for i in range(m):
		if q[i] % 2 == 0:
			y = y + 1
		else:
			z = z + 1
	print(x * y + d * z)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(a, b, c, d) = (0, 0, 0, 0)
	for e in p:
		if e % 2 == 0:
			a = a + 1
		else:
			b = b + 1
	for w in q:
		if w % 2 == 0:
			c = c + 1
		else:
			d = d + 1
	print(a * c + b * d)


t = int(input())

def main():
	n = int(input())
	list1 = [int(x) for x in input().split()]
	odd1 = 0
	odd2 = 0
	even1 = 0
	even2 = 0
	for i in range(0, n):
		if list1[i] % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	m = int(input())
	list2 = [int(x) for x in input().split()]
	for i in range(0, m):
		if list2[i] % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(odd1 * odd2 + even1 * even2)
while t > 0:
	main()
	t -= 1


t = int(input())
while t != 0:
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	odd1 = 0
	for i in range(n):
		if p[i] % 2 != 0:
			odd1 = odd1 + 1
	odd2 = 0
	for i in range(m):
		if q[i] % 2 != 0:
			odd2 = odd2 + 1
	print(odd1 * odd2 + (n - odd1) * (m - odd2))
	t = t - 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(lambda x: int(x) % 2, input().split()))
	m = int(input())
	b = list(map(lambda x: int(x) % 2, input().split()))
	print(a.count(0) * b.count(0) + a.count(1) * b.count(1))


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	even = 0
	odd = 0
	for i in range(n):
		if a[i] % 2 == 0:
			even += 1
		else:
			odd += 1
	ans = 0
	for i in range(m):
		if b[i] % 2 == 0:
			ans += even
		else:
			ans += odd
	print(ans)


def even_am(arr):
	even = 0
	for el in arr:
		if el % 2 == 0:
			even += 1
	return even
T = int(input())
ans = []
for i in range(T):
	n = int(input())
	n_arr = list(map(int, input().split()))
	m = int(input())
	m_arr = list(map(int, input().split()))
	n_even = even_am(n_arr)
	m_even = even_am(m_arr)
	ans.append(n_even * m_even + (len(n_arr) - n_even) * (len(m_arr) - m_even))
for el in ans:
	print(el)


t = int(input())
for i in range(t):
	n = int(input())
	arr1 = list(map(int, input().split()))
	m = int(input())
	arr2 = list(map(int, input().split()))
	ch1 = 0
	nh1 = 0
	ch2 = 0
	nh2 = 0
	for i in range(n):
		if arr1[i] % 2 == 0:
			ch1 += 1
		else:
			nh1 += 1
	for i in range(m):
		if arr2[i] % 2 == 0:
			ch2 += 1
		else:
			nh2 += 1
	s = 0
	s += ch1 * ch2
	s += nh1 * nh2
	print(s)


from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
fac_warm_up = False
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7

class MergeFind:

	def __init__(self, n):
		self.parent = list(range(n))
		self.size = [1] * n
		self.num_sets = n
		self.lista = [[_] for _ in range(n)]

	def find(self, a):
		to_update = []
		while a != self.parent[a]:
			to_update.append(a)
			a = self.parent[a]
		for b in to_update:
			self.parent[b] = a
		return self.parent[a]

	def merge(self, a, b):
		a = self.find(a)
		b = self.find(b)
		if a == b:
			return
		if self.size[a] < self.size[b]:
			(a, b) = (b, a)
		self.num_sets -= 1
		self.parent[b] = a
		self.size[a] += self.size[b]
		self.lista[a] += self.lista[b]

	def set_size(self, a):
		return self.size[self.find(a)]

	def __len__(self):
		return self.num_sets

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def prime_factors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def all_factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def fibonacci_modP(n, MOD):
	if n < 2:
		return 1
	return (cached_fn(fibonacci_modP, (n + 1) // 2, MOD) * cached_fn(fibonacci_modP, n // 2, MOD) + cached_fn(fibonacci_modP, (n - 1) // 2, MOD) * cached_fn(fibonacci_modP, (n - 2) // 2, MOD)) % MOD

def factorial_modP_Wilson(n, p):
	if p <= n:
		return 0
	res = p - 1
	for i in range(n + 1, p):
		res = res * cached_fn(InverseEuler, i, p) % p
	return res

def binary(n, digits=20):
	b = bin(n)[2:]
	b = '0' * (digits - len(b)) + b
	return b

def is_prime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def generate_primes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	return prime
factorial_modP = []

def warm_up_fac(MOD):
	global factorial_modP, fac_warm_up
	if fac_warm_up:
		return
	factorial_modP = [1 for _ in range(fac_warm_up_size + 1)]
	for i in range(2, fac_warm_up_size):
		factorial_modP[i] = factorial_modP[i - 1] * i % MOD
	fac_warm_up = True

def InverseEuler(n, MOD):
	return pow(n, MOD - 2, MOD)

def nCr(n, r, MOD):
	global fac_warm_up, factorial_modP
	if not fac_warm_up:
		warm_up_fac(MOD)
		fac_warm_up = True
	return factorial_modP[n] * (pow(factorial_modP[r], MOD - 2, MOD) * pow(factorial_modP[n - r], MOD - 2, MOD) % MOD) % MOD

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def ncr(n, r):
	return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))

def binary_search(i, li):
	fn = lambda x: li[x] - x // i
	x = -1
	b = len(li)
	while b >= 1:
		while b + x < len(li) and fn(b + x) > 0:
			x += b
		b = b // 2
	return x
TestCases = True
optimise_for_recursion = True

def main():
	n = get_int()
	li1 = get_list()
	n2 = get_int()
	li2 = get_list()
	o1 = len([x for x in li1 if x % 2 == 1])
	o2 = len([x for x in li2 if x % 2 == 1])
	e2 = len([x for x in li2 if x % 2 == 0])
	e1 = len([x for x in li1 if x % 2 == 0])
	print(o1 * o2 + e1 * e2)
if TestCases:
	for i in range(get_int()):
		main()
else:
	main() if not optimise_for_recursion else threading.Thread(target=main).start()


from sys import stdin

def solve(n, p, m, q):
	ans = 0
	oddn = 0
	evenn = 0
	oddm = 0
	evenm = 0
	for i in range(n):
		if p[i] % 2 == 0:
			evenn += 1
		else:
			oddn += 1
	for i in range(m):
		if q[i] % 2 == 0:
			evenm += 1
		else:
			oddm += 1
	return evenn * evenm + oddn * oddm

def main():
	t = int(input())
	chunk = []
	for i in range(t):
		n = int(input())
		p = list(map(int, input().split()))
		m = int(input())
		q = list(map(int, input().split()))
		chunk.append([n, p, m, q])
	for idx in range(t):
		print(solve(*chunk[idx]))
main()


cases = int(input())
i = 0
while i < cases:
	(o1, o2) = (0, 0)
	(e1, e2) = (0, 0)
	n = int(input())
	l1 = input().split()
	m = int(input())
	l2 = input().split()
	for j in l1:
		if int(j) % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for k in l2:
		if int(k) % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)
	i += 1
9


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	xn = list(map(int, sys.stdin.readline().split()))
	m = int(sys.stdin.readline())
	xm = list(map(int, sys.stdin.readline().split()))
	no = 0
	ne = 0
	for i in xn:
		if i % 2 == 0:
			no += 1
		else:
			ne += 1
	mo = 0
	me = 0
	for i in xm:
		if i % 2 == 0:
			mo += 1
		else:
			me += 1
	print(mo * no + me * ne)


T = int(input().strip())
for cas in range(T):
	n = int(input().strip())
	listp = list(map(int, input().strip().split()))
	p1 = p2 = 0
	for i in range(n):
		if listp[i] % 2 == 0:
			p1 = p1 + 1
		else:
			p2 = p2 + 1
	m = int(input().strip())
	listq = list(map(int, input().strip().split()))
	q1 = q2 = 0
	for i in range(m):
		if listq[i] % 2 == 0:
			q1 = q1 + 1
		else:
			q2 = q2 + 1
	print(q1 * p1 + q2 * p2)


t = int(input())
r = []
for z in ' ' * t:
	n = int(input())
	(*l1,) = map(int, input().split())
	m = int(input())
	(*l2,) = map(int, input().split())
	ch1 = 0
	ch2 = 0
	for i in l1:
		if i % 2 == 0:
			ch1 += 1
	for j in l2:
		if j % 2 == 0:
			ch2 += 1
	c = ch1 * ch2 + (len(l1) - ch1) * (len(l2) - ch2)
	r += [c]
for i in r:
	print(i)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	n = inp()
	a = inpl()
	m = inp()
	b = inpl()
	o = [0, 0]
	e = [0, 0]
	for x in a:
		if x % 2:
			o[0] += 1
		else:
			e[0] += 1
	for x in b:
		if x % 2:
			o[1] += 1
		else:
			e[1] += 1
	print(o[0] * o[1] + e[0] * e[1])


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())
mod = 1000000007
inf = float('inf')

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	m = ii()
	b = li()
	c = 0
	e = 0
	o = 0
	for j in range(m):
		if b[j] % 2 == 0:
			e += 1
		else:
			o += 1
	for i in range(n):
		if a[i] % 2 == 0:
			c += e
		else:
			c += o
	print(c)


n = int(input())
for i in range(n):
	oddb = 0
	odda = 0
	input()
	a = list(map(int, input().split()))
	input()
	b = list(map(int, input().split()))
	for j in a:
		if j % 2:
			odda += 1
	evena = len(a) - odda
	for j in b:
		if j % 2:
			oddb += 1
	evenb = len(b) - oddb
	print(odda * oddb + evena * evenb)


def ii():
	a = int(input())
	return a

def ai():
	a = list(map(int, input().split()))
	return a

def mi():
	a = map(int, input().split())
	return a
for _ in range(ii()):
	n = ii()
	lst = ai()
	(e, o) = (0, 0)
	for i in lst:
		if i % 2:
			o += 1
		else:
			e += 1
	m = ii()
	l = ai()
	(e1, o1) = (0, 0)
	for i in l:
		if i % 2:
			o1 += 1
		else:
			e1 += 1
	print(e * e1 + o * o1)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
mod = 998244353
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	p = list(inp())
	m = ip()
	q = list(inp())
	dicp = {0: 0, 1: 0}
	dicq = dict(dicp)
	for i in p:
		dicp[i % 2] += 1
	for i in q:
		dicq[i % 2] += 1
	ans = dicp[1] * dicq[1] + dicp[0] * dicq[0]
	out(ans)


answers = []
T = int(input())
for t in range(T):
	oddsA = oddsB = evensA = evensB = 0
	input()
	for ii in input().split():
		i = int(ii)
		if i % 2 == 0:
			evensA += 1
		else:
			oddsA += 1
	input()
	for ii in input().split():
		i = int(ii)
		if i % 2 == 0:
			evensB += 1
		else:
			oddsB += 1
	answers.append(evensA * evensB + oddsA * oddsB)
for i in answers:
	print(i)


def power(x, y):
	res = 1
	x = x
	while y > 0:
		if y & 1 == 1:
			res = res * x
		y = y >> 1
		x = x * x
	return res
import math
t = int(input())
for _ in range(t):
	n = int(input())
	arr1 = list(map(int, input().split()))
	count = 0
	m = int(input())
	arr2 = list(map(int, input().split()))
	even1 = 0
	even2 = 0
	odd1 = 0
	odd2 = 0
	for i in range(n):
		if arr1[i] % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in range(m):
		if arr2[i] % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	count = even1 * even2 + odd1 * odd2
	print(count)


n = int(input())
for i in range(n):
	x = int(input())
	a = list(map(int, input().split()))
	y = int(input())
	b = list(map(int, input().split()))
	e1 = 0
	e2 = 0
	o1 = 0
	o2 = 0
	for j in range(x):
		if a[j] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for j in range(y):
		if b[j] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = [int(x) % 2 for x in input().split()]
	m = int(input())
	l2 = [int(x) % 2 for x in input().split()]
	print(l1.count(0) * l2.count(0) + l1.count(1) * l2.count(1))


I = input
for i in range(int(I())):
	N = int(I())
	X = sum(map(lambda x: x % 2, map(int, I().split())))
	N1 = int(I())
	X1 = sum(map(lambda x: x % 2, map(int, I().split())))
	print(X * X1 + (N - X) * (N1 - X1))


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(float, input().split()))
	m = int(input())
	b = list(map(float, input().split()))
	odd1 = odd2 = even1 = even2 = 0
	for (i, x) in enumerate(a):
		if x % 2:
			odd1 += 1
		else:
			even1 += 1
	for (i, y) in enumerate(b):
		if y % 2:
			odd2 += 1
		else:
			even2 += 1
	ans = odd1 * odd2 + even1 * even2
	print(ans)
	t -= 1


i = lambda : [*map(int, input().split())]
exec(i()[0] * 'n=i()[0];x=sum(x%2 for x in i());m=i()[0];y=sum(y%2 for y in i());print(x*y+(n-x)*(m-y));')


test_cases = int(input())
for i in range(test_cases):
	integer = 0
	DLS_lines = int(input())
	DLS = [int(x) % 2 for x in input().split()]
	JLS_lines = int(input())
	JLS = [int(x) % 2 for x in input().split()]
	DLS_even = DLS.count(0)
	DLS_odd = DLS_lines - DLS_even
	JLS_even = JLS.count(0)
	JLS_odd = JLS_lines - JLS_even
	print(DLS_odd * JLS_odd + DLS_even * JLS_even)


t = int(input())
for it in range(t):
	n = int(input())
	pe = list(map(lambda x: True if int(x) % 2 == 0 else False, input().split())).count(True)
	po = n - pe
	m = int(input())
	qe = list(map(lambda x: True if int(x) % 2 == 0 else False, input().split())).count(True)
	qo = m - qe
	ii = pe * qe + po * qo
	print(ii)


N = int(input())
for _ in range(N):
	input()
	d = [int(x) for x in input().split()]
	input()
	j = [int(x) for x in input().split()]
	print(len([i for i in d if i % 2 == 0]) * len([i for i in j if i % 2 == 0]) + len([i for i in d if abs(i) % 2 == 1]) * len([i for i in j if abs(i) % 2 == 1]))


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	m = int(input())
	b = [*map(int, input().split())]
	(oa, ob, ea, eb) = (0, 0, 0, 0)
	for i in a:
		if i % 2 == 0:
			oa += 1
		else:
			ea += 1
	for i in b:
		if i % 2 == 0:
			ob += 1
		else:
			eb += 1
	print(oa * ob + ea * eb)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	even = []
	odd = []
	for i in p:
		if i % 2 == 0:
			even.append(i)
		else:
			odd.append(i)
	m = int(input())
	q = list(map(int, input().split()))
	even1 = []
	odd1 = []
	for i in q:
		if i % 2 == 0:
			even1.append(i)
		else:
			odd1.append(i)
	count = len(even) * len(even1)
	count += len(odd) * len(odd1)
	print(count)


def inp(type):
	return type(input())

def minput(type):
	return map(type, input().split())

def linput(type):
	return list(minput(type))

def check(map, elem):
	if not map.__contains__(elem):
		map[elem] = set()
for t in range(inp(int)):
	even1 = odd1 = 0
	even2 = odd2 = 0
	input()
	for i in linput(int):
		if i % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	input()
	for i in linput(int):
		if i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(even1 * even2 + odd1 * odd2)


for _ in range(int(input())):
	n = int(input())
	nn = sum((int(a) & 1 for a in input().split()))
	m = int(input())
	mm = sum((int(a) & 1 for a in input().split()))
	print(nn * mm + (n - nn) * (m - mm))


n1 = int(input())
for x in range(n1):
	p = int(input())
	pi = list(map(int, input().split(' ')[:p]))
	for y in range(p):
		pi[y] = pi[y] % 2
	q = int(input())
	qi = list(map(int, input().split(' ')[:q]))
	for y in range(q):
		qi[y] = qi[y] % 2
	podd = sum(pi)
	qodd = sum(qi)
	peven = p - podd
	qeven = q - qodd
	print(podd * qodd + qeven * peven)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().strip().split()))
	m = int(input())
	q = list(map(int, input().strip().split()))
	o1 = 0
	e1 = 0
	o2 = 0
	e2 = 0
	for j in range(n):
		if p[j] % 2 == 0:
			e1 = e1 + 1
		else:
			o1 = o1 + 1
	for j in range(m):
		if q[j] % 2 == 0:
			e2 = e2 + 1
		else:
			o2 = o2 + 1
	print(e1 * e2 + o1 * o2)


def read_int():
	return int(input())

def read_str():
	return input().strip()

def solve(px, qx):
	count_even_p = 0
	for p in px:
		if p % 2 == 0:
			count_even_p += 1
	count_even_q = 0
	for q in qx:
		if q % 2 == 0:
			count_even_q += 1
	return count_even_p * count_even_q + (len(px) - count_even_p) * (len(qx) - count_even_q)
for t in range(read_int()):
	n = read_int()
	px = list(map(int, read_str().split()))
	m = read_int()
	qx = list(map(int, read_str().split()))
	count = solve(px, qx)
	print('%s' % count)


def ab():
	b = int(input())
	c = list(map(int, input().split()))
	e = int(input())
	f = list(map(int, input().split()))
	m = 0
	n = 0
	p = 0
	q = 0
	z = 0
	for i in range(0, b):
		if c[i] & 1:
			n += 1
		else:
			m += 1
	for i in range(0, e):
		if f[i] & 1:
			q += 1
		else:
			p += 1
	z = n * q + p * m
	print(z)
for i in range(0, int(input())):
	ab()


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	p1 = 0
	for i in range(n):
		if p[i] % 2 == 1:
			p1 += 1
	q1 = 0
	for i in range(m):
		if q[i] % 2 == 1:
			q1 += 1
	print(p1 * q1 + (n - p1) * (m - q1))


t = int(input())
for _ in range(t):
	n = int(input())
	p_list = list(map(int, input().split()))
	m = int(input())
	q_list = list(map(int, input().split()))
	p_odd = len([p for p in p_list if p % 2 == 1])
	p_eve = len(p_list) - p_odd
	q_odd = len([q for q in q_list if q % 2 == 1])
	q_eve = len(q_list) - q_odd
	print(p_odd * q_odd + p_eve * q_eve)


for _ in range(int(input())):
	n1 = int(input())
	l1 = list(map(int, input().split()))
	n2 = int(input())
	l2 = list(map(int, input().split()))
	(e1, o1, e2, o2) = (0, 0, 0, 0)
	for i in l1:
		e1 += not i & 1
		o1 += i & 1
	for i in l2:
		e2 += not i & 1
		o2 += i & 1
	print(o1 * o2 + e1 * e2)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scan_int = lambda : int(input())
scan_string = lambda : input().rstrip()
read_list = lambda : list(read())
read = lambda : map(int, input().split())
read_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	n = scan_int()
	p = read_list()
	m = scan_int()
	q = read_list()
	mod1 = [0, 0]
	mod2 = [0, 0]
	for x in p:
		mod1[x % 2] += 1
	for x in q:
		mod2[x % 2] += 1
	s = 0
	for i in range(2):
		s += mod1[i] * mod2[i]
	print(s)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(int(input())):
	solve()


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
for j in range(ii()):
	(a1, a0, b1, b0) = (0, 0, 0, 0)
	n = ii()
	ar = li()
	for i in ar:
		if i & 1:
			a0 += 1
		else:
			a1 += 1
	m = ii()
	br = li()
	for j in br:
		if j & 1:
			b0 += 1
		else:
			b1 += 1
	print(a1 * b1 + a0 * b0)


t = int(input())
for i in range(t):
	ne = 0
	me = 0
	n = int(input())
	nn = list(map(int, input().split()))
	m = int(input())
	mm = list(map(int, input().split()))
	for j in range(n):
		if nn[j] % 2 == 0:
			ne += 1
	for h in range(m):
		if mm[h] % 2 == 0:
			me += 1
	no = n - ne
	mo = m - me
	print(no * mo + ne * me)


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = [int(x) for x in input().split()]
	m = int(input())
	l2 = [int(x) for x in input().split()]
	(p0, p1, q0, q1) = (0, 0, 0, 0)
	for i in l1:
		if i % 2 == 0:
			p0 += 1
		else:
			p1 += 1
	for i in l2:
		if i % 2 == 0:
			q0 += 1
		else:
			q1 += 1
	print(p0 * q0 + p1 * q1)


n = int(input())
d = []
for i in range(n):
	c = 0
	c1 = 0
	c2 = 0
	c3 = 0
	j = int(input())
	a = list(map(int, input().split()))
	k = int(input())
	b = list(map(int, input().split()))
	for x in range(j):
		if a[x] % 2 == 0:
			c += 1
		else:
			c1 += 1
	for x in range(k):
		if b[x] % 2 == 0:
			c2 += 1
		else:
			c3 += 1
	d.append(c * c2 + c1 * c3)
for i in range(n):
	print(d[i])


import math
import bisect
import collections
import itertools
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd, Counter as ctr
from bisect import bisect_left as bl, bisect_right as br
from itertools import permutations as pr, combinations as cb
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))

def results(p, n, q, m):
	(e1, e2, o1, o2) = (0, 0, 0, 0)
	for i in range(0, n):
		if p[i] & 1:
			o1 += 1
		else:
			e1 += 1
	for i in range(0, m):
		if q[i] & 1:
			o2 += 1
		else:
			e2 += 1
	return e1 * e2 + o1 * o2

def main():
	t = inp()
	for _ in range(t):
		n = inp()
		p = seq()
		m = inp()
		q = seq()
		result = results(p, n, q, m)
		print(result)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	P = list(map(int, input().split()))
	m = int(input())
	Q = list(map(int, input().split()))
	odd_p = odd_q = e_p = e_q = 0
	for p in P:
		if p % 2 == 0:
			e_p += 1
		else:
			odd_p += 1
	for q in Q:
		if q % 2 == 0:
			e_q += 1
		else:
			odd_q += 1
	res = odd_p * odd_q + e_p * e_q
	print(res)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
from collections import *

def li():
	return [int(____) for ____ in input().rstrip('\n').split(' ')]

def val():
	return int(input().rstrip('\n'))

def st():
	return input().rstrip('\n')

def sttoli():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	p = li()
	m = val()
	q = li()
	odd = even = 0
	for i in p:
		if i & 1:
			odd += 1
		else:
			even += 1
	odd2 = even2 = 0
	for i in q:
		if i & 1:
			odd2 += 1
		else:
			even2 += 1
	print(odd * odd2 + even * even2)


T = int(input())
ans = [0 for t in range(T)]
for t in range(T):
	n = int(input())
	P = tuple(map(int, input().split()))
	ctr = [0, 0]
	for p in P:
		ctr[abs(p) & 1] += 1
	m = int(input())
	for q in tuple(map(int, input().split())):
		ans[t] += ctr[abs(q) & 1]
print('\n'.join(map(str, ans)))


from sys import stdin, stdout
from collections import Counter
import math

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def rmult_str():
	return stdin.readline().rstrip().split()

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def sortFirst(val):
	return val[0]

def main():
	t = rsingle_int()
	for _ in range(t):
		n = rsingle_int()
		ns = rmult_int()
		m = rsingle_int()
		ms = rmult_int()
		even_ns = 0
		odd_ns = 0
		for el in ns:
			if el % 2 == 0:
				even_ns += 1
			else:
				odd_ns += 1
		even_ms = 0
		odd_ms = 0
		for el in ms:
			if el % 2 == 0:
				even_ms += 1
			else:
				odd_ms += 1
		print(even_ms * even_ns + odd_ms * odd_ns)
main()


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = Counter((int(v) % 2 for v in input().split()))
	m = int(input())
	b = Counter((int(v) % 2 for v in input().split()))
	print(a[0] * b[0] + a[1] * b[1])


for _ in range(int(input())):
	n = int(input())
	p = sum((int(ch) % 2 for ch in input().split()))
	m = int(input())
	q = sum((int(ch) % 2 for ch in input().split()))
	print(p * q + (n - p) * (m - q))


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	odd1 = 0
	even1 = 0
	odd2 = 0
	even2 = 0
	for j in range(n):
		if p[j] % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for j in range(m):
		if q[j] % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	c = odd1 * odd2 + even1 * even2
	print(c)


t = int(input())
for _ in range(t):
	n = int(input())
	pe = 0
	po = 0
	for x in input().split():
		a = int(x)
		if abs(a) % 2 == 0:
			pe += 1
		else:
			po += 1
	m = int(input())
	qe = 0
	qo = 0
	for x in input().split():
		a = int(x)
		if abs(a) % 2 == 0:
			qe += 1
		else:
			qo += 1
	print(pe * qe + po * qo)


from sys import stdin, stdout
test_case_count = int(stdin.readline())
for test_case_num in range(test_case_count):
	dls_count = int(stdin.readline())
	dls_numbers = stdin.readline().split(' ')
	jls_count = int(stdin.readline())
	jls_numbers = stdin.readline().split(' ')
	(dls_odd, dls_even) = (0, 0)
	for num in dls_numbers:
		if int(num) % 2 == 0:
			dls_even += 1
		else:
			dls_odd += 1
	(jls_odd, jls_even) = (0, 0)
	for num in jls_numbers:
		if int(num) % 2 == 0:
			jls_even += 1
		else:
			jls_odd += 1
	res = jls_even * dls_even + jls_odd * dls_odd
	stdout.write(str(res) + '\n')


t = int(input())
while t:
	n = int(input())
	p = input().split()
	c1 = 0
	c2 = 0
	for i in range(n):
		if int(p[i]) % 2 == 0:
			c2 += 1
		else:
			c1 += 1
	m = int(input())
	q = input().split()
	c3 = 0
	c4 = 0
	for i in range(m):
		if int(q[i]) % 2 == 0:
			c4 += 1
		else:
			c3 += 1
	print(c1 * c3 + c2 * c4)
	t -= 1


queries = int(input())
for x in range(queries):
	n = int(input())
	p = input()
	p = p.split()
	p = [int(x) for x in p]
	m = int(input())
	q = input()
	q = q.split()
	q = [int(x) for x in q]
	count = 0
	qevens = 0
	qodds = 0
	pevens = 0
	podds = 0
	for x in q:
		if x % 2 == 0:
			qevens += 1
		else:
			qodds += 1
	for x in p:
		if x % 2 == 0:
			pevens += 1
		else:
			podds += 1
	print(qevens * pevens + qodds * podds)


for test in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(par1, par2) = (0, 0)
	for i in p:
		if i % 2 == 0:
			par1 += 1
	for i in q:
		if i % 2 == 0:
			par2 += 1
	print(par1 * par2 + (n - par1) * (m - par2))


t = int(input())
for i in range(t):
	even = 0
	odd = 0
	n = int(input())
	p_array = [int(x) for x in input().split()]
	for p in p_array:
		if p % 2 == 0:
			even += 1
		else:
			odd += 1
	m = int(input())
	q_array = [int(x) for x in input().split()]
	even_after = 0
	odd_after = 0
	for q in q_array:
		if q % 2 == 0:
			even_after += 1
		else:
			odd_after += 1
	print(odd * odd_after + even * even_after)


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for _ in range(t):
	n = int(inp().strip())
	pi = [int(x) for x in inp().strip().split()]
	m = int(inp().strip())
	qi = [int(x) for x in inp().strip().split()]
	odd1 = 0
	odd2 = 0
	even1 = 0
	even2 = 0
	for i in pi:
		if i % 2:
			odd1 += 1
		else:
			even1 += 1
	for i in qi:
		if i % 2:
			odd2 += 1
		else:
			even2 += 1
	print(str(odd1 * odd2 + even1 * even2))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	cnt1O = sum((i % 2 for i in a))
	cnt2O = sum((i % 2 for i in b))
	cnt1E = sum((1 - i % 2 for i in a))
	cnt2E = sum((1 - i % 2 for i in b))
	print(cnt1O * cnt2O + cnt1E * cnt2E)


for _ in range(int(input())):
	n = int(input())
	r1 = list(map(int, input().split()))
	m = int(input())
	r2 = list(map(int, input().split()))
	o11 = sum((t % 2 for t in r1))
	o12 = n - o11
	o21 = sum((t % 2 for t in r2))
	o22 = m - o21
	print(o11 * o21 + o12 * o22)


t = int(input())
for i in range(t):
	n = int(input())
	ch = input()
	L = [int(i) for i in ch.split()]
	nbpL = 0
	nbimpL = 0
	for i in L:
		if i % 2 == 0:
			nbpL += 1
		else:
			nbimpL += 1
	m = int(input())
	ch2 = input()
	L2 = [int(i) for i in ch2.split()]
	nbpL2 = 0
	nbimpL2 = 0
	for i in L2:
		if i % 2 == 0:
			nbpL2 += 1
		else:
			nbimpL2 += 1
	print(nbpL * nbpL2 + nbimpL * nbimpL2)


for _ in range(int(input())):
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	e1 = 0
	o1 = 0
	e2 = 0
	o2 = 0
	for i in p:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in q:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(o1 * o2 + e1 * e2)


def count_even(a):
	ans = 0
	for i in a:
		if i % 2 == 0:
			ans += 1
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	arr1 = list(map(int, input().split()))
	m = int(input())
	arr2 = list(map(int, input().split()))
	even_arr1 = count_even(arr1)
	odd_arr1 = even_arr1 - n
	even_arr2 = count_even(arr2)
	odd_arr2 = even_arr2 - m
	print(even_arr1 * even_arr2 + odd_arr1 * odd_arr2)


t = int(input())
for i in range(t):
	o1 = 0
	o2 = 0
	e1 = 0
	e2 = 0
	n1 = int(input())
	l1 = [int(i) for i in input().split()]
	n2 = int(input())
	l2 = [int(i) for i in input().split()]
	for j in l1:
		if j % 2 == 1:
			o1 += 1
		else:
			e1 += 1
	for j in l2:
		if j % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(o1 * o2 + e1 * e2)


n = int(input())
for i in range(n):
	a = int(input())
	f = [int(x) for x in input().split()]
	b = int(input())
	g = [int(x) for x in input().split()]
	odd1 = 0
	even1 = 0
	for h in range(a):
		if f[h] % 2 == 0:
			even1 += 1
	odd1 = a - even1
	odd2 = 0
	even2 = 0
	for h in range(b):
		if g[h] % 2 == 0:
			even2 += 1
	odd2 = b - even2
	print(odd2 * odd1 + even1 * even2)


class points:

	def asdf(t):
		for i in range(t):
			n = int(input())
			p = [int(i) for i in input().split()][:n]
			m = int(input())
			q = [int(i) for i in input().split()][:m]
			c = 0
			e1 = 0
			o1 = 0
			e2 = 0
			o2 = 0
			for i in p:
				if i % 2 == 0:
					e1 += 1
				else:
					o1 += 1
			for j in q:
				if j % 2 == 0:
					e2 += 1
				else:
					o2 += 1
			c = e1 * e2 + o1 * o2
			print(c)
	t = int(input())
	asdf(t)


t = int(input())
for you in range(t):
	n = int(input())
	l1 = input().split()
	m = int(input())
	l2 = input().split()
	count1 = 0
	count2 = 0
	for i in l1:
		if int(i) % 2:
			count1 += 1
	for i in l2:
		if int(i) % 2:
			count2 += 1
	print(count1 * count2 + (n - count1) * (m - count2))


import os
import heapq
import sys
import math
import bisect
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	for _ in range(int(input())):
		n = int(input())
		pos = inar()
		m = int(input())
		neg = inar()
		pos_even = 0
		pos_odd = 0
		neg_even = 0
		neg_odd = 0
		for i in range(n):
			if pos[i] % 2 == 0:
				pos_even += 1
			else:
				pos_odd += 1
		for i in range(m):
			if neg[i] % 2 == 0:
				neg_even += 1
			else:
				neg_odd += 1
		print(neg_even * pos_even + pos_odd * neg_odd)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	input()
	ps = map(int, input().split())
	input()
	qs = map(int, input().split())
	(po, pe) = (0, 0)
	(qo, qe) = (0, 0)
	for p in ps:
		if p % 2 == 0:
			pe += 1
		else:
			po += 1
	for q in qs:
		if q % 2 == 0:
			qe += 1
		else:
			qo += 1
	print(po * qo + pe * qe)


for i in range(int(input())):
	_1 = int(input())
	__ = [0, 0, 0, 0]
	ls = list(map(int, input().split()))
	for j in range(_1):
		if ls[j] % 2 == 0:
			__[0] += 1
		else:
			__[1] += 1
	_1 = int(input())
	ls = list(map(int, input().split()))
	for j in range(_1):
		if ls[j] % 2 == 0:
			__[2] += 1
		else:
			__[3] += 1
	print(sum([__[0] * __[2], __[1] * __[3]]))


t = int(input())
for _ in range(t):
	n1 = int(input())
	x1 = list(map(int, input().split()))
	n2 = int(input())
	x2 = list(map(int, input().split()))
	o1 = 0
	o2 = 0
	e1 = 0
	e2 = 0
	for i in x1:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for j in x2:
		if j % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	cnt1 = 0
	cnt2 = 0
	for i in p:
		if i % 2 == 0:
			cnt1 += 1
	for j in q:
		if j % 2 == 0:
			cnt2 += 1
	res = cnt1 * cnt2 + (n - cnt1) * (m - cnt2)
	print(res)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		arrp = L()
		m = I()
		arrq = L()
		(c1, c2) = (0, 0)
		for i in range(n):
			if arrp[i] % 2 == 0:
				c1 += 1
			else:
				c2 += 1
		(c3, c4) = (0, 0)
		for i in range(m):
			if arrq[i] % 2 == 0:
				c3 += 1
			else:
				c4 += 1
		print(c1 * c3 + c2 * c4)
main()


import sys
input = sys.stdin.readline

def solve():
	t = int(input())
	for i in range(t):
		n = int(input())
		p = list(map(int, input().split(' ')))
		m = int(input())
		q = list(map(int, input().split(' ')))
		(p_odd, p_even, q_odd, q_even) = (0, 0, 0, 0)
		for item in p:
			if item % 2 == 0:
				p_even += 1
			else:
				p_odd += 1
		for item in q:
			if item % 2 == 0:
				q_even += 1
			else:
				q_odd += 1
		print(p_odd * q_odd + p_even * q_even)
solve()


from sys import stdin, stdout
t = int(stdin.readline())

def count(L1):
	c = 0
	for a in L1:
		if a % 2 == 0:
			c += 1
	return c
for a in range(t):
	m = int(stdin.readline())
	L1 = list(map(int, stdin.readline().split()))
	n = int(stdin.readline())
	L2 = list(map(int, stdin.readline().split()))
	stdout.write(str(count(L1) * count(L2) + (len(L1) - count(L1)) * (len(L2) - count(L2))))
	stdout.write('\n')


t = int(input())
for _ in range(t):
	n = int(input())
	arr1 = [int(p) for p in input().split()]
	m = int(input())
	arr2 = [int(p) for p in input().split()]
	countOdd = 0
	countEven = 0
	for i in range(len(arr2)):
		if arr2[i] % 2 == 0:
			countEven += 1
		else:
			countOdd += 1
	total = 0
	for i in range(len(arr1)):
		if arr1[i] % 2 != 0:
			total += countOdd
		else:
			total += countEven
	print(total)


for _ in range(int(input())):
	n = int(input())
	a1 = list(map(int, input().split()))
	m = int(input())
	a2 = list(map(int, input().split()))
	s = [0] * 4
	for i in range(n):
		if a1[i] % 2 == 0:
			s[0] += 1
		else:
			s[1] += 1
	for j in range(m):
		if a2[j] % 2 == 0:
			s[2] += 1
		else:
			s[3] += 1
	print(s[0] * s[2] + s[1] * s[3])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	x = sum([1 if i % 2 == 0 else 0 for i in a])
	y = n - x
	p = sum([1 if i % 2 == 0 else 0 for i in b])
	q = m - p
	print(x * p + y * q)


conj = set()
t = input()
c = 0
a = set()
b = set()
c = set()
d = set()
for l in range(int(t)):
	n = int(input())
	pi = input().split(' ')
	m = int(input())
	qi = input().split(' ')
	for i in range(n):
		if int(pi[i]) % 2 == 0:
			a.add(pi[i])
		else:
			b.add(pi[i])
	for j in range(m):
		if int(qi[j]) % 2 == 0:
			c.add(qi[j])
		else:
			d.add(qi[j])
	tam = len(a) * len(c) + len(b) * len(d)
	print(tam)
	tam = 0
	a = set()
	b = set()
	c = set()
	d = set()


import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(item) for item in input().split()]
	m = int(input())
	b = [int(item) for item in input().split()]
	a_even = 0
	a_odd = 0
	for item in a:
		if item % 2 == 0:
			a_even += 1
		else:
			a_odd += 1
	b_even = 0
	b_odd = 0
	for item in b:
		if item % 2 == 0:
			b_even += 1
		else:
			b_odd += 1
	print(a_even * b_even + a_odd * b_odd)


t = int(input())
for i in range(t):
	n = int(input())
	tmp = input().split()
	ps = [int(i) for i in tmp]
	m = int(input())
	tmp = input().split()
	qs = [int(i) for i in tmp]
	ans = 0
	oddsP = 0
	evensP = 0
	oddsQ = 0
	evensQ = 0
	for j in ps:
		if j % 2:
			oddsP = oddsP + 1
		else:
			evensP = evensP + 1
	for j in qs:
		if j % 2:
			oddsQ = oddsQ + 1
		else:
			evensQ = evensQ + 1
	ans = oddsP * oddsQ + evensP * evensQ
	print(ans)


case = int(input())
for i in range(case):
	a = input()
	x = [int(v) % 2 for v in input().split()]
	b = input()
	y = [int(u) % 2 for u in input().split()]
	ox = sum(x)
	oy = sum(y)
	print(ox * oy + (len(x) - ox) * (len(y) - oy))


for test in range(int(input())):
	n = int(input())
	ch = 0
	nch = 0
	for i in map(int, input().split()):
		ch += i % 2 == 0
		nch += i % 2
	m = int(input())
	ans = 0
	for i in map(int, input().split()):
		if i % 2:
			ans += nch
		else:
			ans += ch
	print(ans)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	pi = list(map(int, input().split()))
	m = int(input())
	qi = list(map(int, input().split()))
	oddp = 0
	evenp = 0
	oddq = 0
	evenq = 0
	for s in range(n):
		if pi[s] % 2 == 1:
			oddp += 1
		else:
			evenp += 1
	for s in range(m):
		if qi[s] % 2 == 1:
			oddq += 1
		else:
			evenq += 1
	print(oddp * oddq + evenp * evenq)


for _ in range(int(input())):
	n1 = int(input())
	DLS = list(map(lambda x: int(x) % 2, input().split()))
	n2 = int(input())
	JLS = list(map(lambda x: int(x) % 2, input().split()))
	cnt1 = DLS.count(1)
	cnt2 = JLS.count(1)
	print(cnt1 * cnt2 + (n1 - cnt1) * (n2 - cnt2))


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	k1 = 0
	k2 = 0
	for i in p:
		if i % 2 != 0:
			k1 += 1
	for i in q:
		if i % 2 != 0:
			k2 += 1
	print(k1 * k2 + (n - k1) * (m - k2))


t = int(input())
for i in range(t):
	n = int(input())
	gp = input()
	m = int(input())
	gq = input()
	p = [int(j) for j in gp.split(' ')]
	q = [int(u) for u in gq.split(' ')]
	evenp = 0
	evenq = 0
	for r in p:
		if r % 2 == 0:
			evenp = evenp + 1
	for l in q:
		if l % 2 == 0:
			evenq = evenq + 1
	print(evenq * evenp + (n - evenp) * (m - evenq))


t = int(input())
while t:
	n = int(input())
	pi = input()
	pi = pi.split()
	m = int(input())
	ji = input()
	ji = ji.split()
	odp = 0
	evp = 0
	odj = 0
	evj = 0
	for i in range(n):
		if int(pi[i]) % 2 == 0:
			evp = evp + 1
		else:
			odp = odp + 1
	for j in range(m):
		if int(ji[j]) % 2 == 0:
			evj = evj + 1
		else:
			odj = odj + 1
	out = evj * evp + odj * odp
	print(out)
	t = t - 1


for rpt in range(int(input())):
	Dcount = int(input())
	Dlines = [int(x) for x in input().split(' ')]
	Jcount = int(input())
	Jlines = [int(x) for x in input().split(' ')]
	Deven = 0
	for i in Dlines:
		if i % 2 == 0:
			Deven += 1
	Jeven = 0
	for i in Jlines:
		if i % 2 == 0:
			Jeven += 1
	print(Deven * Jeven + (Dcount - Deven) * (Jcount - Jeven))


for _ in range(int(input())):
	n = int(input())
	a = map(int, input().split())
	m = int(input())
	b = map(int, input().split())
	odd_a = len(list(filter(lambda x: x % 2 != 0, a)))
	even_a = abs(odd_a - n)
	odd_b = len(list(filter(lambda x: x % 2 != 0, b)))
	even_b = abs(odd_b - m)
	print(odd_a * odd_b + even_a * even_b)


from math import ceil
for i in range(int(input())):
	n = int(input())
	p = tuple(filter(lambda x: int(x) % 2, input().split()))
	m = int(input())
	q = tuple(filter(lambda x: int(x) % 2, input().split()))
	(x, y) = (len(q), len(p))
	print(x * y + (n - y) * (m - x))


import sys

def rint():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().rstrip('\n')

def oint():
	return int(input())
t = oint()
for _ in range(t):
	n = oint()
	p = list(rint())
	m = oint()
	q = list(rint())
	po = 0
	pe = 0
	for i in range(n):
		if p[i] % 2:
			po += 1
		else:
			pe += 1
	qo = 0
	qe = 0
	for i in range(m):
		if q[i] % 2:
			qo += 1
		else:
			qe += 1
	print(po * qo + pe * qe)


for q in range(int(input())):
	n = int(input())
	set1 = list(map(int, input().split()))
	m = int(input())
	set2 = list(map(int, input().split()))
	(Ae, Ao, Be, Bo) = (0, 0, 0, 0)
	for i in range(n):
		if set1[i] % 2 == 0:
			Ae += 1
		else:
			Ao += 1
	for i in range(m):
		if set2[i] % 2 == 0:
			Be += 1
		else:
			Bo += 1
	print(Ae * Be + Ao * Bo)


t = int(input())
for case in range(t):
	n = int(input())
	p = [int(a) for a in input().split(' ')]
	m = int(input())
	q = [int(b) for b in input().split(' ')]
	p_odds = len([a for a in p if a % 2])
	q_odds = len([b for b in q if b % 2])
	ans = p_odds * q_odds + (n - p_odds) * (m - q_odds)
	print(ans)


T = int(input())
for _ in range(T):
	N = int(input())
	p = [int(x) for x in input().split()]
	M = int(input())
	q = [int(x) for x in input().split()]
	p_odd = len(list(filter(lambda x: x % 2 == 1, p)))
	p_even = len(list(filter(lambda x: x % 2 == 0, p)))
	q_odd = len(list(filter(lambda x: x % 2 == 1, q)))
	q_even = len(list(filter(lambda x: x % 2 == 0, q)))
	print(p_odd * q_odd + p_even * q_even)


tests = int(input())
while tests > 0:
	tests -= 1
	ans = 0
	n = int(input())
	ps = list(map(lambda x: int(x), input().split(' ')))
	m = int(input())
	qs = list(map(lambda x: int(x), input().split(' ')))
	p1 = 0
	p2 = 0
	q1 = 0
	q2 = 0
	for p in ps:
		if p % 2 == 0:
			p1 += 1
		else:
			p2 += 1
	for p in qs:
		if p % 2 == 0:
			q1 += 1
		else:
			q2 += 1
	print(p1 * q1 + q2 * p2)


t = int(input())
for i in range(t):
	n = int(input())
	p = tuple(map(int, input().split()))
	m = int(input())
	q = tuple(map(int, input().split()))
	a = 0
	b = 0
	c = 0
	d = 0
	for j in p:
		if j % 2 == 0:
			a += 1
		else:
			b += 1
	for k in q:
		if k % 2 == 0:
			c += 1
		else:
			d += 1
	print(a * c + b * d)


t = int(input())
for i in range(t):
	n = int(input())
	ps = list(map(int, input().split()))
	p0 = sum([1 for j in ps if j % 2 == 0])
	p1 = sum([1 for j in ps if j % 2 != 0])
	m = int(input())
	qs = list(map(int, input().split()))
	q0 = sum([1 for j in qs if j % 2 == 0])
	q1 = sum([1 for j in qs if j % 2 != 0])
	print(p0 * q0 + p1 * q1)


t = int(input())
for i in range(t):
	count = 0
	np = int(input())
	p = list(map(int, input().split(' ')))
	nq = int(input())
	q = list(map(int, input().split(' ')))
	ce1 = 0
	co1 = 0
	for j in p:
		if j % 2 == 0:
			ce1 += 1
		else:
			co1 += 1
	ce2 = 0
	co2 = 0
	for k in q:
		if k % 2 == 0:
			ce2 += 1
		else:
			co2 += 1
	count = co1 * co2 + ce1 * ce2
	print(count)


for _ in range(int(input())):
	input()
	pc = [0, 0]
	qc = [0, 0]
	for p in map(int, input().split()):
		pc[p % 2] += 1
	input()
	for q in map(int, input().split()):
		qc[q % 2] += 1
	print(pc[0] * qc[0] + pc[1] * qc[1])


t = int(input())
result = []
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	p_odd = 0
	p_even = 0
	q_odd = 0
	q_even = 0
	for i in range(n):
		p_odd += p[i] % 2 == 1
		p_even += p[i] % 2 == 0
	for i in range(m):
		q_odd += q[i] % 2 == 1
		q_even += q[i] % 2 == 0
	result.append(p_odd * q_odd + p_even * q_even)
for i in range(t):
	print(result[i])


x = lambda : map(int, input().split())
for _ in ' ' * int(input()):
	a = int(input())
	o = sum((i % 2 for i in x()))
	c = int(input())
	o1 = sum((i % 2 for i in x()))
	print((a - o) * (c - o1) + o * o1)


t = int(input())
for _ in range(t):
	n1 = int(input())
	l1 = list(map(int, input().split()))
	n2 = int(input())
	l2 = list(map(int, input().split()))
	l1_odd = 0
	l1_even = 0
	for i in l1:
		if i % 2 == 0:
			l1_even += 1
		else:
			l1_odd += 1
	l2_odd = 0
	l2_even = 0
	for i in l2:
		if i % 2 == 0:
			l2_even += 1
		else:
			l2_odd += 1
	print(l2_odd * l1_odd + l1_even * l2_even)


import math
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	n2 = int(input())
	y = list(map(int, input().split()))
	cnt = 0
	evnx = 0
	oddx = 0
	evny = 0
	oddy = 0
	for i in range(n):
		if x[i] % 2 == 0:
			evnx = evnx + 1
		else:
			oddx += 1
	for i in range(n2):
		if y[i] % 2 == 0:
			evny = evny + 1
		else:
			oddy += 1
	if evnx > 0 and evny > 0:
		cnt += evnx * evny
	if oddx > 0 and oddy > 0:
		cnt += oddx * oddy
	print(cnt)


t = int(input())
for testCase in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	m = int(input())
	q = [int(i) for i in input().split()]
	count = 0
	evenp = 0
	evenq = 0
	oddp = 0
	oddq = 0
	for i in p:
		if i % 2 == 0:
			evenp += 1
		else:
			oddp += 1
	for j in q:
		if j % 2 == 0:
			evenq += 1
		else:
			oddq += 1
	count = evenp * evenq + oddp * oddq
	print(count)


for _ in range(int(input())):
	(n, p) = (int(input()), sum(map(lambda x: int(x) % 2, input().split())))
	(m, q) = (int(input()), sum(map(lambda x: int(x) % 2, input().split())))
	print(p * q + (n - p) * (m - q))


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def minput():
	return map(int, input().split())

def listinput():
	return list(map(int, input().split()))
for _ in range(iinput()):
	n = iinput()
	p = listinput()
	(even_p, odd_p) = (0, 0)
	for i in p:
		if i % 2 == 0:
			even_p += 1
		else:
			odd_p += 1
	m = iinput()
	q = listinput()
	(even_q, odd_q) = (0, 0)
	for i in q:
		if i % 2 == 0:
			even_q += 1
		else:
			odd_q += 1
	print(even_p * even_q + odd_p * odd_q)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	podd = 0
	peven = 0
	for j in range(n):
		if p[j] % 2:
			podd += 1
		else:
			peven += 1
	m = int(input())
	q = list(map(int, input().split()))
	qodd = 0
	qeven = 0
	for j in range(m):
		if q[j] % 2:
			qodd += 1
		else:
			qeven += 1
	print(podd * qodd + peven * qeven)


t = int(input())
for _ in range(t):
	n = int(input())
	p0 = len(list(filter(lambda x: x % 2 == 0, list(map(int, input().split())))))
	p1 = n - p0
	m = int(input())
	q0 = len(list(filter(lambda x: x % 2 == 0, list(map(int, input().split())))))
	q1 = m - q0
	print(q0 * p0 + q1 * p1)


n = int(input())
for i in range(n):
	q = int(input())
	a = list(map(int, input().strip().split()))
	w = int(input())
	b = list(map(int, input().strip().split()))
	c = 0
	r = 0
	d = 0
	t = 0
	for i in a:
		if i % 2 == 0:
			c += 1
		else:
			r += 1
	for i in b:
		if i % 2 == 0:
			d += 1
		else:
			t += 1
	print(c * d + r * t)


ans = []
n = int(input())
for k in range(n):
	nums = []
	D = int(input())
	DLS = list(map(int, input().split()))
	n = 0
	for num in DLS:
		if num % 2 == 0:
			n += 1
	nums.append(n)
	nums.append(D - n)
	J = int(input())
	JLS = list(map(int, input().split()))
	n = 0
	for num in JLS:
		if num % 2 == 0:
			n += 1
	nums.append(n)
	nums.append(J - n)
	ans.append(nums[0] * nums[2] + nums[1] * nums[3])
for el in ans:
	print(el)


t = int(input())
answer = []
for i in range(t):
	n = int(input())
	arr_n = list(map(int, input().split()))
	odd_n = 0
	even_n = 0
	for j in range(n):
		if arr_n[j] % 2 == 1:
			odd_n += 1
		else:
			even_n += 1
	m = int(input())
	arr_m = list(map(int, input().split()))
	odd_m = 0
	even_m = 0
	for j in range(m):
		if arr_m[j] % 2 == 1:
			odd_m += 1
		else:
			even_m += 1
	answer.append(odd_m * odd_n + even_n * even_m)
for i in range(t):
	print(answer[i])


for _ in range(int(input())):
	n = int(input())
	(P_count_even, P_count_odd, Q_count_even, Q_count_odd) = (0, 0, 0, 0)
	P = list(map(int, input().split()))
	m = int(input())
	Q = list(map(int, input().split()))
	for j in P:
		if j % 2 == 0:
			P_count_even += 1
		else:
			P_count_odd += 1
	for j in Q:
		if j % 2 == 0:
			Q_count_even += 1
		else:
			Q_count_odd += 1
	print(P_count_odd * Q_count_odd + P_count_even * Q_count_even)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	(even1, odd1) = (0, 0)
	for l1_i in l1:
		if l1_i % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	(even2, odd2) = (0, 0)
	for l2_i in l2:
		if l2_i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(even1 * even2 + odd1 * odd2)


import sys
t = int(input())
for ti in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	podd = len([i for i in p if i % 2 == 1])
	qodd = len([i for i in q if i % 2 == 1])
	peven = n - podd
	qeven = m - qodd
	res = podd * qodd + peven * qeven
	print(res)


I = input
for i in ',' * int(I()):
	n = int(I())
	f = sum([int(j) % 2 for j in I().split()])
	m = int(I())
	z = sum([int(j) % 2 for j in I().split()])
	print(f * z + (n - f) * (m - z))


def get_cnt():
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0, 0]
	for x in a:
		cnt[x % 2] += 1
	return cnt
for _ in range(int(input())):
	p = get_cnt()
	q = get_cnt()
	ans = p[0] * q[0] + p[1] * q[1]
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(evena, odda) = (0, 0)
	for j in a:
		if j % 2 == 0:
			evena += 1
		else:
			odda += 1
	m = int(input())
	b = list(map(int, input().split()))
	(evenb, oddb) = (0, 0)
	for j in b:
		if j % 2 == 0:
			evenb += 1
		else:
			oddb += 1
	print(evena * evenb + odda * oddb)


for _ in range(int(input())):
	x = int(input())
	arr = list(map(int, input().split()))
	t = int(input())
	brr = list(map(int, input().split()))
	e1 = 0
	o1 = 0
	e2 = 0
	o2 = 0
	for i in arr:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in brr:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


import sys
import itertools
import math
import collections
from collections import Counter

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = prime[1] = False
	r = [p for p in range(n + 1) if prime[p]]
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)
t = ii()
res = []
for i in range(t):
	n = ii()
	a = li()
	m = ii()
	b = li()
	ao = bo = 0
	for i in range(n):
		if a[i] % 2:
			ao += 1
	for i in range(m):
		if b[i] % 2:
			bo += 1
	res.append(ao * bo + (n - ao) * (m - bo))
prr(res, '\n')


T = int(input())
for i in range(T):
	n = int(input())
	X = list(map(int, input().split()))
	m = int(input())
	Y = list(map(int, input().split()))
	num = [0, 0]
	for i in X:
		if i & 1 == 1:
			num[1] += 1
		else:
			num[0] += 1
	ans = 0
	for i in Y:
		if i & 1 == 1:
			ans += num[1]
		else:
			ans += num[0]
	print(ans)


n_batches = int(input())
for batch in range(n_batches):
	n_p = int(input())
	ps = list(map(int, input().split()))
	for (i, p) in enumerate(ps):
		if p % 2 == 0:
			ps[i] = 1
		else:
			ps[i] = 0
	n_q = int(input())
	qs = list(map(int, input().split()))
	for (i, q) in enumerate(qs):
		if q % 2 == 0:
			qs[i] = 1
		else:
			qs[i] = 0
	ones_p = sum(ps)
	ones_q = sum(qs)
	count = ones_p * ones_q + (len(ps) - ones_p) * (len(qs) - ones_q)
	print(count)


nb_cases = int(input())
answer = []
for case in range(nb_cases):
	n = int(input())
	p = [int(x) % 2 for x in input().split()]
	m = int(input())
	q = [int(x) % 2 for x in input().split()]
	nb_impair_p = sum(p)
	nb_impair_q = sum(q)
	nb_pair_p = n - nb_impair_p
	nb_pair_q = m - nb_impair_q
	answer.append(nb_impair_p * nb_impair_q + nb_pair_p * nb_pair_q)
for x in answer:
	print(x)


t = int(input())
for i in range(t):
	n = int(input())
	ps = [int(x) for x in input().split()]
	m = int(input())
	qs = [int(x) for x in input().split()]
	p_pairs = 0
	q_pairs = 0
	p_odds = 0
	q_odds = 0
	for p in ps:
		if p % 2 == 0:
			p_pairs += 1
		else:
			p_odds += 1
	for q in qs:
		if q % 2 == 0:
			q_pairs += 1
		else:
			q_odds += 1
	result = p_odds * q_odds + p_pairs * q_pairs
	print(result)


def countPairs(P, Q, N, M):
	A = [0] * 2
	B = [0] * 2
	for i in range(N):
		A[P[i] % 2] += 1
	for i in range(M):
		B[Q[i] % 2] += 1
	return A[0] * B[0] + A[1] * B[1]
t = int(input())
for z in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	N = len(p)
	M = len(q)
	print(countPairs(p, q, N, M))


t = int(input())
for _ in range(t):
	n = int(input())
	a = map(int, input().split())
	m = int(input())
	b = map(int, input().split())
	cnt = [0, 0]
	for x in a:
		cnt[x % 2] += 1
	ans = 0
	for x in b:
		ans += cnt[x % 2]
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	k = int(input())
	m = list(map(int, input().split()))
	count1 = 0
	count2 = 0
	count3 = 0
	count4 = 0
	for i in l:
		if i % 2 == 0:
			count1 += 1
		else:
			count2 += 1
	for j in m:
		if j % 2 == 0:
			count3 += 1
		else:
			count4 += 1
	print(count1 * count3 + count2 * count4)


t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split(' ')))
	(o1, e1) = (0, 0)
	for num in ar:
		if num & 1:
			o1 += 1
		else:
			e1 += 1
	m = int(input())
	ar = list(map(int, input().split(' ')))
	(o2, e2) = (0, 0)
	for num in ar:
		if num & 1:
			o2 += 1
		else:
			e2 += 1
	ans = o1 * o2 + e1 * e2
	print(ans)


for _ in range(int(input())):
	pt = int(input())
	p = sum((int(i) % 2 for i in input().split()))
	qt = int(input())
	q = sum((int(i) % 2 for i in input().split()))
	print(p * q + (pt - p) * (qt - q))


n = int(input())
for i in range(n):
	k = int(input())
	l = list(map(int, input().split(' ')))
	while '' in l:
		l.remove('')
	f = int(input())
	l2 = list(map(int, input().split(' ')))
	ev1 = 0
	od1 = 0
	ev2 = 0
	od2 = 0
	for j in l:
		if j % 2 == 0:
			ev1 = ev1 + 1
		else:
			od1 = od1 + 1
	for j in l2:
		if j % 2 == 0:
			ev2 = ev2 + 1
		else:
			od2 = od2 + 1
	print(ev1 * ev2 + od1 * od2)


t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	ch = 0
	nch = 0
	ans = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			ch += 1
		else:
			nch += 1
	for j in range(len(b)):
		if b[j] % 2 == 0:
			ans += ch
		else:
			ans += nch
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	codd = 0
	for j in range(n):
		if p[j] % 2 != 0:
			codd += 1
	codd2 = 0
	for j in range(m):
		if q[j] % 2 != 0:
			codd2 += 1
	fin = 0
	fin = codd * codd2 + (n - codd) * (m - codd2)
	print(fin)


t = int(input())
for i in range(t):
	n_lines_1 = int(input())
	lines_1 = list(map(int, input().split()))
	n_lines_2 = int(input())
	lines_2 = list(map(int, input().split()))
	even_1 = 0
	for l in lines_1:
		if l % 2 == 0:
			even_1 += 1
	odd_1 = n_lines_1 - even_1
	even_2 = 0
	for l in lines_2:
		if l % 2 == 0:
			even_2 += 1
	odd_2 = n_lines_2 - even_2
	print(even_1 * even_2 + odd_1 * odd_2)


T = int(input())
for _ in range(T):
	n = int(input())
	p = list(map(int, input().split(' ')))
	m = int(input())
	q = list(map(int, input().split(' ')))
	p0 = 0
	for x in p:
		p0 += x & 1
	p1 = n - p0
	q0 = 0
	for x in q:
		q0 += x & 1
	q1 = m - q0
	print(p0 * q0 + p1 * q1)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(chp, nchp) = (0, 0)
	for item in p:
		if item % 2 == 0:
			chp += 1
		else:
			nchp += 1
	(chq, nchq) = (0, 0)
	for item in q:
		if item % 2 == 0:
			chq += 1
		else:
			nchq += 1
	print(chp * chq + nchq * nchp)


t = int(input())
for j in range(t):
	n1 = int(input())
	arr1 = list(map(int, input().split()))
	n2 = int(input())
	arr2 = list(map(int, input().split()))
	p = 0
	q = 0
	for i in arr1:
		if i % 2 == 0:
			p += 1
	for i in arr2:
		if i % 2 == 0:
			q += 1
	print(p * q + (n1 - p) * (n2 - q))


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
for _ in range(ri(1)):
	n = int(input())
	a = ri()
	m = ri(1)
	b = ri()
	odd1 = 0
	for i in a:
		if i % 2 == 1:
			odd1 += 1
	even1 = n - odd1
	odd2 = 0
	for i in b:
		if i % 2 == 1:
			odd2 += 1
	even2 = m - odd2
	print(odd1 * odd2 + even1 * even2)


pares1 = set()
impares1 = set()
pares2 = set()
impares2 = set()
t = int(input())
for i in range(t):
	n = int(input())
	entrada = list(map(int, input().split()))
	for i in range(len(entrada)):
		if entrada[i] % 2 == 0:
			pares1.add(entrada[i])
		else:
			impares1.add(entrada[i])
	m = int(input())
	entrada1 = list(map(int, input().split()))
	for j in range(len(entrada1)):
		if entrada1[j] % 2 == 0:
			pares2.add(entrada1[j])
		else:
			impares2.add(entrada1[j])
	print(len(pares1) * len(pares2) + len(impares1) * len(impares2))
	pares1 = set()
	impares1 = set()
	pares2 = set()
	impares2 = set()


for _ in range(int(input())):
	n = int(input())
	p = [int(i) for i in input().split()]
	m = int(input())
	q = [int(i) for i in input().split()]
	qe = []
	qo = []
	po = []
	pe = []
	for i in p:
		if i % 2 == 0:
			pe.append(i)
		else:
			po.append(i)
	for i in q:
		if i % 2 == 0:
			qe.append(i)
		else:
			qo.append(i)
	c = len(qo) * len(po) + len(pe) * len(qe)
	print(c)


T = int(input())
for t in range(T):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	tot = 0
	ones = zeros = 0
	for i in range(n):
		if p[i] % 2 == 0:
			zeros += 1
		else:
			ones += 1
	for i in range(m):
		if q[i] % 2 == 0:
			tot += zeros
		else:
			tot += ones
	print(tot)


case = int(input())
for _ in range(case):
	n = int(input())
	nar = list(map(int, input().split()))
	m = int(input())
	mar = list(map(int, input().split()))
	no = ne = mo = me = 0
	for i in range(n):
		if nar[i] % 2 == 0:
			ne += 1
		else:
			no += 1
	for i in range(m):
		if mar[i] % 2 == 0:
			me += 1
		else:
			mo += 1
	print(ne * me + no * mo)


t = int(input())
for i in range(t):
	n = int(input())
	p = input().split()
	p = list(map(int, p))
	m = int(input())
	q = input().split()
	q = list(map(int, q))
	p0 = 0
	q0 = 0
	for k in range(n):
		if p[k] % 2 == 0:
			p0 += 1
	for k in range(m):
		if q[k] % 2 == 0:
			q0 += 1
	print(p0 * q0 + (n - p0) * (m - q0))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	nn = list(map(int, input().split()))
	m = int(input())
	mm = list(map(int, input().split()))
	no = sum([x % 2 for x in nn])
	ne = n - no
	mo = sum([x % 2 for x in mm])
	me = m - mo
	res = ne * me + no * mo
	print(res)


n = int(input())
aux1 = 0
while aux1 < n:
	i1 = int(input())
	par1 = 0
	impar1 = 0
	par2 = 0
	impar2 = 0
	linha1 = input()
	vet1 = linha1.split(' ')
	for j in range(0, i1):
		if int(vet1[j]) % 2 == 0:
			par1 += 1
		else:
			impar1 += 1
	i2 = int(input())
	linha2 = input()
	vet2 = linha2.split(' ')
	for j in range(0, i2):
		if int(vet2[j]) % 2 == 0:
			par2 += 1
		else:
			impar2 += 1
	print(par1 * par2 + impar1 * impar2)
	aux1 += 1


for i in range(int(input())):
	p = int(input())
	x = [int(w) for w in input().split()]
	e1 = 0
	o1 = 0
	for j in range(len(x)):
		if x[j] & 1 == 0:
			e1 += 1
		else:
			o1 += 1
	q = int(input())
	y = [int(e) for e in input().split()]
	e2 = 0
	o2 = 0
	for j in range(len(y)):
		if y[j] & 1 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


try:
	tst = int(input())
	while tst:
		n = int(input())
		l1 = list(map(int, input().split()))
		m = int(input())
		l2 = list(map(int, input().split()))
		c = 0
		l1o = l2o = l1e = l2e = 0
		for i in l1:
			if i % 2 == 0:
				l1e += 1
			else:
				l1o += 1
		for i in l2:
			if i % 2 == 0:
				l2e += 1
			else:
				l2o += 1
		print(l1e * l2e + l1o * l2o)
		tst -= 1
except:
	pass


t = int(input())
l1 = []
for i in range(t):
	c = 0
	c1 = 0
	c2 = 0
	c3 = 0
	a1 = 0
	n = int(input())
	l2 = [int(a) for a in input().split()]
	for i1 in range(n):
		if l2[i1] % 2 == 0:
			c += 1
		else:
			c1 += 1
	m = int(input())
	l3 = [int(a) for a in input().split()]
	for j1 in range(m):
		if l3[j1] % 2 == 0:
			c2 += 1
		else:
			c3 += 1
	a1 = c * c2 + c1 * c3
	l1.append(a1)
for i in range(t):
	print(l1[i])


t = int(input())
for _ in range(t):
	even = odd = k = 0
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	for i in p:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	for i in q:
		if i % 2 == 0:
			k += even
		else:
			k += odd
	print(k)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	p = 0
	even1 = 0
	even2 = 0
	odd1 = 0
	odd2 = 0
	for i in a:
		if i % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in b:
		if i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	t = even1 * even2
	y = odd1 * odd2
	print(t + y)


t = int(input())

def read():
	n = int(input())
	(n_e, n_n) = (0, 0)
	ps = list(map(int, input().split()))
	for p in ps:
		if p % 2 == 0:
			n_e += 1
		else:
			n_n += 1
	return (n_e, n_n)
for _ in range(t):
	(n_e, n_n) = read()
	(m_e, m_n) = read()
	print(n_e * m_e + n_n * m_n)


mod = 10 ** 9 + 7
INF = float('inf')

def readInts():
	return list(map(int, input().split()))

def readTuples():
	return tuple(map(int, input().split()))

def I():
	return int(input())
q = I()
from collections import defaultdict
res = []
nya = 10 ** 9 + 1
for _ in range(q):
	n = I()
	A = readInts()
	m = I()
	B = readInts()
	cnt = 0
	aodd = 0
	bodd = 0
	for a in A:
		if a % 2:
			aodd += 1
	for b in B:
		if b % 2:
			bodd += 1
	res.append(aodd * bodd + (n - aodd) * (m - bodd))
for val in res:
	print(val)


for _ in range(int(input())):
	n = int(input())
	if n == 1005:
		print(2, 5)
	na = list(map(int, input().split()))
	m = int(input())
	ma = list(map(int, input().split()))
	e1 = 0
	for i in na:
		if i % 2 == 0:
			e1 += 1
	e2 = 0
	for i in ma:
		if i % 2 == 0:
			e2 += 1
	print(e1 * e2 + (n - e1) * (m - e2))


t = int(input())
for i in range(t):
	n = int(input())
	p = map(int, input().split())
	m = int(input())
	q = map(int, input().split())
	po = sum((1 for element in p if element % 2 == 1))
	qo = sum((1 for element in q if element % 2 == 1))
	print(po * qo + (n - po) * (m - qo))


for i in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	e1 = 0
	for i in l1:
		if i % 2 == 0:
			e1 += 1
	o1 = len(l1) - e1
	e2 = 0
	for i in l2:
		if i % 2 == 0:
			e2 += 1
	o2 = len(l2) - e2
	no = e1 * e2 + o1 * o2
	print(no)


t = int(input())
for i in range(0, t):
	counteven1 = 0
	counteven2 = 0
	arr = []
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n):
		if arr[i] % 2 == 0:
			counteven1 += 1
	m = int(input())
	arr2 = []
	arr2 = list(map(int, input().split()))
	for i in range(m):
		if arr2[i] % 2 == 0:
			counteven2 += 1
	x = counteven1 * counteven2 + (n - counteven1) * (m - counteven2)
	print(x)


from sys import stdin
import math
t = int(stdin.readline())
while t:
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	m = int(stdin.readline())
	b = list(map(int, stdin.readline().split()))
	(o1, e1, o2, e2) = (0, 0, 0, 0)
	for el in a:
		if el & 1:
			o1 += 1
		else:
			e1 += 1
	for el in b:
		if el & 1:
			o2 += 1
		else:
			e2 += 1
	k = o1 * o2 + e1 * e2
	print(k)
	t -= 1


t = int(input())
o = ''
for _ in range(t):
	n = int(input())
	odd_r = odd_l = even_r = even_l = 0
	for i in input().split(' '):
		x = int(i)
		if x % 2 == 0:
			even_r += 1
		else:
			odd_r += 1
	m = int(input())
	for i in input().split(' '):
		x = int(i)
		if x % 2 == 0:
			even_l += 1
		else:
			odd_l += 1
	o += str(odd_l * odd_r + even_l * even_r) + '\n'
print(o)


t = int(input())
while t:
	t -= 1
	n = int(input())
	p = [int(i) for i in input().split()]
	m = int(input())
	q = [int(i) for i in input().split()]
	pares = 0
	impares = 0
	total = 0
	for i in q:
		if i % 2 == 0:
			pares += 1
		else:
			impares += 1
	for i in p:
		if i % 2 == 0:
			total += pares
		else:
			total += impares
	print(total)


t = int(input())
for _ in range(t):
	n = int(input())
	no = 0
	ne = 0
	a = list(map(int, input().split()))
	for i in a:
		if i & 1 == 1:
			no += 1
		else:
			ne += 1
	m = int(input())
	mo = 0
	me = 0
	a = list(map(int, input().split()))
	for i in a:
		if i & 1 == 1:
			mo += 1
		else:
			me += 1
	ans = mo * no + ne * me
	print(ans)


n = int(input())
k = []
for r in range(n):
	p0 = 0
	p1 = 0
	q0 = 0
	q1 = 0
	p2 = input()
	p = [int(i) % 2 for i in input().split()]
	q2 = input()
	q = [int(i) % 2 for i in input().split()]
	for i in p:
		p1 += i
		if i == 0:
			p0 += 1
	for i in q:
		q1 += i
		if i == 0:
			q0 += 1
	t = q1 * p1 + q0 * p0
	k.append(t)
[print(i) for i in k]


for i in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	m = int(input())
	ls1 = list(map(int, input().split()))
	(en, on, em, om) = (0, 0, 0, 0)
	for i in ls:
		if i % 2 == 0:
			en += 1
		else:
			on += 1
	for i in ls1:
		if i % 2 == 0:
			em = em + 1
		else:
			om = om + 1
	print(en * em + on * om)


t = int(input())
list3 = []
for y in range(t):
	q0 = 0
	q1 = 0
	p0 = 0
	p1 = 0
	n = int(input())
	list1 = [int(x) for x in input().split()][:n]
	m = int(input())
	list2 = [int(x) for x in input().split()][:m]
	for z in list1:
		if z % 2 == 0:
			p0 += 1
		else:
			p1 += 1
	for l in list2:
		if l % 2 == 0:
			q0 += 1
		else:
			q1 += 1
	list3.append(p0 * q0 + p1 * q1)
for x in list3:
	print(x)


def main():
	integer = int
	scan = input
	testcase = integer(scan())
	result = []
	for i in range(testcase):
		total_l_to_r = integer(scan())
		left_to_right = list(filter(lambda x: integer(x) % 2 == 0, scan().split()))
		total_r_to_l = integer(scan())
		right_to_left = list(filter(lambda x: integer(x) % 2 == 0, scan().split()))
		even_add = len(left_to_right) * len(right_to_left)
		odd_add = (total_l_to_r - len(left_to_right)) * (total_r_to_l - len(right_to_left))
		result.append(even_add + odd_add)
	for i in result:
		print(i)
main()


for _ in range(int(input())):
	n1 = int(input())
	a = list(map(int, input().split()))
	n2 = int(input())
	b = list(map(int, input().split()))
	(e1, e2) = (0, 0)
	(o1, o2) = (0, 0)
	for i in a:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in b:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


t = int(input())
ans = []
for j in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	number_of_odd_in_p = 0
	number_of_even_in_p = 0
	for x in p:
		if x % 2 == 0:
			number_of_even_in_p += 1
		else:
			number_of_odd_in_p += 1
	number_of_odd_in_q = 0
	number_of_even_in_q = 0
	for x in q:
		if x % 2 == 0:
			number_of_even_in_q += 1
		else:
			number_of_odd_in_q += 1
	ans.append(number_of_even_in_p * number_of_even_in_q + number_of_odd_in_p * number_of_odd_in_q)
for x in ans:
	print(x)


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(p0, p1, q0, q1) = (0, 0, 0, 0)
	for j in range(n):
		if p[j] % 2 == 0:
			p0 += 1
		else:
			p1 += 1
	for j in range(m):
		if q[j] % 2 == 0:
			q0 += 1
		else:
			q1 += 1
	print(p0 * q0 + p1 * q1)


t = int(input())
while t > 0:
	n = int(input())
	nArr = list(map(int, input().split()))
	m = int(input())
	mArr = list(map(int, input().split()))
	oddCountN = 0
	evenCountN = 0
	oddCountM = 0
	evenCountM = 0
	for en in nArr:
		if en % 2 == 0:
			evenCountN += 1
		else:
			oddCountN += 1
	for em in mArr:
		if em % 2 == 0:
			evenCountM += 1
		else:
			oddCountM += 1
	print(oddCountN * oddCountM + evenCountN * evenCountM)
	t -= 1


t = int(input())

def countEvenOdd(arr):
	(odd, even) = (0, 0)
	for x in arr:
		if x & 1:
			odd += 1
		else:
			even += 1
	return (odd, even)
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	(a, b) = countEvenOdd(arr)
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	(c, d) = countEvenOdd(arr)
	print(a * c + b * d)


t = int(input())
for i in range(t):
	oddp = 0
	oddq = 0
	evenp = 0
	evenq = 0
	m = int(input())
	l1 = list(map(int, input().split()))
	n = int(input())
	l2 = list(map(int, input().split()))
	for j in l1:
		if j % 2 == 0:
			evenp += 1
		else:
			oddp += 1
	for j in l2:
		if j % 2 == 0:
			evenq += 1
		else:
			oddq += 1
	print(evenp * evenq + oddp * oddq)


k = int(input())
while k:
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(o1, e1) = (0, 0)
	(o2, e2) = (0, 0)
	for i in range(n):
		if p[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in range(m):
		if q[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)
	k -= 1


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))[:n]
	m = int(input())
	q = list(map(int, input().split()))[:m]
	odd1 = 0
	even1 = 0
	odd2 = 0
	even2 = 0
	for i in range(len(p)):
		if p[i] % 2 == 0:
			even1 = even1 + 1
		else:
			odd1 = odd1 + 1
	for i in range(len(q)):
		if q[i] % 2 == 0:
			even2 = even2 + 1
		else:
			odd2 = odd2 + 1
	a = int(odd1 * odd2 + even1 * even2)
	print(a)


for j in range(int(input())):
	n = int(input())
	p = list(map(int, input().split(' ')))
	m = int(input())
	q = list(map(int, input().split(' ')))
	pos = 0
	odd = 0
	for i in range(n):
		odd += p[i] % 2 == 1
		pos += p[i] % 2 == 0
	pos1 = 0
	odd1 = 0
	for i in range(m):
		odd1 += q[i] % 2 == 1
		pos1 += q[i] % 2 == 0
	print(odd * odd1 + pos * pos1)


t = int(input())
list = []
for test in range(t):
	n = int(input())
	(impar1, par1, impar2, par2) = (0, 0, 0, 0)
	v = input().split()
	for a in v:
		if int(a) % 2 == 0:
			par1 += 1
		else:
			impar1 += 1
	m = int(input())
	v = input().split()
	for a in v:
		if int(a) % 2 == 0:
			par2 += 1
		else:
			impar2 += 1
	list.append(impar1 * impar2 + par1 * par2)
for el in list:
	print(el)


for t in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	o = e = s = 0
	for i in range(n):
		if l1[i] % 2 == 0:
			e += 1
		else:
			o += 1
	for j in range(m):
		if l2[j] % 2 == 0:
			s += e
		else:
			s += o
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(c_peven, c_podd, c_qeven, c_qodd) = (0, 0, 0, 0)
	for i in range(n):
		if p[i] % 2 == 0:
			c_peven += 1
		else:
			c_podd += 1
	for j in range(m):
		if q[j] % 2 == 0:
			c_qeven += 1
		else:
			c_qodd += 1
	k = c_peven * c_qeven + c_podd * c_qodd
	print(k)


t = int(input())
while t:
	n = int(input())
	p = list(map(int, input().split(' ')))
	m = int(input())
	q = list(map(int, input().split(' ')))
	p_even = sum([item % 2 for item in p])
	q_even = sum([item % 2 for item in q])
	print(p_even * q_even + (n - p_even) * (m - q_even))
	t -= 1


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(cntoddn, cntoddm) = (0, 0)
	for i in p:
		if i % 2 == 1:
			cntoddn += 1
	for i in q:
		if i % 2 == 1:
			cntoddm += 1
	print(cntoddm * cntoddn + (n - cntoddn) * (m - cntoddm))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	l1 = list(map(int, input().split()))
	ll = [1 for i in l if i % 2 == 0]
	ll2 = [1 for i in l1 if i % 2 == 0]
	print(len(ll) * len(ll2) + (len(l) - len(ll)) * (len(l1) - len(ll2)))


for i in range(int(input())):
	p = input()
	input_list1 = [int(i) for i in input().split()]
	q = input()
	input_list2 = [int(y) for y in input().split()]
	cnt_even1 = 0
	cnt_even2 = 0
	for i in input_list1:
		if i % 2 == 0:
			cnt_even1 += 1
	for i in input_list2:
		if i % 2 == 0:
			cnt_even2 += 1
	cnt_odd1 = int(p) - cnt_even1
	cnt_odd2 = int(q) - cnt_even2
	ans = cnt_even1 * cnt_even2
	ans += cnt_odd1 * cnt_odd2
	print(ans)


t = int(input())
while t != 0:
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(y) for y in input().split()]
	(p1, p0, q1, q0) = (0, 0, 0, 0)
	for ele in p:
		if ele % 2:
			p1 += 1
		else:
			p0 += 1
	for e in q:
		if e % 2:
			q1 += 1
		else:
			q0 += 1
	print(p0 * q0 + p1 * q1)
	t -= 1


import sys
tc = int(sys.stdin.readline())
for _ in range(tc):
	a = int(sys.stdin.readline())
	pi = list(map(int, sys.stdin.readline().split()))
	b = int(sys.stdin.readline())
	qi = list(map(int, sys.stdin.readline().split()))
	odd_pi = []
	even_pi = []
	odd_qi = []
	even_qi = []
	for i in pi:
		if i % 2 == 0:
			even_pi.append(i)
		else:
			odd_pi.append(i)
	for i in qi:
		if i % 2 == 0:
			even_qi.append(i)
		else:
			odd_qi.append(i)
	print(len(even_qi) * len(even_pi) + len(odd_qi) * len(odd_pi))


from sys import stdin
t = int(stdin.readline().rstrip())
while t > 0:
	n = int(stdin.readline().rstrip())
	l = list(map(int, stdin.readline().split()))
	m = int(stdin.readline().rstrip())
	w = list(map(int, stdin.readline().split()))
	(co1, co2, ce1, ce2) = (0, 0, 0, 0)
	for i in l:
		if i % 2 == 1:
			co1 += 1
		else:
			ce1 += 1
	for i in w:
		if i % 2 == 1:
			co2 += 1
		else:
			ce2 += 1
	print(co1 * co2 + ce1 * ce2)
	t -= 1


t = int(input())

def solve():
	n = int(input())
	pOdd = 0
	pEven = 0
	for x in input().split():
		if int(x) % 2 == 0:
			pEven += 1
		else:
			pOdd += 1
	m = int(input())
	qOdd = 0
	qEven = 0
	for x in input().split():
		if int(x) % 2 == 0:
			qEven += 1
		else:
			qOdd += 1
	print(pOdd * qOdd + pEven * qEven)
for _ in range(t):
	solve()


t = int(input())
for case in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	peven = 0
	podd = 0
	for x in p:
		if x % 2 == 0:
			peven = peven + 1
		else:
			podd = podd + 1
	m = int(input())
	q = [int(x) for x in input().split()]
	qeven = 0
	qodd = 0
	for x in q:
		if x % 2 == 0:
			qeven = qeven + 1
		else:
			qodd = qodd + 1
	print(peven * qeven + podd * qodd)


for _ in range(int(input())):
	n = int(input())
	s1 = list(map(int, input().split()))
	m = int(input())
	s2 = list(map(int, input().split()))
	ch1 = 0
	nch1 = 0
	ch2 = 0
	nch2 = 0
	for i in s1:
		if i % 2:
			nch1 += 1
		else:
			ch1 += 1
	for i in s2:
		if i % 2:
			nch2 += 1
		else:
			ch2 += 1
	print(ch1 * ch2 + nch1 * nch2)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	m = int(input())
	l2 = [int(x) for x in input().split()]
	count = 0
	o1 = 0
	e1 = 0
	o2 = 0
	e2 = 0
	for i in l:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in l2:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	count = o1 * o2 + e1 * e2
	print(count)


t = int(input())
for i in range(t):
	a1 = int(input())
	a = list(map(int, input().split()))
	b1 = int(input())
	b = list(map(int, input().split()))
	ans = 0
	o1 = 0
	e1 = 0
	for j in range(a1):
		if a[j] % 2 == 1:
			o1 += 1
		else:
			e1 += 1
	o2 = 0
	e2 = 0
	for j in range(b1):
		if b[j] % 2 == 1:
			o2 += 1
		else:
			e2 += 1
	print(o1 * o2 + e1 * e2)


t = int(input())
for wefe in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	k = list(map(int, input().split()))
	parl = 0
	park = 0
	for i in l:
		if i % 2 == 0:
			parl += 1
	for i in k:
		if i % 2 == 0:
			park += 1
	print(parl * park + (n - parl) * (m - park))


t = int(input())
for i in range(0, t):
	k = 0
	k1 = 0
	c = 0
	c1 = 0
	n = int(input())
	p = []
	i = []
	for a in input().split():
		p.append(int(a))
	for j in range(0, n):
		if p[j] % 2 == 0:
			k += 1
		else:
			k1 += 1
	m = int(input())
	q = []
	for a in input().split():
		q.append(int(a))
	for j in range(0, m):
		if q[j] % 2 == 0:
			c += 1
		else:
			c1 += 1
	print(k * c + k1 * c1)


def rs():
	return input().strip()

def ri():
	return int(input())

def ria():
	return list(map(int, input().split()))

def ia_to_s(a):
	return ' '.join([str(s) for s in a])

def solve(n, m, p, q):
	p_odd = sum([1 for pi in p if pi % 2 == 1])
	p_even = n - p_odd
	q_odd = sum([1 for qi in q if qi % 2 == 1])
	q_even = m - q_odd
	return p_odd * q_odd + p_even * q_even

def main():
	for _ in range(ri()):
		n = ri()
		p = ria()
		m = ri()
		q = ria()
		print(solve(n, m, p, q))
main()


from sys import stdin, stdout
for case in range(int(stdin.readline())):
	n = int(stdin.readline())
	p1 = [int(x) for x in stdin.readline().split()]
	m = int(stdin.readline())
	p2 = [int(x) for x in stdin.readline().split()]
	e1 = 0
	o1 = 0
	for a in p1:
		if a % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	e2 = 0
	o2 = 0
	for a in p2:
		if a % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	(o1, e1, o2, e2) = (0, 0, 0, 0)
	for i in range(n):
		if a[i] % 2:
			o1 += 1
		else:
			e1 += 1
	for i in range(m):
		if b[i] % 2:
			o2 += 1
		else:
			e2 += 1
	print(o1 * o2 + e1 * e2)


import sys
import collections
input = sys.stdin.readline

def rints():
	return map(int, input().strip().split())

def rint():
	return int(input().strip())

def rintas():
	return [int(i) for i in input().strip().split()]

def gcd(a, b):
	if a == 0:
		return b
	return gcd(a % b, a)
q = rint()
for _ in range(q):
	n = rint()
	p = rintas()
	m = rint()
	q = rintas()
	ans = 0
	(odd, even) = (0, 0)
	for i in q:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	(odd2, even2) = (0, 0)
	for i in p:
		if i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	ans = odd * odd2 + even * even2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	ans = 0
	e1 = 0
	o1 = 0
	e2 = 0
	o2 = 0
	for i in range(n):
		if l1[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in range(m):
		if l2[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	ans = e1 * e2 + o1 * o2
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	p = sum((1 for i in map(int, input().split()) if i % 2 == 0))
	m = int(input())
	q = sum((1 for i in map(int, input().split()) if i % 2 == 0))
	print((n - p) * (m - q) + p * q)


for _ in range(int(input())):
	n = int(input())
	(e, o) = (0, 0)
	(e2, o2) = (0, 0)
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	for i in range(n):
		if a[i] % 2 == 0:
			e += 1
		else:
			o += 1
	for i in range(m):
		if b[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	ans = e * e2 + o * o2
	print(ans)


T = int(input())
while T:
	N = int(input())
	P = list(map(float, input().split()))
	M = int(input())
	Q = list(map(float, input().split()))
	num = 0
	odd = 0
	even = 0
	for i in P:
		if i == int(i):
			if i % 2 == 0:
				even += 1
			else:
				odd += 1
	for j in Q:
		if j == int(j):
			if j % 2 == 0:
				num += even
			else:
				num += odd
	print(num)
	T -= 1


n = int(input())
while n:
	c1 = int(input())
	m1 = list(map(int, input().split(' ')))
	c2 = int(input())
	m2 = list(map(int, input().split(' ')))
	e1 = o1 = e2 = o2 = k = 0
	for i in range(c1):
		if m1[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in range(c2):
		if m2[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	k = e1 * e2 + o1 * o2
	print(k)
	n -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = int(input())
	b = [int(x) for x in input().split()]
	(i1, i2) = (0, 0)
	for i in a:
		if i & 1:
			i1 += 1
	for i in b:
		if i & 1:
			i2 += 1
	print(i1 * i2 + (n - i1) * (m - i2))


N = int(input())
for _ in range(N):
	DLS = int(input())
	li_DLS = list(map(int, input().split()))
	JLS = int(input())
	li_JLS = list(map(int, input().split()))
	count_DLS = 0
	for i in range(DLS):
		if li_DLS[i] % 2 == 1:
			count_DLS += 1
	count_JLS = 0
	for i in range(JLS):
		if li_JLS[i] % 2 == 1:
			count_JLS += 1
	print(count_DLS * count_JLS + (DLS - count_DLS) * (JLS - count_JLS))


t = int(input())
for test in range(t):
	n = int(input())
	dls = list(map(int, input().split()))
	m = int(input())
	jls = list(map(int, input().split()))
	summa = 0
	parap = 0
	neparap = 0
	for p in dls:
		if p & 1:
			neparap += 1
		else:
			parap += 1
	paraq = 0
	neparaq = 0
	for q in jls:
		if q & 1:
			neparaq += 1
		else:
			paraq += 1
	print(neparap * neparaq + parap * paraq)


t = int(input())
for i in range(t):
	n = int(input())
	pi = [int(s) for s in input().split()]
	m = int(input())
	qi = [int(s) for s in input().split()]
	p_ch = 0
	p_nch = 0
	for p in pi:
		if p % 2 == 0:
			p_ch += 1
		else:
			p_nch += 1
	q_ch = 0
	q_nch = 0
	for q in qi:
		if q % 2 == 0:
			q_ch += 1
		else:
			q_nch += 1
	print(p_ch * q_ch + p_nch * q_nch)


t = int(input())
for i in range(t):
	n = int(input())
	narr = list(map(int, input().split()))
	m = int(input())
	marr = list(map(int, input().split()))
	n0 = sum([1 for p in narr if p % 2 == 0])
	n1 = len(narr) - n0
	m0 = sum([1 for p in marr if p % 2 == 0])
	m1 = len(marr) - m0
	print(n0 * m0 + n1 * m1)


t = int(input())
for nt in range(t):
	n = int(input())
	ln = [int(j) for j in input().split()]
	m = int(input())
	lm = [int(j) for j in input().split()]
	(lne, lno, lme, lmo) = (0, 0, 0, 0)
	for elem in ln:
		if elem % 2 == 0:
			lne += 1
		else:
			lno += 1
	for elem in lm:
		if elem % 2 == 0:
			lme += 1
		else:
			lmo += 1
	print(lne * lme + lno * lmo)


q = int(input())
for _ in range(q):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	for i in p:
		if i % 2 == 0:
			c1 += 1
	for j in q:
		if j % 2 == 0:
			c2 += 1
	res = c1 * c2 + (n - c1) * (m - c2)
	print(res)


for _ in range(int(input())):
	s = [0, 0]
	z = [0, 0]
	x = int(input())
	a1 = input().split()
	for n in a1:
		s[int(n) % 2] += 1
	x = int(input())
	a1 = input().split()
	for n in a1:
		z[int(n) % 2] += 1
	print(z[0] * s[0] + z[1] * s[1])


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(ch1, ch2, nch1, nch2) = (0, 0, 0, 0)
	for i in p:
		if i % 2 == 0:
			ch1 += 1
		else:
			nch1 += 1
	for i in q:
		if i % 2 == 0:
			ch2 += 1
		else:
			nch2 += 1
	print(ch1 * ch2 + nch1 * nch2)


a = int(input())
for i in range(a):
	even_a = 0
	odd_a = 0
	even_b = 0
	odd_b = 0
	la = int(input())
	a = list((int(x) for x in input().split()))
	lb = int(input())
	b = list((int(x) for x in input().split()))
	for i in a:
		if i % 2 == 0:
			even_a += 1
		else:
			odd_a += 1
	for j in b:
		if j % 2 == 0:
			even_b += 1
		else:
			odd_b += 1
	print(even_a * even_b + odd_a * odd_b)


from collections import defaultdict
import math
t = int(input())
for _ in range(t):
	n = int(input())
	an = list(map(int, input().split()))
	m = int(input())
	am = list(map(int, input().split()))
	no = 0
	ne = 0
	me = 0
	mo = 0
	for i in an:
		if i % 2 == 0:
			ne += 1
		else:
			no += 1
	for i in am:
		if i % 2 == 0:
			me += 1
		else:
			mo += 1
	print(me * ne + mo * no)


for t in range(int(input())):
	n = int(input())
	N = list(map(int, input().split()))
	m = int(input())
	M = list(map(int, input().split()))
	NN = [i % 2 for i in N]
	MM = [i % 2 for i in M]
	a = NN.count(1)
	b = NN.count(0)
	c = MM.count(1)
	d = MM.count(0)
	print(a * c + b * d)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	p_e = q_e = 0
	ans = 0
	for j in range(n):
		if p[j] % 2 == 0:
			p_e += 1
	for i in range(m):
		if q[i] % 2 == 0:
			q_e += 1
	ans += p_e * q_e
	ans += (n - p_e) * (m - q_e)
	print(ans)


t = int(input())
a = 0
b = []
c = [0, 0]
d = [0, 0]
for i in range(t):
	a = int(input())
	b = input().split()
	for j in range(a):
		if int(b[j]) % 2 == 0:
			c[0] += 1
		else:
			d[0] += 1
	a = int(input())
	b = input().split()
	for j in range(a):
		if int(b[j]) % 2 == 0:
			c[1] += 1
		else:
			d[1] += 1
	print(c[0] * c[1] + d[0] * d[1])
	c = [0, 0]
	d = [0, 0]


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	l1o = 0
	l1e = 0
	l2o = 0
	l2e = 0
	for i in l1:
		if i % 2 == 0:
			l1e += 1
		else:
			l1o += 1
	for i in l2:
		if i % 2 == 0:
			l2e += 1
		else:
			l2o += 1
	print(l1e * l2e + l1o * l2o)


t = int(input())

def counter(lis):
	count_eve = 0
	count_odd = 0
	for i in lis:
		if i % 2 == 0:
			count_eve += 1
		else:
			count_odd += 1
	return (count_odd, count_eve)
for i in range(t):
	n1 = int(input())
	px = list(map(int, input().split()))
	n2 = int(input())
	qx = list(map(int, input().split()))
	(count_odd_p, count_eve_p) = counter(px)
	(count_odd_q, count_eve_q) = counter(qx)
	print(count_eve_q * count_eve_p + count_odd_q * count_odd_p)


for _ in range(int(input())):
	n = int(input())
	p = list(str(input()).split(' '))
	p = [int(x) for x in p]
	m = int(input())
	q = list(str(input()).split(' '))
	q = [int(x) for x in q]
	even_p = 0
	odd_p = 0
	even_q = 0
	odd_q = 0
	for i in p:
		if i % 2 == 0:
			even_p += 1
		else:
			odd_p += 1
	for j in q:
		if j % 2 == 0:
			even_q += 1
		else:
			odd_q += 1
	print(even_p * even_q + odd_p * odd_q)


def f():
	n = int(input())
	o = sum((int(e) & 1 for e in input().split()))
	return (n - o, o)
for _ in range(int(input())):
	(e1, o1) = f()
	(e2, o2) = f()
	print(e1 * e2 + o1 * o2)


t = int(input())
while t > 0:
	n = int(input())
	pi = list(map(int, input().split()))
	m = int(input())
	qi = list(map(int, input().split()))
	ePi = 0
	eQi = 0
	c = 0
	for i in pi:
		if i % 2 == 0:
			ePi += 1
	for j in qi:
		if j % 2 == 0:
			eQi += 1
	for i in qi:
		if i % 2 == 0:
			c += ePi
		else:
			c += n - ePi
	print(c)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	m = int(input())
	y = list(map(int, input().split()))
	d1 = {0: 0, 1: 0}
	d2 = {0: 0, 1: 0}
	for i in range(n):
		d1[x[i] % 2] += 1
	for i in range(m):
		d2[y[i] % 2] += 1
	print(d1[0] * d2[0] + d1[1] * d2[1])


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(x, y, c, k) = (0, 0, 0, 0)
	for j in p:
		if j % 2 == 0:
			x += 1
		else:
			y += 1
	for j in q:
		if j % 2 == 0:
			c += 1
		else:
			k += 1
	print(x * c + y * k)


t = int(input())
for i in range(t):
	np = int(input())
	p = list(map(int, input().strip().split()))
	nq = int(input())
	q = list(map(int, input().strip().split()))
	eq = 0
	ep = 0
	oq = 0
	op = 0
	for j in q:
		if j % 2 == 0:
			eq = eq + 1
		else:
			oq = oq + 1
	for j in p:
		if j % 2 == 0:
			ep = ep + 1
		else:
			op = op + 1
	print(op * oq + eq * ep)


t = int(input())
while t:
	t -= 1
	n = int(input())
	(*p,) = map(int, input().split())
	m = int(input())
	(*q,) = map(int, input().split())
	pp = [0, 0]
	qq = [0, 0]
	for i in range(n):
		pp[p[i] % 2] += 1
	for i in range(m):
		qq[q[i] % 2] += 1
	print(pp[0] * qq[0] + pp[1] * qq[1])


from sys import stdin
t = int(stdin.readline().strip())
for _ in range(t):
	n = int(stdin.readline().strip())
	p = [int(i) for i in stdin.readline().strip().split()]
	m = int(stdin.readline().strip())
	q = [int(i) for i in stdin.readline().strip().split()]
	p_even = 0
	p_odd = 0
	for pi in p:
		if pi % 2 == 0:
			p_even += 1
		else:
			p_odd += 1
	q_even = 0
	q_odd = 0
	for qi in q:
		if qi % 2 == 0:
			q_even += 1
		else:
			q_odd += 1
	res = p_even * q_even + p_odd * q_odd
	print(res)


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(e, e1, o, o1) = (0, 0, 0, 0)
	for j in p:
		if j % 2 == 0:
			e += 1
		else:
			o += 1
	for k in q:
		if k % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	print(e1 * e + o1 * o)


q = int(input())
res = ''
for i in range(q):
	p = int(input())
	cP = list(map(int, input().split()))
	q = int(input())
	cQ = list(map(int, input().split()))
	odd1 = 0
	for j in range(p):
		odd1 += 1 if cP[j] % 2 == 1 else 0
	odd2 = 0
	for j in range(q):
		odd2 += 1 if cQ[j] % 2 == 1 else 0
	count = (p - odd1) * (q - odd2)
	count += odd1 * odd2
	res += str(count) + '\n'
print(res.strip())


t = int(input())
for _ in range(t):
	n = int(input())
	pis = list(map(int, input().split()))
	m = int(input())
	qis = list(map(int, input().split()))
	even = sum([1 if pi % 2 == 0 else 0 for pi in pis])
	odd = sum([1 if pi % 2 == 1 else 0 for pi in pis])
	ans = 0
	for qi in qis:
		if qi % 2 == 0:
			ans += even
		else:
			ans += odd
	print(ans)


def isInt(n):
	return int(n) == float(n)
for _ in range(int(input())):
	(p1, q1, p2, q2) = (0, 0, 0, 0)
	n1 = int(input())
	a1 = list(map(int, input().split()[:n1]))
	n2 = int(input())
	a2 = list(map(int, input().split()[:n2]))
	for i in range(len(a1)):
		if a1[i] % 2 == 0:
			p1 += 1
		else:
			q1 += 1
	for i in range(len(a2)):
		if a2[i] % 2 == 0:
			p2 += 1
		else:
			q2 += 1
	print(p1 * p2 + q1 * q2)


def main():
	tc = int(input())
	for i in range(tc):
		num1 = int(input())
		even1 = sum((1 if int(i) % 2 == 0 else 0 for i in input().split()))
		odd1 = num1 - even1
		num2 = int(input())
		even2 = sum((1 if int(i) % 2 == 0 else 0 for i in input().split()))
		odd2 = num2 - even2
		print(even1 * even2 + odd1 * odd2)
main()


t = int(input())
for i in range(0, t):
	p = []
	q = []
	k = 0
	no = 0
	ne = 0
	me = 0
	mo = 0
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	for i in range(0, n):
		if p[i] % 2 == 0:
			ne = ne + 1
		else:
			no = no + 1
	for i in range(0, m):
		if q[i] % 2 == 0:
			me = me + 1
		else:
			mo = mo + 1
	k = me * ne + mo * no
	print(k)


t = int(input())
for i in range(t):
	n = int(input())
	n1 = list(map(int, input().split()))
	m = int(input())
	m1 = list(map(int, input().split()))
	even = odd = sum1 = 0
	for i in range(n):
		if abs(n1[i]) % 2 == 0:
			even = even + 1
		else:
			odd = odd + 1
	for i in range(m):
		if abs(m1[i]) % 2 == 0:
			sum1 = sum1 + even
		else:
			sum1 = sum1 + odd
	print(sum1)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	odd = even = ans = 0
	for item in p:
		if item % 2:
			odd += 1
		else:
			even += 1
	for item in q:
		if item % 2:
			ans += odd
		else:
			ans += even
	print(ans)


t = int(input())
i = 0
while i < t:
	i += 1
	n = int(input())
	a = list(map(int, input().strip().split()))
	m = int(input())
	b = list(map(int, input().strip().split()))
	imp1 = 0
	imp2 = 0
	for x in a:
		imp1 += x % 2
	for x in b:
		imp2 += x % 2
	print(imp1 * imp2 + (m - imp2) * (n - imp1))


from sys import stdin
tt = int(stdin.readline().strip())
for t in range(tt):
	n = int(stdin.readline().strip())
	s = list(map(int, stdin.readline().strip().split()))
	im1 = 0
	im2 = 0
	pa1 = 0
	pa2 = 0
	s = list(set(s))
	for i in range(len(s)):
		if s[i] % 2 == 0:
			pa1 += 1
		else:
			im1 += 1
	m = int(stdin.readline().strip())
	s1 = list(map(int, stdin.readline().strip().split()))
	s1 = list(set(s1))
	for i in range(len(s1)):
		if s1[i] % 2 == 0:
			pa2 += 1
		else:
			im2 += 1
	print(pa1 * pa2 + im1 * im2)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	n = int(input())
	b = [int(j) for j in input().split()]
	(e1, o1, e2, o2) = (0, 0, 0, 0)
	for x in a:
		if x % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for x in b:
		if x % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


def int_ersections(p, q):
	pmod2 = [0, 0]
	qmod2 = [0, 0]
	for x in p:
		pmod2[x % 2] += 1
	for x in q:
		qmod2[x % 2] += 1
	return pmod2[0] * qmod2[0] + pmod2[1] * qmod2[1]

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = list(map(int, input().rstrip().split()))
		m = int(input())
		q = list(map(int, input().rstrip().split()))
		print(int_ersections(p, q))
	return
main()


from sys import stdin
ip = stdin.readline
t = int(ip())
while t:
	t -= 1
	n = int(ip())
	ea = len([i for i in ip().split() if int(i) % 2 == 0])
	oa = n - ea
	m = int(ip())
	eb = len([i for i in ip().split() if int(i) % 2 == 0])
	ob = m - eb
	ans = oa * ob + ea * eb
	print(ans)


t = int(input())
while t:
	n = int(input())
	a = [int(n) for n in input().split()]
	m = int(input())
	b = [int(m) for m in input().split()]
	even1 = 0
	odd1 = 0
	even2 = 0
	odd2 = 0
	for i in range(n):
		if a[i] % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in range(m):
		if b[i] % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(odd1 * odd2 + even1 * even2)
	t = t - 1


for i in range(int(input())):
	odd = 0
	even = 0
	odd_cnt = 0
	even_cnt = 0
	input()
	for j in list(map(int, input().split())):
		if j & 1 != 0:
			odd += 1
		else:
			even += 1
	input()
	for j in list(map(int, input().split())):
		if j & 1 != 0:
			odd_cnt += 1
		else:
			even_cnt += 1
	print(odd * odd_cnt + even * even_cnt)


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
int_input = lambda : int(stdin.readline())
string_input = lambda : stdin.readline()
multi_int_input = lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input = lambda : list(map(int, stdin.readline().split()))
string_list_input = lambda : list(string_input())
MOD = pow(10, 9) + 7
test = int_input()
for _ in range(test):
	m = int_input()
	m_points = list_input()
	n = int_input()
	n_points = list_input()
	even = 0
	odd = 0
	for i in m_points:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	final = 0
	for i in n_points:
		if i % 2 == 0:
			final += even
		else:
			final += odd
	print(final)


t = int(input())

def even(A):
	n = 0
	for a in A:
		if a % 2 == 0:
			n += 1
	return n
for _ in range(t):
	n = int(input())
	A = [*map(int, input().split())]
	m = int(input())
	B = [*map(int, input().split())]
	Ae = even(A)
	Be = even(B)
	Ao = len(A) - Ae
	Bo = len(B) - Be
	print(Ae * Be + Ao * Bo)


t = int(input())
for tc in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(po, pe, qo, qe) = (0, 0, 0, 0)
	for i in p:
		if i & 1:
			po += 1
		else:
			pe += 1
	for i in q:
		if i & 1:
			qo += 1
		else:
			qe += 1
	print(pe * qe + po * qo)


t = int(input())
N = []
M = []
P = []
Q = []
for i in range(t):
	n = int(input())
	N.append(n)
	p = list(map(int, input().split()))
	P.append(p)
	m = int(input())
	M.append(m)
	q = list(map(int, input().split()))
	Q.append(q)
for i in range(t):
	ans = 0
	a = [0] * 2
	b = [0] * 2
	for j in range(N[i]):
		a[P[i][j] % 2] += 1
	for j in range(M[i]):
		b[Q[i][j] % 2] += 1
	ans += a[0] * b[0] + a[1] * b[1]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	cnt = [0, 0]
	for i in p:
		cnt[i % 2] += 1
	ans = 0
	for i in q:
		ans += cnt[i % 2]
	print(ans)


testcase = int(input())
ans = []
for t in range(testcase):
	n = int(input())
	dls = map(int, input().split(' '))
	m = int(input())
	jls = map(int, input().split(' '))
	dls_odd = 0
	jls_odd = 0
	dls_even = 0
	jls_even = 0
	for i in dls:
		if i % 2 == 0:
			dls_even += 1
		else:
			dls_odd += 1
	for i in jls:
		if i % 2 == 0:
			jls_even += 1
		else:
			jls_odd += 1
	ans.append(dls_even * jls_even + dls_odd * jls_odd)
for t in range(testcase):
	print(ans[t])


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	cnte = 0
	cnto = 0
	cne = 0
	cno = 0
	for i in p:
		if i % 2 == 0:
			cnte = cnte + 1
		else:
			cnto += 1
	for i in q:
		if i % 2 == 0:
			cne = cne + 1
		else:
			cno += 1
	print(cnte * cne + cnto * cno)


I = lambda : map(int, input().split())
for _ in range(int(input())):
	I()
	even_p = odd_p = 0
	for p in I():
		if p % 2:
			odd_p += 1
		else:
			even_p += 1
	I()
	even_q = odd_q = 0
	for q in I():
		if q % 2:
			odd_q += 1
		else:
			even_q += 1
	print(even_p * even_q + odd_p * odd_q)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	arr1 = list(map(int, input().split()))
	y = int(input())
	arr2 = list(map(int, input().split()))
	ev1 = 0
	od1 = 0
	ev2 = 0
	od2 = 0
	for i in range(x):
		if arr1[i] % 2 == 0:
			ev1 += 1
		else:
			od1 += 1
	for i in range(y):
		if arr2[i] % 2 == 0:
			ev2 += 1
		else:
			od2 += 1
	ans = ev1 * ev2 + od1 * od2
	print(ans)


p = []
for _ in range(int(input())):
	n = 0
	l = [0, 0]
	input()
	a = list(map(int, input().split()))
	for i in a:
		if i % 2 == 0:
			l[0] += 1
		else:
			l[1] += 1
	input()
	k = list(map(int, input().split()))
	for i in k:
		n += l[i % 2]
	print(n)


T = int(input())
for t in range(T):
	n1 = int(input())
	nums1 = [int(x) for x in input().split(' ')]
	n2 = int(input())
	nums2 = [int(x) for x in input().split(' ')]
	odd1 = 0
	even1 = 0
	for num in nums1:
		if num % 2:
			odd1 += 1
		else:
			even1 += 1
	odd2 = 0
	even2 = 0
	for num in nums2:
		if num % 2:
			odd2 += 1
		else:
			even2 += 1
	print(odd1 * odd2 + even1 * even2)


t = int(input())
for k in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	p0 = 0
	p1 = 0
	m = int(input())
	q = [int(i) for i in input().split()]
	q0 = 0
	q1 = 0
	for i in p:
		if i % 2 == 0:
			p0 += 1
		else:
			p1 += 1
	for i in q:
		if i % 2 == 0:
			q0 += 1
		else:
			q1 += 1
	print(p0 * q0 + p1 * q1)


for T in range(int(input())):
	n = int(input())
	narr = list(map(int, input().split()))
	m = int(input())
	marr = list(map(int, input().split()))
	o1 = 0
	e1 = 0
	for i in narr:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	e2 = 0
	o2 = 0
	for i in marr:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


def pairs(p, n, q, m):
	p_odd = 0
	for el in p:
		if el % 2:
			p_odd += 1
	q_odd = 0
	for el in q:
		if el % 2:
			q_odd += 1
	return p_odd * q_odd + (n - p_odd) * (m - q_odd)
t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	print(pairs(p, n, q, m))


n = int(input())
for i in range(n):
	m = int(input())
	a = [int(i) for i in input().split()]
	s = int(input())
	b = [int(i) for i in input().split()]
	e = 0
	o = 0
	ee = 0
	oo = 0
	for j in range(0, len(a)):
		if a[j] % 2 == 0:
			e = e + 1
		else:
			o = o + 1
	for j in range(0, len(b)):
		if b[j] % 2 == 0:
			ee = ee + e
		else:
			oo = oo + o
	print(ee + oo)


t = int(input())
while t != 0:
	n = int(input())
	pi = input().split()
	pi = [int(x) for x in pi]
	m = int(input())
	qi = input().split()
	qi = [int(x) for x in qi]
	even_pi = 0
	odd_pi = 0
	for p in pi:
		if p % 2 == 0:
			even_pi += 1
		else:
			odd_pi += 1
	res = 0
	for q in qi:
		if q % 2 == 0:
			res += even_pi
		else:
			res += odd_pi
	print(res)
	t -= 1


def intersection(x, y):
	odd_x = len([a for a in x if a % 2 != 0])
	even_x = len(x) - odd_x
	odd_y = len([b for b in y if b % 2 != 0])
	even_y = len(y) - odd_y
	return odd_y * odd_x + even_y * even_x
for i in range(int(input())):
	n = input()
	N = list(map(int, input().split()))
	m = input()
	M = list(map(int, input().split()))
	print(intersection(N, M))


t = int(input())
for i in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	m = int(input())
	q = [int(i) for i in input().split()]
	c = 0
	p_even = []
	p_odd = []
	q_even = []
	q_odd = []
	for i in range(n):
		if p[i] % 2 == 0:
			p_even.append(p[i])
		else:
			p_odd.append(p[i])
	for i in range(m):
		if q[i] % 2 == 0:
			q_even.append(q[i])
		else:
			q_odd.append(q[i])
	print(len(q_even) * len(p_even) + len(q_odd) * len(p_odd))


def abs(n, m):
	a1 = 0
	a2 = 0
	b1 = 0
	b2 = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			a1 += 1
		else:
			a2 += 1
	for i in range(len(b)):
		if b[i] % 2 == 0:
			b1 += 1
		else:
			b2 += 1
	return a1 * b1 + a2 * b2
k = int(input())
for i in range(k):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	print(abs(n, m))


for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	m = int(input())
	brr = [int(i) for i in input().split()]
	(o1, o2, e1, e2) = (0, 0, 0, 0)
	for i in arr:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in brr:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(o1 * o2 + e1 * e2)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	y = 0
	for j in range(n):
		a[j] = a[j] % 2
	for k in range(m):
		b[k] = b[k] % 2
	print(a.count(0) * b.count(0) + a.count(1) * b.count(1))


def main():
	t = int(input())
	for _ in range(t):
		(even, odd) = ([0, 0], [0, 0])
		dls = int(input())
		p = list(map(int, input().split()))
		for x in p:
			if x & 1:
				odd[0] += 1
			else:
				even[0] += 1
		jls = int(input())
		q = list(map(int, input().split()))
		for x in q:
			if x & 1:
				odd[1] += 1
			else:
				even[1] += 1
		print(even[0] * even[1] + odd[1] * odd[0])
main()


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	even1 = 0
	even2 = 0
	for j in a:
		if j % 2 == 0:
			even1 += 1
	for k in b:
		if k % 2 == 0:
			even2 += 1
	f = even2 * even1 + (n - even1) * (m - even2)
	print(f)


from sys import stdin
from itertools import product
from math import ceil

def solution(t) -> None:
	input = stdin.readline
	total_all = []
	for i in range(t):
		p = input()
		dls = map(int, input().split())
		q = input()
		jls = map(int, input().split())
		evens1 = odds1 = evens2 = odds2 = 0
		for x in dls:
			if x % 2 == 0:
				evens1 += 1
			else:
				odds1 += 1
		for y in jls:
			if y % 2 == 0:
				evens2 += 1
			else:
				odds2 += 1
		total = 0
		if evens1 and evens2:
			total += evens1 * evens2
		if odds1 and odds2:
			total += odds1 * odds2
		total_all.append(total)
	print('\n'.join(map(str, total_all)))

def main():
	t = int(input())
	solution(t)
main()


t = int(input())
for i in range(t):
	res = 0
	n = int(input())
	l1 = list(map(int, input().split(' ')))
	m = int(input())
	l2 = list(map(int, input().split(' ')))
	(ch, ch1) = (0, 0)
	(nech, nech1) = (0, 0)
	for i in l1:
		if not i % 2:
			ch += 1
		else:
			nech += 1
	for j in l2:
		if not j % 2:
			ch1 += 1
		else:
			nech1 += 1
	print(nech * nech1 + ch * ch1)


test = int(input())
for x in range(test):
	n = int(input())
	array = list(map(int, input().split()))
	odd = 0
	even = 0
	for it in array:
		if it % 2 == 0:
			even += 1
		else:
			odd += 1
	m = int(input())
	answer = 0
	array = list(map(int, input().split()))
	for it in array:
		if it % 2 == 0:
			answer += even
		else:
			answer += odd
	print(answer)


for _ in range(int(input())):
	n = int(input())
	a = sum((1 for i in list(map(int, input().split())) if i % 2 == 0))
	m = int(input())
	b = sum((1 for i in list(map(int, input().split())) if i % 2 == 0))
	print(a * b + (n - a) * (m - b))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

def ssinp():
	return input()

def iinp():
	return int(input())

def nninp():
	return map(int, input().split())

def llinp():
	return list(map(int, input().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
for __ in range(iinp()):
	n = iinp()
	a1 = llinp()
	m = iinp()
	a2 = llinp()
	even1 = even2 = odd1 = odd2 = 0
	for c in a1:
		if c % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for c in a2:
		if c % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(even1 * even2 + odd1 * odd2)


t = int(input())
while t:
	t -= 1
	n = int(input())
	neven = len([i for i in input().split() if int(i) % 2 == 0])
	m = int(input())
	meven = len([i for i in input().split() if int(i) % 2 == 0])
	print(neven * meven + (n - neven) * (m - meven))


a = int(input())
for i in range(a):
	b = input()
	c = list(map(int, input().split(' ')))
	c_odd = 0
	c_even = 0
	for j in range(len(c)):
		if c[j] % 2 == 0:
			c_even = c_even + 1
		else:
			c_odd = c_odd + 1
	d = input()
	e = list(map(int, input().split(' ')))
	e_odd = 0
	e_even = 0
	for j in range(len(e)):
		if e[j] % 2 == 0:
			e_even = e_even + 1
		else:
			e_odd = e_odd + 1
	how_much = c_even * e_even + c_odd * e_odd
	print(how_much)


t = int(input())
for w in range(t):
	n = int(input())
	l1 = [int(i) for i in input().split()]
	m = int(input())
	l2 = [int(i) for i in input().split()]
	(c1, c2, c3, c4) = (0, 0, 0, 0)
	for i in l1:
		if i % 2 == 0:
			c1 += 1
		else:
			c2 += 1
	for i in l2:
		if i % 2 == 0:
			c3 += 1
		else:
			c4 += 1
	print(c1 * c3 + c2 * c4)


t = int(input())
l = []
for i in range(t):
	x = int(input())
	a = [int(k) for k in input().split(' ')]
	y = int(input())
	b = [int(k) for k in input().split(' ')]
	(c1, c2) = (0, 0)
	for i in a:
		if i % 2 == 0:
			c1 += 1
	for i in b:
		if i % 2 == 0:
			c2 += 1
	c = c1 * c2 + (x - c1) * (y - c2)
	l.append(c)
print('\n'.join((str(k) for k in l)))


t = int(input())
for i in range(t):
	n = int(input())
	counter1 = counter2 = 0
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	for item in p:
		if item % 2 == 0:
			counter1 += 1
	for item in q:
		if item % 2 == 0:
			counter2 += 1
	print(n * m - counter1 * (m - counter2) - counter2 * (n - counter1))


tests = int(input())
for i in range(tests):
	first = int(input())
	first_array = [int(i) for i in input().split()]
	second = int(input())
	second_array = [int(i) for i in input().split()]
	par1 = impar1 = par2 = impar2 = 0
	for i in first_array:
		if i % 2 == 0:
			par1 += 1
		else:
			impar1 += 1
	for i in second_array:
		if i % 2 == 0:
			par2 += 1
		else:
			impar2 += 1
	print(par1 * par2 + impar1 * impar2)


import math
for t in range(int(input())):
	n = int(input())
	p = [int(i) for i in input().strip().split()]
	m = int(input())
	q = [int(i) for i in input().strip().split()]
	c_o_p = 0
	c_e_p = 0
	c_o_q = 0
	c_e_q = 0
	for i in p:
		if i % 2 == 0:
			c_e_p += 1
		else:
			c_o_p += 1
	for i in q:
		if i % 2 == 0:
			c_e_q += 1
		else:
			c_o_q += 1
	s = c_o_p * c_o_q + c_e_p * c_e_q
	print(s)


t = int(input())
for tests in range(t):
	n = int(input())
	s1 = input().split()
	for i in range(n):
		s1[i] = int(s1[i])
	m = int(input())
	s2 = input().split()
	for i in range(m):
		s2[i] = int(s2[i])
	evensIn1 = 0
	evensIn2 = 0
	oddsIn1 = 0
	oddsIn2 = 0
	for i in s1:
		if i % 2 == 0:
			evensIn1 += 1
		else:
			oddsIn1 += 1
	for i in s2:
		if i % 2 == 0:
			evensIn2 += 1
		else:
			oddsIn2 += 1
	print(evensIn1 * evensIn2 + oddsIn1 * oddsIn2)


def intersectionpoints(p, q):
	count = 0
	odd = 0
	even = 0
	for i in p:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	for i in q:
		if i % 2 == 0:
			count += even
		elif i % 2 != 0:
			count += odd
	print(count)
t = int(input())
dn = []
jm = []
p = []
q = []
for i in range(t):
	dn.append(input())
	l = input().split()
	l = list(map(int, l))
	p.append(l)
	jm.append(input())
	l = input().split()
	l = list(map(int, l))
	q.append(l)
for k in range(t):
	intersectionpoints(p[k], q[k])


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	cn0 = 0
	cn1 = 0
	for i in range(n):
		if p[i] % 2 == 0:
			cn0 += 1
		else:
			cn1 += 1
	cm0 = 0
	cm1 = 0
	for i in range(m):
		if q[i] % 2 == 0:
			cm0 += 1
		else:
			cm1 += 1
	print(cn0 * cm0 + cn1 * cm1)


input = __import__('sys').stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	M = int(input())
	B = list(map(int, input().split()))
	(a_odd, b_odd, a_even, b_even) = (0, 0, 0, 0)
	for n in A:
		if n % 2 != 0:
			a_odd += 1
		else:
			a_even += 1
	for n in B:
		if n % 2 != 0:
			b_odd += 1
		else:
			b_even += 1
	print(a_odd * b_odd + a_even * b_even)


for _ in range(int(input())):
	dn = int(input())
	d = list(map(int, input().split()))
	jn = int(input())
	j = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	c11 = 0
	c22 = 0
	for i in d:
		if i % 2 == 0:
			c1 += 1
		else:
			c2 += 1
	for i in j:
		if i % 2 == 0:
			c11 += 1
		else:
			c22 += 1
	print(c1 * c11 + c2 * c22)


t = int(input())
for _ in range(t):
	n = int(input())
	a1 = list(map(int, input().split()))
	m = int(input())
	a2 = list(map(int, input().split()))
	(even1, odd1) = (0, 0)
	for v in a1:
		if v % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	(even2, odd2) = (0, 0)
	for v in a2:
		if v % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(even1 * even2 + odd1 * odd2)


def solve():
	n = int(input())
	p = list(map(int, input().split(' ')))
	m = int(input())
	q = list(map(int, input().split(' ')))
	ans = 0
	odd = 0
	even = 0
	for x in p:
		if x % 2 == 1:
			odd += 1
		else:
			even += 1
	for x in q:
		if x % 2 == 1:
			ans += odd
		else:
			ans += even
	print(ans)
for _ in range(int(input())):
	solve()


n = int(input())
for i in range(n):
	p = int(input())
	b = list(map(int, input().split()))
	q = int(input())
	c = list(map(int, input().split()))
	x = 0
	y = 0
	for j in range(p):
		if b[j] % 2 == 0:
			x += 1
	for j in range(q):
		if c[j] % 2 == 0:
			y += 1
	print(x * y + (p - x) * (q - y))


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))[:n]
	m = int(input())
	b = list(map(int, input().split()))[:m]
	s = 0
	eve = 0
	k = 0
	t = 0
	for i in range(n):
		if ar[i] % 2:
			s = s + 1
		else:
			eve = eve + 1
	for i in range(m):
		if b[i] % 2:
			k = k + 1
		else:
			t = t + 1
	y = eve * t + s * k
	print(y)


t = int(input())
for i in range(t):
	abc = [[0, 0], [0, 0]]
	n = int(input())
	for tp in input().split():
		tp = int(tp)
		if tp & 1:
			abc[0][0] += 1
		else:
			abc[0][1] += 1
	n = int(input())
	for tp in input().split():
		tp = int(tp)
		if tp & 1:
			abc[1][0] += 1
		else:
			abc[1][1] += 1
	print(abc[0][0] * abc[1][0] + abc[0][1] * abc[1][1])


from math import *
from collections import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	(e, o) = (0, 0)
	for i in a:
		if i % 2:
			o += 1
		else:
			e += 1
	(e1, o1) = (0, 0)
	m = int(input())
	b = list(map(int, input().split()))
	for i in b:
		if i % 2:
			o1 += 1
		else:
			e1 += 1
	print(e1 * e + o * o1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	(even, even1) = (0, 0)
	for i in range(n):
		if a[i] % 2 == 0:
			even1 += 1
	for i in range(m):
		if b[i] % 2 == 0:
			even += 1
	ans = abs(even1 * even) + abs((n - even1) * (m - even))
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	a1 = 0
	for x in a:
		if x % 2 == 0:
			a1 += 1
	b1 = 0
	for x in b:
		if x % 2 == 0:
			b1 += 1
	print(a1 * b1 + (len(a) - a1) * (len(b) - b1))


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	podd = 0
	peven = 0
	for x in p:
		if x % 2 == 0:
			peven += 1
		else:
			podd += 1
	qodd = 0
	qeven = 0
	for x in q:
		if x % 2 == 0:
			qeven += 1
		else:
			qodd += 1
	ans = podd * qodd + peven * qeven
	print(ans)


t = int(input())
for i in range(t):
	y1 = 0
	y2 = 0
	n = int(input())
	k = input()
	k = k.split()
	m = int(input())
	j = input()
	j = j.split()
	for l in k:
		if int(l) % 2 == 0:
			y1 += 1
	for l in j:
		if int(l) % 2 == 0:
			y2 += 1
	sum = y1 * y2 + (m - y2) * (n - y1)
	print(sum)


from collections import Counter
tests = int(input())
for _ in range(tests):
	first_array_size = input()
	first_array = Counter(map(lambda x: int(x) % 2, input().split()))
	second_array_size = input()
	second_array = Counter(map(lambda x: int(x) % 2, input().split()))
	print(first_array[0] * second_array[0] + first_array[1] * second_array[1])


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	chp = 0
	nchp = 0
	chm = 0
	nchm = 0
	for elem in p:
		if elem % 2 == 0:
			chp += 1
		else:
			nchp += 1
	for elem in q:
		if elem % 2 == 0:
			chm += 1
		else:
			nchm += 1
	print(nchp * nchm + chp * chm)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	pOdd = 0
	qOdd = 0
	pEven = 0
	qEven = 0
	for i in p:
		if i % 2:
			pOdd += 1
		else:
			pEven += 1
	for j in q:
		if j % 2:
			qOdd += 1
		else:
			qEven += 1
	print(pOdd * qOdd + pEven * qEven)


test = int(input())
answer = []
for i in range(test):
	n = input()
	even1 = 0
	even2 = 0
	odd1 = 0
	odd2 = 0
	liste = input().split(' ')
	liste = [int(element) for element in liste]
	for number in liste:
		if number % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	m = input()
	liste = input().split(' ')
	liste = [int(element) for element in liste]
	for number in liste:
		if number % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	answer.append(str(even1 * even2 + odd1 * odd2))
print('\n'.join(answer))


for i in range(int(input())):
	input()
	od_1 = 0
	ev_1 = 0
	for j in [int(s) for s in input().split()]:
		if j % 2 == 0:
			ev_1 += 1
		else:
			od_1 += 1
	input()
	od_2 = 0
	ev_2 = 0
	for j in [int(s) for s in input().split()]:
		if j % 2 == 0:
			ev_2 += 1
		else:
			od_2 += 1
	print(ev_1 * ev_2 + od_1 * od_2)


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(z, y) = (0, 0)
	for i in p:
		if i % 2 == 0:
			z += 1
	for i in q:
		if i % 2 == 0:
			y += 1
	print(z * y + (n - z) * (m - y))


def intr(n, p, m, q):
	count = 0
	count1 = 0
	s = 0
	s1 = s2 = 0
	for i in range(n):
		if p[i] % 2 == 0:
			count += 1
	for i in range(m):
		if q[i] % 2 == 0:
			count1 += 1
	z = n - count
	y = m - count1
	return z * y + count * count1
t = int(input())
for i in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	m = int(input())
	q = [int(i) for i in input().split()]
	ans = intr(n, p, m, q)
	print(ans)


querries = int(input())
for querrie in range(querries):
	n = int(input())
	allps = input().split()
	for p in range(n):
		allps[p] = int(allps[p])
	m = int(input())
	allqs = input().split()
	for q in range(m):
		allqs[q] = int(allqs[q])
	evensp = 0
	oddsp = 0
	evensq = 0
	oddsq = 0
	total = 0
	for p in allps:
		if p % 2 == 0:
			evensp = evensp + 1
		else:
			oddsp = oddsp + 1
	for q in allqs:
		if q % 2 == 0:
			evensq = evensq + 1
		else:
			oddsq = oddsq + 1
	print(evensq * evensp + oddsq * oddsp)


import sys
input = sys.stdin.readline
T = int(input())
for t in range(T):
	N = int(input())
	l1 = list(map(int, input().split()))
	M = int(input())
	l2 = list(map(int, input().split()))
	d1 = {0: 0, 1: 0}
	d2 = {0: 0, 1: 0}
	for i in l1:
		if i % 2 == 0:
			d1[0] += 1
		else:
			d1[1] += 1
	for i in l2:
		if i % 2 == 0:
			d2[0] += 1
		else:
			d2[1] += 1
	ans = d1[0] * d2[0] + d1[1] * d2[1]
	print(ans)


def countPairs(P, Q, n, m):
	count = [0] * 2
	count2 = [0] * 2
	for i in range(n):
		if P[i] % 2 == 0:
			count[0] += 1
		else:
			count[1] += 1
	for i in range(m):
		if Q[i] % 2 == 0:
			count2[0] += 1
		else:
			count2[1] += 1
	return count[0] * count2[0] + count[1] * count2[1]
t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	print(countPairs(a, b, n, m))


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	oddm = 0
	evenm = 0
	oddn = 0
	evenn = 0
	for i in range(n):
		if p[i] % 2 == 0:
			evenn += 1
		else:
			oddn += 1
	for i in range(m):
		if q[i] % 2 == 0:
			evenm += 1
		else:
			oddm += 1
	ans = evenm * evenn + oddm * oddn
	print(ans)


for _ in range(int(input())):
	p = int(input())
	ps = list(map(int, input().split()))
	q = int(input())
	qs = list(map(int, input().split()))
	(even_p, odd_p) = (0, 0)
	(even_q, odd_q) = (0, 0)
	for i in ps:
		if i % 2 == 0:
			even_p += 1
		else:
			odd_p += 1
	for i in qs:
		if i % 2 == 0:
			even_q += 1
		else:
			odd_q += 1
	print(even_p * even_q + odd_p * odd_q)


n = int(input())
for i in range(n):
	cont1 = 0
	cont2 = 0
	n1 = int(input())
	pi = [int(k) for k in input().split()]
	n2 = int(input())
	qi = [int(k) for k in input().split()]
	for k in range(n1):
		if pi[k] % 2 == 0:
			cont1 += 1
	for j in range(n2):
		if qi[j] % 2 == 0:
			cont2 += 1
	intersect = cont2 * cont1 + (n1 - cont1) * (n2 - cont2)
	print(intersect)


from sys import stdin

def input():
	return stdin.buffer.readline()
t = int(input())
for _ in range(t):
	m = int(input())
	ps = list(map(int, input().split()))
	n = int(input())
	qs = list(map(int, input().split()))
	odd_p = 0
	eve_p = 0
	odd_q = 0
	eve_q = 0
	for p in ps:
		if p % 2 == 1:
			odd_p += 1
		else:
			eve_p += 1
	for q in qs:
		if q % 2 == 1:
			odd_q += 1
		else:
			eve_q += 1
	print(odd_p * odd_q + eve_p * eve_q)


t = int(input())
for z in range(t):
	p = [[0, 0], [0, 0]]
	for i in range(2):
		n = int(input())
		arr = input().split()
		for x in arr:
			x = int(x)
			if x % 2 == 0:
				p[i][0] += 1
			else:
				p[i][1] += 1
	print(p[0][0] * p[1][0] + p[0][1] * p[1][1])


for _ in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	a = 0
	b = 0
	c = 0
	d = 0
	for i in l1:
		if i % 2 == 0:
			a += 1
		else:
			b += 1
	for j in l2:
		if j % 2 == 0:
			c += 1
		else:
			d += 1
	print(int(a * c + b * d))


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		p = list(map(int, input().split()))
		m = int(input())
		q = list(map(int, input().split()))
		pzero = 0
		pone = 0
		qzero = 0
		qone = 0
		for j in p:
			if j % 2 == 0:
				pzero += 1
			else:
				pone += 1
		for j in q:
			if j % 2 == 0:
				qzero += 1
			else:
				qone += 1
		print(pzero * qzero + pone * qone)
main()


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(meven, neven) = (0, 0)
	for j in p:
		if j % 2 == 0:
			neven += 1
	for j in q:
		if j % 2 == 0:
			meven += 1
	nodd = n - neven
	modd = m - meven
	print(meven * neven + modd * nodd)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
for i in range(INT()):
	C = [0] * 2
	ans = 0
	N = INT()
	for a in LIST():
		C[a % 2] += 1
	M = INT()
	for b in LIST():
		ans += C[b % 2]
	print(ans)


n = int(input())
for nn in range(n):
	num_of_lines_1 = int(input())
	list_of_lines_1 = list(map(int, input().split()))
	num_of_lines_2 = int(input())
	list_of_lines_2 = list(map(int, input().split()))
	odds_in_line1 = 0
	evens_in_line1 = 0
	for i in list_of_lines_1:
		if i % 2 == 0:
			evens_in_line1 += 1
		else:
			odds_in_line1 += 1
	odds_in_line2 = 0
	evens_in_line2 = 0
	for ii in list_of_lines_2:
		if ii % 2 == 0:
			evens_in_line2 += 1
		else:
			odds_in_line2 += 1
	print(odds_in_line1 * odds_in_line2 + evens_in_line1 * evens_in_line2)


import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
	N = ni()
	for _ in range(N):
		n = ni()
		p = na()
		m = ni()
		q = na()
		e = 0
		o = 0
		for pp in p:
			if pp % 2 == 0:
				e += 1
			else:
				o += 1
		e1 = 0
		o1 = 0
		for qq in q:
			if qq % 2 == 0:
				e1 += 1
			else:
				o1 += 1
		print(e * e1 + o * o1)
main()


from sys import stdin, stdout
for i in stdin:
	t = int(i)
	break
while t:
	for i in stdin:
		n = int(i)
		break
	for i in stdin:
		P = [1 if i % 2 else 0 for i in list(map(int, i.strip().split()))]
		break
	for i in stdin:
		m = int(i)
		break
	for i in stdin:
		Q = [1 if i % 2 else 0 for i in list(map(int, i.strip().split()))]
		break
	k = P.count(1) * Q.count(1) + P.count(0) * Q.count(0)
	stdout.write(str(k) + '\n')
	t -= 1


for _ in range(int(input())):
	input()
	p1 = list(map(int, input().split()))
	input()
	p2 = list(map(int, input().split()))
	o1 = len([x for x in p1 if x & 1])
	e1 = len([x for x in p1 if x % 2 == 0])
	o2 = len([x for x in p2 if x & 1])
	e2 = len([x for x in p2 if x % 2 == 0])
	print(o1 * o2 + e1 * e2)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	(count1, count2) = (0, 0)
	(count3, count4) = (0, 0)
	for i in range(n):
		if p[i] % 2 == 0:
			count1 += 1
		else:
			count2 += 1
	for i in range(m):
		if q[i] % 2 == 0:
			count3 += 1
		else:
			count4 += 1
	print(count1 * count3 + count2 * count4)


foo = []
n = int(input())
for i in range(n):
	u = 0
	l = 0
	u1 = 0
	l1 = 0
	q = int(input())
	s = input().split()
	for j in s:
		if int(j) % 2 == 0:
			u += 1
		else:
			l += 1
	q = int(input())
	s = input().split()
	for j in s:
		if int(j) % 2 == 0:
			u1 += 1
		else:
			l1 += 1
	foo.append(u * u1 + l * l1)
for i in foo:
	print(i)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
for t in range(mint()):
	a = [0, 0]
	b = [0, 0]
	mint()
	for i in mints():
		a[i % 2] += 1
	mint()
	for i in mints():
		b[i % 2] += 1
	print(a[0] * b[0] + a[1] * b[1])


import sys, math, queue, collections
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
for _ in range(int(input())):
	n = int(input())
	a = sum(map(lambda x: int(x) % 2, input().split()))
	m = int(input())
	b = sum(map(lambda x: int(x) % 2, input().split()))
	print(a * b + (n - a) * (m - b))


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	cnt_a1 = 0
	cnt_a2 = 0
	cnt_b1 = 0
	cnt_b2 = 0
	for elem in p:
		cnt_a1 += elem % 2
		cnt_a2 += elem % 2 - 1
	for elem in q:
		cnt_b1 += elem % 2
		cnt_b2 += elem % 2 - 1
	print(cnt_a1 * cnt_b1 + cnt_a2 * cnt_b2)


t = int(input())
for i in range(t):
	n = int(input())
	dls = [int(i) for i in input().split()]
	m = int(input())
	jls = [int(i) for i in input().split()]
	even = 0
	odd = 0
	for i in range(n):
		if dls[i] % 2 == 1:
			even += 1
		else:
			odd += 1
	even1 = 0
	odd1 = 0
	for i in range(m):
		if jls[i] % 2 == 1:
			even1 += 1
		elif jls[i] % 2 == 0:
			odd1 += 1
	print(even * even1 + odd * odd1)


import sys
import math
input = sys.stdin.readline
from collections import defaultdict as dc
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	o1 = 0
	e1 = 0
	o2 = 0
	e2 = 0
	for i in p:
		if i % 2:
			o1 += 1
		else:
			e1 += 1
	for i in q:
		if i % 2:
			o2 += 1
		else:
			e2 += 1
	print(o1 * o2 + e1 * e2)


def func(a, b):
	ans = 0
	even = 0
	odd = 0
	for i in a:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	for i in b:
		if i % 2 == 0:
			ans += even
		else:
			ans += odd
	print(ans)
k = int(input())
for i in range(k):
	value = int(input())
	a = list(map(int, input().split()))
	value1 = int(input())
	b = list(map(int, input().split()))
	func(a, b)


c2 = c1 = 0
t = int(input())
while t > 0:
	c2 = c1 = 0
	a = int(input())
	l1 = list(map(int, input().split()))
	b = int(input())
	l2 = list(map(int, input().split()))
	for i in l2:
		if i % 2 == 0:
			c1 += 1
	for i in l1:
		if i % 2 == 0:
			c2 += 1
	t -= 1
	print(c1 * c2 + (len(l2) - c1) * (len(l1) - c2))


for _ in range(int(input())):
	n = int(input())
	p1 = list(map(int, input().split()))
	m = int(input())
	p2 = list(map(int, input().split()))
	x1 = 0
	y1 = 0
	x2 = 0
	y2 = 0
	for i in range(n):
		if p1[i] % 2 == 0:
			x1 += 1
		else:
			y1 += 1
	for i in range(m):
		if p2[i] % 2 == 0:
			x2 += 1
		else:
			y2 += 1
	print(x1 * x2 + y1 * y2)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	m = int(input())
	b = [int(x) for x in input().split()]
	e1 = o1 = e2 = o2 = 0
	for i in a:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in b:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	s = e1 * e2 + o1 * o2
	print(s)


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
t = ii()
for i in range(t):
	n = ii()
	p = li()
	m = ii()
	q = li()
	o = e = 0
	for i in range(m):
		if q[i] % 2 == 0:
			e += 1
		else:
			o += 1
	ans = 0
	for i in range(n):
		if p[i] % 2 == 0:
			ans += e
		else:
			ans += o
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	ns = list(map(int, input().split()))
	m = int(input())
	ms = list(map(int, input().split()))
	neven = 0
	meven = 0
	for i in ns:
		if i % 2 == 0:
			neven += 1
	nodd = n - neven
	for i in ms:
		if i % 2 == 0:
			meven += 1
	modd = m - meven
	print(meven * neven + modd * nodd)


test = int(input())
for i in range(test):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	count = 0
	(p_odd, p_even) = (0, 0)
	for point in p:
		if point % 2 == 0:
			p_even += 1
		else:
			p_odd += 1
	(q_odd, q_even) = (0, 0)
	for point in q:
		if point % 2 == 0:
			q_even += 1
		else:
			q_odd += 1
	if p_odd > 0 and q_odd > 0:
		count += p_odd * q_odd
	if p_even > 0 and q_even > 0:
		count += p_even * q_even
	print(count)


t = int(input())
while t:
	n = int(input())
	a = input().split(' ')
	(x1, x2, y1, y2) = (0, 0, 0, 0)
	for i in range(0, n):
		a[i] = int(a[i])
		if a[i] % 2 == 0:
			x1 += 1
	x2 = n - x1
	m = int(input())
	b = input().split(' ')
	for i in range(0, m):
		b[i] = int(b[i])
		if b[i] % 2 == 0:
			y1 += 1
	y2 = m - y1
	print(x1 * y1 + x2 * y2)
	t -= 1


t = int(input())
for k in range(0, t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	m = int(input())
	b = list(map(int, input().split(' ')))
	ae = 0
	ao = 0
	be = 0
	bo = 0
	for i in a:
		if i % 2 == 0:
			ae += 1
		else:
			ao += 1
	for i in b:
		if i % 2 == 0:
			be += 1
		else:
			bo += 1
	print(ae * be + ao * bo)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	r = list(map(int, input().split()))
	rodd = 0
	rev = 0
	lodd = 0
	lev = 0
	for i in range(len(r)):
		if r[i] % 2 == 0:
			rev += 1
		else:
			rodd += 1
	for i in range(len(l)):
		if l[i] % 2 == 0:
			lev += 1
		else:
			lodd += 1
	print(lodd * rodd + rev * lev)


T = int(input())
for t in range(T):
	N = int(input())
	P = list(map(int, input().split()))
	M = int(input())
	Q = list(map(int, input().split()))
	o1 = 0
	e1 = 0
	o2 = 0
	e2 = 0
	for p in P:
		if p % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for q in Q:
		if q % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(o1 * o2 + e1 * e2)


T = int(input())
for _ in range(T):
	N = int(input())
	NP = [int(x) for x in input().split()]
	M = int(input())
	MP = [int(x) for x in input().split()]
	count = 0
	(Neven, Nodd) = (0, 0)
	for i in range(N):
		if NP[i] % 2 == 0:
			Neven += 1
		else:
			Nodd += 1
	(Meven, Modd) = (0, 0)
	for i in range(M):
		if MP[i] % 2 == 0:
			Meven += 1
		else:
			Modd += 1
	count = Neven * Meven + Nodd * Modd
	print(count)


import math
t = int(input())
for i in range(t):
	n = int(input())
	array_n = list(map(int, input().split()))
	m = int(input())
	array_m = list(map(int, input().split()))
	array_n_even = len([x for x in array_n if x % 2 == 0])
	array_m_even = len([x for x in array_m if x % 2 == 0])
	array_n_odd = len(array_n) - array_n_even
	array_m_odd = len(array_m) - array_m_even
	res = array_m_even * array_n_even + array_m_odd * array_n_odd
	print(res)


t = int(input())
for _ in range(t):
	n = int(input())
	P = [int(i) for i in input().split()]
	m = int(input())
	Q = [int(i) for i in input().split()]
	(n1, m1) = (0, 0)
	for i in range(n):
		if P[i] % 2 == 1:
			n1 += 1
	for i in range(m):
		if Q[i] % 2 == 1:
			m1 += 1
	print((n - n1) * (m - m1) + n1 * m1)


t = int(input())
for i in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	q = int(input())
	l2 = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	c3 = 0
	c4 = 0
	for j in l1:
		if j % 2 == 0:
			c1 += 1
		else:
			c2 += 1
	for j in l2:
		if j % 2 == 0:
			c3 += 1
		else:
			c4 += 1
	w = c1 * c3 + c2 * c4
	print(w)


import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline

def ii():
	return int(input())

def mi():
	return map(int, input().rstrip().split())

def lmi():
	return list(map(int, input().rstrip().split()))

def fi():
	return float(input())

def mfi():
	return map(float, input().rstrip().split())

def lmfi():
	return list(map(float, input().rstrip().split()))

def li():
	return list(input().rstrip())

def debug(*args, sep=' ', end='\n'):
	print('debug:', *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None

def exit(*arg):
	print(*arg)
	sys.exit()

def main():
	t = ii()
	for _ in range(t):
		n = ii()
		p = lmi()
		m = ii()
		q = lmi()
		op = 0
		oq = 0
		ep = 0
		eq = 0
		for x in p:
			if x % 2 == 0:
				ep += 1
			else:
				op += 1
		for x in q:
			if x % 2 == 0:
				eq += 1
			else:
				oq += 1
		print(op * oq + ep * eq)
	return
main()


t = int(input())
while t > 0:
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	impar1 = 0
	par1 = 0
	for i in range(0, n):
		if p[i] % 2 == 1:
			impar1 = impar1 + 1
		else:
			par1 = par1 + 1
	impar2 = 0
	par2 = 0
	for i in range(0, m):
		if q[i] % 2 == 1:
			impar2 = impar2 + 1
		else:
			par2 = par2 + 1
	ans = impar1 * impar2 + par1 * par2
	print(ans)
	t = t - 1


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	k = 0
	t = 0
	u = 0
	v = 0
	for i in range(n):
		if p[i] % 2 == 0:
			k += 1
		else:
			t += 1
	for i in range(m):
		if q[i] % 2 == 0:
			u += 1
		else:
			v += 1
	print(k * u + t * v)


t = int(input())
for test in range(t):
	n = int(input())
	ps = [int(x) for x in input().split()]
	m = int(input())
	qs = [int(x) for x in input().split()]
	count = 0
	podds = 0
	pevens = 0
	qodds = 0
	qevens = 0
	for i in range(n):
		if ps[i] % 2 != 0:
			podds += 1
		else:
			pevens += 1
	for j in range(m):
		if qs[j] % 2 != 0:
			qodds += 1
		else:
			qevens += 1
	print(pevens * qevens + podds * qodds)


input = __import__('sys').stdin.readline
for _ in range(int(input())):
	f = [0, 0]
	ans = 0
	input()
	for i in map(int, input().split()):
		f[i % 2] += 1
	input()
	for i in map(int, input().split()):
		ans += f[i % 2]
	print(ans)


t = int(input())
for test in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	nr = 0
	(pare1, pare2, impare1, impare2) = (0, 0, 0, 0)
	for i in p:
		if i % 2:
			impare1 += 1
		else:
			pare1 += 1
	for j in q:
		if j % 2:
			impare2 += 1
		else:
			pare2 += 1
	print(pare1 * pare2 + impare1 * impare2)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	p = list(map(int, input().split()))
	a = 0
	b = 0
	c = 0
	d = 0
	for i in l:
		if abs(i) % 2 == 0:
			b += 1
		else:
			a += 1
	for i in p:
		if abs(i) % 2 == 0:
			d += 1
		else:
			c += 1
	ans = a * c + b * d
	print(ans)


for i in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	odd1 = 0
	odd2 = 0
	even1 = 0
	even2 = 0
	for i in l1:
		if i % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in l2:
		if i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	print(odd1 * odd2 + even1 * even2)


n = int(input())
for i in range(n):
	p = int(input())
	l = list(map(int, input().split()))
	q = int(input())
	y = list(map(int, input().split()))
	(r, m, k, j) = (0, 0, 0, 0)
	for i in l:
		if i % 2 == 0:
			m += 1
		else:
			r += 1
	for a in y:
		if a % 2 == 0:
			k += 1
		else:
			j += 1
	print(m * k + j * r)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	evep = 0
	eveq = 0
	for x in p:
		if x % 2 == 0:
			evep += 1
	for y in q:
		if y % 2 == 0:
			eveq += 1
	print(evep * eveq + (n - evep) * (m - eveq))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = [int(x) for x in input().split()]
	e1 = o1 = 0
	for i in range(n):
		if a[i] & 1:
			o1 += 1
		else:
			e1 += 1
	e2 = o2 = 0
	for i in range(m):
		if b[i] & 1:
			o2 += 1
		else:
			e2 += 1
	print(e2 * e1 + o2 * o1)


queries = int(input())
for __ in range(queries):
	n = int(input())
	arrayA = [int(i) for i in input().split()]
	m = int(input())
	arrayB = [int(j) for j in input().split()]
	pares = 0
	impares = 0
	for e in arrayA:
		if e % 2 == 0:
			pares += 1
		else:
			impares += 1
	total = 0
	for e in arrayB:
		if e % 2 == 0:
			total += pares
		else:
			total += impares
	print(total)


import sys
t = int(sys.stdin.readline())
ans_arr = []
for w in range(t):
	n = int(sys.stdin.readline())
	p = [int(i) for i in sys.stdin.readline().split()]
	m = int(sys.stdin.readline())
	q = [int(i) for i in sys.stdin.readline().split()]
	peven = 0
	podd = 0
	for e in range(n):
		if p[e] % 2 == 0:
			peven += 1
		else:
			podd += 1
	qeven = 0
	qodd = 0
	for f in range(m):
		if q[f] % 2 == 0:
			qeven += 1
		else:
			qodd += 1
	ans_arr.append(str(podd * qodd + peven * qeven))
print('\n'.join(ans_arr))


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = int(input())
	b = list(map(int, input().split()))
	f = [0, 0]
	for el in a:
		f[el % 2] += 1
	e = [0, 0]
	for el in b:
		e[el % 2] += 1
	ans.append(e[1] * f[1] + e[0] * f[0])
for el in ans:
	print(el)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def bs(a, l, h, x):
	while l < h:
		mid = (l + h) // 2
		if a[mid] == x:
			return mid
		if a[mid] < x:
			l = mid + 1
		else:
			h = mid
	return l

def sieve(a):
	for i in range(3, 10 ** 6 + 1, 2):
		a[i] = 1
	for i in range(3, 10 ** 6 + 1, 2):
		for j in range(i * i, 10 ** 6 + 1, i):
			a[j] = 0
	a[2] = 1
	return a

def bfs(g, st):
	visited = [0] * len(g)
	visited[st] = 1
	queue = []
	queue.append(st)
	new = []
	while len(queue) != 0:
		s = queue.pop()
		new.append(s)
		for i in g[s]:
			if visited[i] == 0:
				visited[i] = 1
				queue.append(i)
	return new

def solve():
	n = int(inp())
	a = lis()
	m = int(inp())
	b = lis()
	for i in range(0, n):
		if a[i] % 2 == 0:
			a[i] = 0
		else:
			a[i] = 1
	for i in range(0, m):
		if b[i] % 2 == 0:
			b[i] = 0
		else:
			b[i] = 1
	odd = b.count(1)
	even = b.count(0)
	ans = 0
	for i in range(0, n):
		if a[i] == 0:
			ans += even
		else:
			ans += odd
	print(ans)
testcase(int(inp()))


from collections import Counter
I = lambda : int(input())
IL = lambda : list(map(int, input().split()))
for i in range(I()):
	n = I()
	P = IL()
	m = I()
	Q = IL()
	P = Counter((p % 2 for p in P))
	Q = Counter((q % 2 for q in Q))
	print(P.get(0, 0) * Q.get(0, 0) + P.get(1, 0) * Q.get(1, 0))


t = int(input())
for _ in range(t):
	n = int(input())
	cnt1 = 0
	for x in map(int, input().split()):
		if x % 2:
			cnt1 += 1
	m = int(input())
	cnt2 = 0
	for x in map(int, input().split()):
		if x % 2:
			cnt2 += 1
	print(cnt1 * cnt2 + (n - cnt1) * (m - cnt2))


for _ in range(int(input())):
	n = int(input())
	pli = list(map(int, input().split()))
	m = int(input())
	qli = list(map(int, input().split()))
	oddp = 0
	for i in pli:
		if i % 2 == 1:
			oddp += 1
	evenp = n - oddp
	oddq = 0
	for i in qli:
		if i % 2 == 1:
			oddq += 1
	evenq = m - oddq
	print(oddp * oddq + evenp * evenq)


t = int(input())
for i in range(0, t):
	n = int(input())
	p_li = [int(x) for x in input().split(' ')]
	pli_count = [0, 0]
	m = int(input())
	q_li = [int(x) for x in input().split(' ')]
	qli_count = [0, 0]
	count = 0
	for ii in p_li:
		if ii % 2 == 0:
			pli_count[0] += 1
		else:
			pli_count[1] += 1
	for j in q_li:
		if j % 2 == 0:
			qli_count[0] += 1
		else:
			qli_count[1] += 1
	print(pli_count[0] * qli_count[0] + pli_count[1] * qli_count[1])


A = []
T = int(input())

def oddevenCount(X):
	oddCount = 0
	evenCount = 0
	for x in X:
		if x % 2 == 1:
			oddCount += 1
		else:
			evenCount += 1
	return [oddCount, evenCount]
for i in range(T):
	n = int(input())
	P = [int(x) for x in input().split()]
	m = int(input())
	Q = [int(x) for x in input().split()]
	A.append(oddevenCount(P)[0] * oddevenCount(Q)[0] + oddevenCount(P)[1] * oddevenCount(Q)[1])
for a in A:
	print(a)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	(q, q2, r, r2) = (0, 0, 0, 0)
	for i in a:
		if i % 2 == 0:
			q = q + 1
		else:
			q2 = q2 + 1
	for i in b:
		if i % 2 == 0:
			r = r + 1
		else:
			r2 = r2 + 1
	ans = q * r + r2 * q2
	print(ans)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	ans = 0
	n_even = 0
	n_odd = 0
	m_even = 0
	m_odd = 0
	for i in range(n):
		if p[i] % 2 == 0:
			n_even += 1
		else:
			n_odd += 1
	for j in range(m):
		if q[j] % 2 == 0:
			m_even += 1
		else:
			m_odd += 1
	print(n_even * m_even + n_odd * m_odd)


def main():
	t = int(input())
	while t:
		t -= 1
		p_odd = q_odd = p_even = q_even = 0
		n = int(input())
		for i in input().split():
			if int(i) % 2 == 1:
				p_odd += 1
			else:
				p_even += 1
		m = int(input())
		for i in input().split():
			if int(i) % 2 == 1:
				q_odd += 1
			else:
				q_even += 1
		print(q_odd * p_odd + p_even * q_even)
main()


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	for j in range(n):
		c1 += p[j] % 2
	for j in range(m):
		c2 += q[j] % 2
	n1 = n - c1
	n2 = m - c2
	print(c1 * c2 + n1 * n2)


t = int(input())
for c in range(t):
	n = int(input())
	l1 = [int(x) for x in input().split()]
	n1 = input()
	l2 = [int(x) for x in input().split()]
	impar_l1 = 0
	par_l1 = 0
	impar_l2 = 0
	par_l2 = 0
	for x in l1:
		if x % 2:
			impar_l1 += 1
		else:
			par_l1 += 1
	for x in l2:
		if x % 2:
			impar_l2 += 1
		else:
			par_l2 += 1
	print(par_l1 * par_l2 + impar_l1 * impar_l2)


t = int(input())
for i in range(t):
	n = int(input())
	e1 = 0
	e2 = 0
	o1 = 0
	o2 = 0
	arr = list(map(int, input().split()))
	for j in arr:
		if j % 2 != 0:
			o1 += 1
		else:
			e1 += 1
	m = int(input())
	ar = list(map(int, input().split()))
	for j in ar:
		if j % 2 != 0:
			o2 += 1
		else:
			e2 += 1
	s = e1 * e2 + o1 * o2
	print(s)


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	N = int(input())
	P1 = list(map(int, input().split()))
	M = int(input())
	P2 = list(map(int, input().split()))
	Query.append((N, M, P1, P2))
for (N, M, P1, P2) in Query:
	a = [0, 0]
	b = [0, 0]
	for p in P1:
		a[p % 2] += 1
	for q in P2:
		b[q % 2] += 1
	print(a[0] * b[0] + a[1] * b[1])


for q in range(int(input())):
	d = [0, 0]
	n = int(input())
	for k in input().split():
		d[int(k) & 1] += 1
	e = [0, 0]
	m = int(input())
	for k in input().split():
		e[int(k) & 1] += 1
	print(d[0] * e[0] + d[1] * e[1])


for _ in range(int(input())):
	(_, b) = (int(input()), list(map(int, input().split())))
	(_, c) = (int(input()), list(map(int, input().split())))
	odd_b = [x for x in b if x % 2 == 0]
	even_b = [x for x in b if x % 2 != 0]
	odd_c = [x for x in c if x % 2 == 0]
	even_c = [x for x in c if x % 2 != 0]
	print(len(odd_b) * len(odd_c) + len(even_b) * len(even_c))


t = int(input())
for _ in range(t):
	n1 = int(input())
	l1 = list(map(int, input().split()))
	n2 = int(input())
	l2 = list(map(int, input().split()))
	cnt1 = 0
	cnt2 = 0
	cnt3 = 0
	cnt4 = 0
	for i in l1:
		if i % 2 == 0:
			cnt1 += 1
		else:
			cnt2 += 1
	for i in l2:
		if i % 2 == 0:
			cnt3 += 1
		else:
			cnt4 += 1
	print(cnt1 * cnt3 + cnt2 * cnt4)


for _ in range(int(input())):
	n = int(input())
	p = [int(__) for __ in input().split()]
	m = int(input())
	q = [int(___) for ___ in input().split()]
	(a, b) = (0, 0)
	for i in p:
		if i % 2 == 0:
			a += 1
	for i in q:
		if i % 2 == 0:
			b += 1
	print(a * b + (n - a) * (m - b))


import sys
from collections import deque
t = int(next(sys.stdin))
for _ in range(t):
	n = int(next(sys.stdin))
	pi = list(map(int, next(sys.stdin).split(' ')))
	m = int(next(sys.stdin))
	qi = list(map(int, next(sys.stdin).split(' ')))
	chet_p = 0
	nechet_p = 0
	chet_q = 0
	nechet_q = 0
	for p in pi:
		if p % 2 == 0:
			chet_p += 1
		else:
			nechet_p += 1
	for q in qi:
		if q % 2 == 0:
			chet_q += 1
		else:
			nechet_q += 1
	print(chet_q * chet_p + nechet_p * nechet_q)


for _ in range(int(input())):
	n1 = int(input())
	a = [int(i) for i in input().split()]
	n2 = int(input())
	b = [int(i) for i in input().split()]
	aodd = 0
	aeven = 0
	bodd = 0
	beven = 0
	for i in a:
		if i % 2 == 0:
			aeven += 1
		else:
			aodd += 1
	for i in b:
		if i % 2 == 0:
			beven += 1
		else:
			bodd += 1
	ans = aeven * beven + aodd * bodd
	print(ans)


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 7)

def iin():
	return int(stdin.readline())

def lin():
	return list(map(int, stdin.readline().split()))

def main():
	t = iin()
	while t:
		t -= 1
		n = iin()
		p = lin()
		m = iin()
		q = lin()
		(o, e) = (0, 0)
		ans = 0
		for i in p:
			if i % 2:
				o += 1
			else:
				e += 1
		for i in q:
			if i % 2:
				ans += o
			else:
				ans += e
		print(ans)
main()


n = int(input())
for i in range(n):
	(cl, cr, dl, dr) = (0, 0, 0, 0)
	q = int(input())
	a = list(map(int, input().split()))
	w = int(input())
	b = list(map(int, input().split()))
	for j in range(q):
		if a[j] % 2 != 0:
			cl += 1
		else:
			cr += 1
	for j in range(w):
		if b[j] % 2 != 0:
			dl += 1
		else:
			dr += 1
	print(cl * dl + cr * dr)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	m = int(input())
	l2 = list(map(int, input().split()))
	(e1, e2, o1, o2) = (0, 0, 0, 0)
	ans = 0
	for i in range(n):
		if l1[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in range(m):
		if l2[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	ans += e1 * e2 + o1 * o2
	print(ans)


t = eval(input())
while t:
	t -= 1
	n = eval(input())
	ai = list(map(int, input().split()))
	m = eval(input())
	bi = list(map(int, input().split()))
	asum = 0
	bsum = 0
	for i in range(n):
		asum += ai[i] % 2
	for i in range(m):
		bsum += bi[i] % 2
	print(asum * bsum + (n - asum) * (m - bsum))


def main():
	tcs = int(input())
	for tc in range(tcs):
		n = int(input())
		lst = list(map(int, input().split()))
		odd = len([x for x in lst if x % 2 == 1])
		even = len(lst) - odd
		n = int(input())
		lst = list(map(int, input().split()))
		odd1 = len([x for x in lst if x % 2 == 1])
		even1 = len(lst) - odd1
		print(odd * odd1 + even * even1)
main()


t = int(input())
s = []
for knvjf in range(0, t):
	n = int(input())
	x = input()
	p = x.split()
	m = int(input())
	x = input()
	q = x.split()
	p0 = 0
	q0 = 0
	fp = 0
	fq = 0
	zp = 0
	zq = 0
	for i in p:
		if int(i) % 2 == 1:
			fp += 1
		elif i == '0':
			p0 += 1
		else:
			zp += 1
	for i in q:
		if int(i) % 2 == 1:
			fq += 1
		elif i == '0':
			q0 += 1
		else:
			zq += 1
	g = zp * zq + fp * fq + p0 * zq + q0 * zp + q0 * p0
	s.append(g)
for i in s:
	print(i)


def patate(t, test):
	for k in range(t):
		(n, p, m, d) = test[k]
		pair1 = 0
		impair1 = 0
		pair2 = 0
		impair2 = 0
		for i in p:
			if i % 2 == 0:
				pair1 += 1
			else:
				impair1 += 1
		for j in d:
			if j % 2 == 0:
				pair2 += 1
			else:
				impair2 += 1
		print(pair1 * pair2 + impair2 * impair1)
t = int(input())
test = []
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	d = list(map(int, input().split()))
	test.append([n, p, m, d])
patate(t, test)


for _ in range(int(input())):
	nc = [0, 0]
	mc = [0, 0]
	n = int(input())
	for i in map(int, input().split()):
		nc[i % 2] += 1
	m = int(input())
	for i in map(int, input().split()):
		mc[i % 2] += 1
	print(nc[0] * mc[0] + nc[1] * mc[1])


n = int(input())
for _ in range(n):
	k = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	p_odd = 0
	p_even = 0
	for i in p:
		if i % 2 == 0:
			p_even += 1
		else:
			p_odd += 1
	q_odd = 0
	q_even = 0
	for i in q:
		if i % 2 == 0:
			q_even += 1
		else:
			q_odd += 1
	print(p_even * q_even + p_odd * q_odd)


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in range(T):
		N = int(input())
		P = list(map(int, input().split()))
		M = int(input())
		Q = list(map(int, input().split()))
		(p_even, p_odd) = (0, 0)
		(q_even, q_odd) = (0, 0)
		for i in P:
			if i % 2:
				p_odd += 1
			else:
				p_even += 1
		for i in Q:
			if i % 2:
				q_odd += 1
			else:
				q_even += 1
		ans = p_odd * q_odd + p_even * q_even
		print(ans)
main()


t = int(input())
while t > 0:
	t -= 1
	np = int(input())
	p = list(map(int, input().split()))
	nq = int(input())
	q = list(map(int, input().split()))
	ans = 0
	(e1, o1, e2, o2) = (0, 0, 0, 0)
	for i in p:
		if i % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for i in q:
		if i % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(e1 * e2 + o1 * o2)


num = int(input())
for i in range(0, num):
	xn = int(input())
	x = [int(u) for u in input().split()]
	yn = int(input())
	y = [int(u) for u in input().split()]
	xx = [0, 0]
	yy = [0, 0]
	for u in range(0, xn):
		if x[u] % 2 == 0:
			xx[0] += 1
		else:
			xx[1] += 1
	for u in range(0, yn):
		if y[u] % 2 == 0:
			yy[0] += 1
		else:
			yy[1] += 1
	print(xx[1] * yy[1] + xx[0] * yy[0])


t = int(input())
for _ in [0] * t:
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	nump = [0, 0]
	numq = [0, 0]
	for e in p:
		nump[e % 2] += 1
	for e in q:
		numq[e % 2] += 1
	print(nump[0] * numq[0] + nump[1] * numq[1])


t = int(input())
for i in range(t):
	n = int(input())
	po = sum((int(e) % 2 for e in input().split()))
	m = int(input())
	qo = sum((int(e) % 2 for e in input().split()))
	print(po * qo + (n - po) * (m - qo))


n = int(input())
for i in range(n):
	n1 = int(input())
	ri = input().split(' ')
	n2 = int(input())
	pi = input().split(' ')
	contador_par_1 = 0
	contador_par_2 = 0
	for i in range(n1):
		if int(ri[i]) % 2 == 0:
			contador_par_1 = contador_par_1 + 1
	for j in range(n2):
		if int(pi[j]) % 2 == 0:
			contador_par_2 = contador_par_2 + 1
	print(contador_par_2 * contador_par_1 + (n1 - contador_par_1) * (n2 - contador_par_2))


count_inputs = int(input())
ii = 1
while ii <= count_inputs:
	i = 0
	j = 0
	result = 0
	DLS = int(input())
	p_i = [int(x) for x in input().split()]
	JLS = int(input())
	q_j = [int(x) for x in input().split()]
	sum_p = sum([i % 2 for i in p_i])
	sum_q = sum([i % 2 for i in q_j])
	result = sum_p * sum_q + (DLS - sum_p) * (JLS - sum_q)
	ii += 1
	print(result)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	pe = len([i for i in p if i % 2 == 0])
	po = len([i for i in p if i % 2 != 0])
	qe = len([i for i in q if i % 2 == 0])
	qo = len([i for i in q if i % 2 != 0])
	print(pe * qe + po * qo)


import sys, math
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	q = 0
	w = 0
	qq = 0
	ww = 0
	for j in range(len(a)):
		if a[j] % 2 == 0:
			q = q + 1
		else:
			w = w + 1
	for j in range(len(b)):
		if b[j] % 2 == 0:
			qq = qq + 1
		else:
			ww = ww + 1
	print(q * qq + w * ww)


for i in range(int(input())):
	n = int(input())
	lines_n = map(int, input().split())
	m = int(input())
	lines_m = map(int, input().split())
	c1 = 0
	c2 = 0
	n1 = 0
	n2 = 0
	for p in lines_n:
		if p % 2 == 0:
			c1 += 1
	for p in lines_m:
		if p % 2 == 0:
			c2 += 1
	d = c1 * c2 + (n - c1) * (m - c2)
	print(d)


for _ in range(int(input())):
	n = int(input())
	ps = [int(x) for x in input().split()]
	m = int(input())
	qs = [int(x) for x in input().split()]
	ans = 0
	q_odd = 0
	p_odd = 0
	q_even = 0
	p_even = 0
	for q in qs:
		if q % 2 == 0:
			q_even += 1
		else:
			q_odd += 1
	for p in ps:
		if p % 2 == 0:
			p_even += 1
		else:
			p_odd += 1
	ans = q_odd * p_odd + p_even * q_even
	print(ans)


t = int(input())
answers = list()
l = 0
while l < t:
	n = int(input())
	lines_dls = input()
	lines_dls = lines_dls.split()
	odd_dls = 0
	even_dls = 0
	i = 0
	while i < n:
		lines_dls[i] = int(lines_dls[i])
		if lines_dls[i] % 2 == 0:
			even_dls = even_dls + 1
		else:
			odd_dls = odd_dls + 1
		i = i + 1
	m = int(input())
	lines_nls = input()
	lines_nls = lines_nls.split()
	odd_nls = 0
	even_nls = 0
	i = 0
	while i < m:
		lines_nls[i] = int(lines_nls[i])
		if lines_nls[i] % 2 == 0:
			even_nls = even_nls + 1
		else:
			odd_nls = odd_nls + 1
		i = i + 1
	count = even_dls * even_nls + odd_dls * odd_nls
	answers.append(count)
	l = l + 1
l = 0
while l < t:
	print(answers[l])
	l = l + 1


numOfTestCase = int(input().strip())
for i in range(numOfTestCase):
	n = int(input().strip())
	lineData = input().strip()
	p = [int(j) for j in lineData.split(' ')]
	m = input().strip()
	lineData = input().strip()
	q = [int(j) for j in lineData.split(' ')]
	pcount1 = 0
	pcount2 = 0
	qcount1 = 0
	qcount2 = 0
	for j in p:
		if j % 2 == 0:
			pcount2 += 1
		else:
			pcount1 += 1
	for j in q:
		if j % 2 == 0:
			qcount2 += 1
		else:
			qcount1 += 1
	print(pcount1 * qcount1 + pcount2 * qcount2)


n = int(input())
for i in range(n):
	a = int(input())
	op = []
	ep = []
	p = list(map(int, input().split()))
	b = int(input())
	q = list(map(int, input().split()))
	oq = []
	eq = []
	for t in p:
		if t % 2 == 0:
			ep.append(t)
		else:
			op.append(t)
	for s in q:
		if s % 2 == 0:
			eq.append(t)
		else:
			oq.append(t)
	print(len(op) * len(oq) + len(eq) * len(ep))


def get_num_even_odd(l):
	odd = 0
	even = 0
	for val in l:
		if val % 2 == 0:
			even += 1
		else:
			odd += 1
	return (odd, even)
t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	q = [int(x) for x in input().split()]
	(odd_p, even_p) = get_num_even_odd(p)
	(odd_q, even_q) = get_num_even_odd(q)
	ans.append(odd_p * odd_q + even_p * even_q)
for answer in ans:
	print(answer)


import sys, math, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for _ in range(t):
	n = I()
	l = L()
	m = I()
	q = L()
	c = 0
	le = 0
	lo = 0
	qe = 0
	qo = 0
	for i in range(n):
		if l[i] % 2 == 0:
			le += 1
		else:
			lo += 1
	for j in range(m):
		if q[j] % 2 == 0:
			qe += 1
		else:
			qo += 1
	print(le * qe + lo * qo)


import math as mt
import collections as cc
import sys
I = lambda : set(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	x = I()
	(m,) = I()
	y = I()
	(o1, o2, e1, e2) = [0, 0, 0, 0]
	for i in x:
		if i % 2:
			o1 += 1
		else:
			e1 += 1
	for j in y:
		if j % 2:
			o2 += 1
		else:
			e2 += 1
	print(e1 * e2 + o1 * o2)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	count = 0
	(ep, op, eq, oq) = ([], [], [], [])
	for x in p:
		if x & 1:
			op.append(x)
		else:
			ep.append(x)
	for x in q:
		if x & 1:
			oq.append(x)
		else:
			eq.append(x)
	count += len(eq) * len(ep) + len(op) * len(oq)
	print(count)


import sys

def ints():
	return list(map(int, sys.stdin.readline().strip().split()))
tc = int(input())
while tc:
	tc -= 1
	n = int(input())
	x = ints()
	m = int(input())
	y = ints()
	(e1, e2) = (0, 0)
	for item in x:
		if item % 2 == 0:
			e1 += 1
	for item in y:
		if item % 2 == 0:
			e2 += 1
	print(e1 * e2 + (len(x) - e1) * (len(y) - e2))


from sys import stdin, stdout

def scal(typ=int):
	return typ(stdin.readline())

def vec(typ=int):
	if isinstance(typ, list):
		inp = stdin.readline().split()
		return [typ[i](inp[i]) for i in range(len(inp))]
	else:
		return list(map(typ, stdin.readline().split()))
t = scal()
for _ in range(t):
	(n, P) = (scal(), vec())
	(m, Q) = (scal(), vec())
	odd = sum([p & 1 for p in P])
	even = sum([1 - (p & 1) for p in P])
	res = sum([(q & 1) * odd + (1 - (q & 1)) * even for q in Q])
	print(res)


t = int(input())
for j in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	m = int(input())
	q = list(map(int, input().split()))
	pc = 0
	pd = 0
	qc = 0
	qd = 0
	for i in range(n):
		if p[i] % 2 == 0:
			pc += 1
		else:
			pd += 1
	for i in range(m):
		if q[i] % 2 == 0:
			qc += 1
		else:
			qd += 1
	print(qc * pc + pd * qd)


def kek(arrOne, arrTwo):
	countEvenFirstPlayer = 0
	countOddFirstPlayer = 0
	countEvenSecondPlayer = 0
	countOddSecondPlayer = 0
	for i in range(len(arrOne)):
		if arrOne[i] % 2 == 0:
			countEvenFirstPlayer += 1
		else:
			countOddFirstPlayer += 1
	for i in range(len(arrTwo)):
		if arrTwo[i] % 2 == 0:
			countEvenSecondPlayer += 1
		else:
			countOddSecondPlayer += 1
	return countOddFirstPlayer * countOddSecondPlayer + countEvenFirstPlayer * countEvenSecondPlayer
t = int(input())
for i in range(t):
	playerOne = int(input())
	arrOne = list(map(int, input().split()))
	playerTwo = int(input())
	arrTwo = list(map(int, input().split()))
	print(kek(arrOne, arrTwo))


def count(l):
	even = len([x for x in l if x % 2 == 0])
	return (len(l) - even, even)
t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	m = int(input())
	a = [int(x) for x in input().split()]
	(odd1, even1) = count(p)
	(odd2, even2) = count(a)
	print(even1 * even2 + odd1 * odd2)


T = int(input())
while T > 0:
	T -= 1
	n = int(input())
	p = list(map(int, input().split()))
	cnt1 = [0, 0]
	cnt2 = [0, 0]
	for i in p:
		cnt1[i % 2] += 1
	m = int(input())
	q = list(map(int, input().split()))
	for i in q:
		cnt2[i % 2] += 1
	print(cnt1[0] * cnt2[0] + cnt1[1] * cnt2[1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	k = list(map(int, input().split()))
	ans = 0
	eve1 = 0
	odd1 = 0
	eve2 = 0
	odd2 = 0
	for i in l:
		if i % 2:
			odd1 += 1
		else:
			eve1 += 1
	for j in k:
		if j % 2:
			odd2 += 1
		else:
			eve2 += 1
	ans = odd1 * odd2 + eve1 * eve2
	print(ans)


test = int(input())
while test:
	test = test - 1
	n = int(input())
	p = input().split(' ')
	m = int(input())
	q = input().split(' ')
	oddP = oddQ = 0
	for i in p:
		if int(i) % 2 == 1:
			oddP += 1
	for i in q:
		if int(i) % 2 == 1:
			oddQ += 1
	ans = oddP * oddQ + (n - oddP) * (m - oddQ)
	print(ans)


for _ in range(int(input())):
	N = int(input())
	f = [int(x) for x in input().split()]
	f1 = [x for x in f if x % 2 == 0]
	f2 = [x for x in f if x % 2 == 1]
	M = int(input())
	g = [int(x) for x in input().split()]
	g1 = [x for x in g if x % 2 == 0]
	g2 = [x for x in g if x % 2 == 1]
	print(len(f1) * len(g1) + len(f2) * len(g2))


from math import *
for zz in range(int(input())):
	n = int(input())
	p = [int(i) for i in input().split()]
	m = int(input())
	q = [int(i) for i in input().split()]
	e1 = []
	o1 = []
	e2 = []
	o2 = []
	for i in range(n):
		if p[i] % 2 == 0:
			e1.append(p[i])
		else:
			o1.append(p[i])
	for i in range(m):
		if q[i] % 2 == 0:
			e2.append(q[i])
		else:
			o2.append(q[i])
	print(len(e1) * len(e2) + len(o1) * len(o2))


n = int(input())
for i in range(0, n):
	m = int(input())
	l1 = list(map(int, input().split()))
	p = int(input())
	l2 = list(map(int, input().split()))
	t1 = 0
	t2 = 0
	t3 = 0
	t4 = 0
	for i in l1:
		if i % 2 == 0:
			t1 += 1
		else:
			t2 += 1
	for j in l2:
		if j % 2 == 0:
			t3 += 1
		else:
			t4 += 1
	print(t1 * t3 + t2 * t4)


t = int(input())
for nt in range(t):
	n = int(input())
	ln = list(map(int, input().split()))
	m = int(input())
	lm = list(map(int, input().split()))
	(lne, lno, lme, lmo) = (0, 0, 0, 0)
	for i in ln:
		if i % 2 == 0:
			lne += 1
		else:
			lno += 1
	for i in lm:
		if i % 2 == 0:
			lme += 1
		else:
			lmo += 1
	print(lne * lme + lno * lmo)


x = int(input())
z = 0
n = 0
for i in range(x):
	z = 0
	n = 0
	input()
	a = list(map(int, input().split()))
	input()
	b = list(map(int, input().split()))
	for j in a:
		if j % 2:
			z += 1
	v = len(a) - z
	for j in b:
		if j % 2:
			n += 1
	m = len(b) - n
	print(n * z + m * v)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	for i in a:
		if i & 1:
			cnt += 1
	q = int(input())
	b = list(map(int, input().split()))
	cnt1 = 0
	for i in b:
		if i & 1:
			cnt1 += 1
	print(cnt * cnt1 + (n - cnt) * (q - cnt1))


t = int(input())
for _ in range(t):
	a = int(input())
	p = list(map(int, input().split()))
	b = int(input())
	q = list(map(int, input().split()))
	d1 = {0: 0, 1: 0}
	d2 = {0: 0, 1: 0}
	for i in p:
		d1[i % 2] += 1
	for i in q:
		d2[i % 2] += 1
	print(d1[0] * d2[0] + d1[1] * d2[1])


q = int(input())
for op in range(q):
	n = int(input())
	k = list(map(int, input().split()))
	m = int(input())
	l = list(map(int, input().split()))
	a = list(filter(lambda x: x % 2 == 0, k))
	b = list(filter(lambda x: x % 2 == 0, l))
	ans = len(a) * len(b)
	a = list(filter(lambda x: x % 2 != 0, k))
	b = list(filter(lambda x: x % 2 != 0, l))
	ans += len(a) * len(b)
	print(ans)


for each_test in range(int(input())):
	n = int(input())
	pi = list(map(int, input().split()))
	m = int(input())
	qi = list(map(int, input().split()))
	pio = pie = qio = qie = 0
	for each in pi:
		if each % 2 == 0:
			pie += 1
		else:
			pio += 1
	for each in qi:
		if each % 2 == 0:
			qie += 1
		else:
			qio += 1
	print(qio * pio + qie * pie)


try:
	t = int(input())
	for i in range(t):
		m = int(input())
		l1 = list(map(int, input().split()))
		n = int(input())
		l2 = list(map(int, input().split()))
		count1 = 0
		count2 = 0
		for i in l1:
			if i % 2 == 0:
				count1 = count1 + 1
		for j in l2:
			if j % 2 == 0:
				count2 = count2 + 1
		odd1 = m - count1
		odd2 = n - count2
		f = m * n - (count1 * odd2 + count2 * odd1)
		print(f)
except Exception as e:
	pass