Mishka got an integer array $$$a$$$ of length $$$n$$$ as a birthday present (what a surprise!).Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps:  Replace each occurrence of $$$1$$$ in the array $$$a$$$ with $$$2$$$;  Replace each occurrence of $$$2$$$ in the array $$$a$$$ with $$$1$$$;  Replace each occurrence of $$$3$$$ in the array $$$a$$$ with $$$4$$$;  Replace each occurrence of $$$4$$$ in the array $$$a$$$ with $$$3$$$;  Replace each occurrence of $$$5$$$ in the array $$$a$$$ with $$$6$$$;  Replace each occurrence of $$$6$$$ in the array $$$a$$$ with $$$5$$$;  $$$\dots$$$  Replace each occurrence of $$$10^9 - 1$$$ in the array $$$a$$$ with $$$10^9$$$;  Replace each occurrence of $$$10^9$$$ in the array $$$a$$$ with $$$10^9 - 1$$$. Note that the dots in the middle of this algorithm mean that Mishka applies these replacements for each pair of adjacent integers ($$$2i - 1, 2i$$$) for each $$$i \in\{1, 2, \ldots, 5 \cdot 10^8\}$$$ as described above.For example, for the array $$$a = [1, 2, 4, 5, 10]$$$, the following sequence of arrays represents the algorithm: $$$[1, 2, 4, 5, 10]$$$ $$$\rightarrow$$$ (replace all occurrences of $$$1$$$ with $$$2$$$) $$$\rightarrow$$$ $$$[2, 2, 4, 5, 10]$$$ $$$\rightarrow$$$ (replace all occurrences of $$$2$$$ with $$$1$$$) $$$\rightarrow$$$ $$$[1, 1, 4, 5, 10]$$$ $$$\rightarrow$$$ (replace all occurrences of $$$3$$$ with $$$4$$$) $$$\rightarrow$$$ $$$[1, 1, 4, 5, 10]$$$ $$$\rightarrow$$$ (replace all occurrences of $$$4$$$ with $$$3$$$) $$$\rightarrow$$$ $$$[1, 1, 3, 5, 10]$$$ $$$\rightarrow$$$ (replace all occurrences of $$$5$$$ with $$$6$$$) $$$\rightarrow$$$ $$$[1, 1, 3, 6, 10]$$$ $$$\rightarrow$$$ (replace all occurrences of $$$6$$$ with $$$5$$$) $$$\rightarrow$$$ $$$[1, 1, 3, 5, 10]$$$ $$$\rightarrow$$$ $$$\dots$$$ $$$\rightarrow$$$ $$$[1, 1, 3, 5, 10]$$$ $$$\rightarrow$$$ (replace all occurrences of $$$10$$$ with $$$9$$$) $$$\rightarrow$$$ $$$[1, 1, 3, 5, 9]$$$. The later steps of the algorithm do not change the array.Mishka is very lazy and he doesn't want to apply these changes by himself. But he is very interested in their result. Help him find it.

The first line of the input contains one integer number $$$n$$$ ($$$1 \le n \le 1000$$$) — the number of elements in Mishka's birthday present (surprisingly, an array). The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array.

Print $$$n$$$ integers — $$$b_1, b_2, \dots, b_n$$$, where $$$b_i$$$ is the final value of the $$$i$$$-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array $$$a$$$. Note that you cannot change the order of elements in the array.

NoteThe first example is described in the problem statement.

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, a int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a)
		fmt.Printf("%d ", a-(a+1)%2)
	}
	fmt.Println()
}

// A. Adjacent Replacements
/*
Mishka got an integer array 𝑎 of length 𝑛 as a birthday present (what a surprise!).

Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps:

    Replace each occurrence of 1 in the array 𝑎 with 2;
	  Replace each occurrence of 2 in the array 𝑎 with 1;
	  Replace each occurrence of 3 in the array 𝑎 with 4;
	  Replace each occurrence of 4 in the array 𝑎 with 3;
	 	Replace each occurrence of 5 in the array 𝑎 with 6;
	 	Replace each occurrence of 6 in the array 𝑎 with 5;
	 	…
	 	Replace each occurrence of 109−1 in the array 𝑎 with 109;
	 	Replace each occurrence of 109 in the array 𝑎 with 109−1.

Note that the dots in the middle of this algorithm mean that Mishka applies these replacements for each pair of adjacent integers (2𝑖−1,2𝑖) for each 𝑖∈{1,2,…,5⋅108} as described above.

For example, for the array 𝑎=[1,2,4,5,10], the following sequence of arrays represents the algorithm:

[1,2,4,5,10] → (replace all occurrences of 1 with 2) → [2,2,4,5,10] → (replace all occurrences of 2 with 1) → [1,1,4,5,10] → (replace all occurrences of 3 with 4) → [1,1,4,5,10] → (replace all occurrences of 4 with 3) → [1,1,3,5,10] → (replace all occurrences of 5 with 6) → [1,1,3,6,10] → (replace all occurrences of 6 with 5) → [1,1,3,5,10] → … → [1,1,3,5,10] → (replace all occurrences of 10 with 9) → [1,1,3,5,9]. The later steps of the algorithm do not change the array.

Mishka is very lazy and he doesn't want to apply these changes by himself. But he is very interested in their result. Help him find it.

Input
The first line of the input contains one integer number 𝑛
(1≤𝑛≤1000) — the number of elements in Mishka's birthday present (surprisingly, an array).

The second line of the input contains 𝑛
integers 𝑎1,𝑎2,…,𝑎𝑛 (1≤𝑎𝑖≤109) — the elements of the array.

Output
Print 𝑛 integers — 𝑏1,𝑏2,…,𝑏𝑛, where 𝑏𝑖 is the final value of the 𝑖-th element of the array after applying "Mishka's Adjacent Replacements Algorithm" to the array 𝑎. Note that you cannot change the order of elements in the array.

Examples
Input
5
1 2 4 5 10

Output
1 1 3 5 9

Input
10
10000 10 50605065 1 5 89 5 999999999 60506056 1000000000

Output
9999 9 50605065 1 5 89 5 999999999 60506055 999999999

Note
The first example is described in the problem statement.
*/
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	n, _ := strconv.Atoi(strings.TrimSpace(input1))

	input2, _ := reader.ReadString('\n')
	a := strings.Split(strings.TrimSpace(input2), " ")

	for i := 0; i < n; i++ {
		v, _ := strconv.Atoi(string(a[i]))
		if v%2 == 0 {
			v--
			a[i] = strconv.Itoa(v)
		}
	}
	fmt.Println(strings.Join(a, " "))
}

package main

import "fmt"

func f(a int) int {
	if a%2 == 0 {
		a--
	}
	return a
}

func main() {
	var n int
	fmt.Scan(&n)

	for i := range make([]struct{}, n) {
		if i != 0 {
			fmt.Print(" ")
		}
		var a int
		fmt.Scan(&a)
		fmt.Print(f(a))
	}
	fmt.Println()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func f(a int) int {
	if a%2 == 0 {
		a--
	}
	return a
}

func main() {
	io := newIo()
	defer io.flush()

	n := io.nextInt()
	for i := range make([]struct{}, n) {
		if i != 0 {
			io.printf(" ")
		}
		a := io.nextInt()
		io.printf("%d", f(a))
	}
	io.printf("\n")
}

type _io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *_io {
	return &_io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (_io *_io) flush() {
	_ = _io.writer.Flush()
}

func (_io *_io) nextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := _io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (_io *_io) next() string {
	for _io.nextToken >= len(_io.tokens) {
		line := _io.nextLine()
		_io.tokens = strings.Fields(line)
		_io.nextToken = 0
	}
	r := _io.tokens[_io.nextToken]
	_io.nextToken++
	return r
}

func (_io *_io) nextInt() int {
	i, _ := strconv.Atoi(_io.next())
	return i
}

func (_io *_io) printf(format string, a ...interface{}) {
	fmt.Fprintf(_io.writer, format, a...)
}

package main

import (
    "fmt"
    "bufio"
    "os"
    "strings"
    "strconv"
)

func getInts(s *bufio.Scanner, n int) []int {
    s.Scan()
    ab := strings.Fields(s.Text())
    a := make([]int,n)
    for i:=0; i<n; i++ {
        a[i], _ = strconv.Atoi(ab[i])
    }
    return a
}

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    n := getInts(scanner,1)
    bs := getInts(scanner, n[0])
    for i := 0; i < n[0]; i++ {
        if bs[i] % 2 == 0 {
            fmt.Print(bs[i] - 1)
        } else {
            fmt.Print(bs[i])
        }
        fmt.Print(" ")
    }
}

package main

import "fmt"

const (
    N = 1e3 + 5
)

func main() {
	var n int
	var a [N]int
	var i int

	fmt.Scanf("%d\n", &n)
	for i = 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	for i = 0; i < n; i++ {
		if a[i] % 2 == 0 {
			a[i]--
		}
	}
	for i = 0; i < n; i++ {
		fmt.Print(a[i], " ")
	}
	fmt.Println()
 }

package main

import "fmt"

func main(){
	var n,num int
	fmt.Scanf("%d\n",&n)
	for i:=1; i<=n; i++{
		fmt.Scanf("%d",&num)
		if num % 2 == 0{
			fmt.Print(num - 1)
			fmt.Print(" ")
		}else{
			fmt.Print(num)
			fmt.Print(" ")
		}
	}
}

package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
)

//Item eh um elemento da fila de prioridades
type Item struct {
	value    int
	priority int
	index    int
}

//PriorityQueue implmenta a heap interface
type PriorityQueue []*Item

//Len retorna o tamanho da  pq
func (pq PriorityQueue) Len() int { return len(pq) }

//Less verifica se um tem maior priotidade que o outro
func (pq PriorityQueue) Less(i, j int) bool { return pq[i].priority < pq[j].priority }

//Swap troca os elementos de lugar
func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

//Push insere um elemento na pq
func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

//Pop remove um elemento da pq
func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	item.index = -1 //for safety
	*pq = old[0 : n-1]
	return item
}

//update modifica o valor e a prioridade de um item na fila
func (pq *PriorityQueue) update(item *Item, value int, priority int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}

/****************************************************************************************
****************************************************************************************/

type pair struct {
	first  interface{}
	second interface{}
}

type intPair struct {
	first  int64
	second int64
}

type vertex struct {
	list []intPair
}

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

/**************************************************************/

func main() {
	defer writer.Flush()

	var (
		n   int
		num int
	)

	scanf("%d\n", &n)

	for i := 0; i < n; i++ {
		scanf("%d ", &num)
		if num%2 == 0 {
			printf("%d", num-1)
		} else {
			printf("%d", num)
		}
		if i != n {
			printf(" ")
		}
	}
	printf("\n")
}

package main

import (
	"fmt"
	)

func main() {
	var arrayLength, element int
	var arrayOfElements []int

	// checkExist := make(map[int]bool)

	fmt.Scan(&arrayLength)

	for i:=0; i<arrayLength; i++ {
		fmt.Scan(&element)

		if element % 2 == 0 {
			element --
		}
		arrayOfElements = append(arrayOfElements, element)
	}

	for i:=0; i<arrayLength; i++ {
		fmt.Printf("%d ",arrayOfElements[i])
	}
}

package main
import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	numbers := make([]int, n)
	var max int
	for i := 0; i < n; i++ {
		fmt.Scan(&numbers[i])
		if i == 0 {
			max = numbers[i]
		} else if max < numbers[i] {
			max = numbers[i]
		}
	}
	var temp int
	min := 0
	for ; min != max + max%2; {
		temp = math.MaxInt32
		for i := 0; i < n; i++ {

			if temp > numbers[i] && numbers[i] > min {
				temp = numbers[i]
			}
		}
		for j := 0; j < n; j++ {
			if numbers[j] == temp {
				if numbers[j]%2 == 0 {
					numbers[j]--
				} else {
					numbers[j]++
				}
			}
		}
		min = temp
	}

	for i := 0; i < n; i++ {
		fmt.Printf("%d ", numbers[i])
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scanf("%d", &a)
		if a&1 == 1 {
			fmt.Print(a, " ")
		} else {
			fmt.Print(a-1, " ")
		}

	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		var a uint64
		fmt.Scan(&a)
		if a%2 == 0 {
			a--
		}
		fmt.Printf("%d ", a)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var n, a int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a)
		fmt.Printf("%d ", (a+1)/2)
	}
	fmt.Println()
}

package main

import "fmt"

func main(){
	var n,num int
	fmt.Scanf("%d",&n)
	for i:=1; i<=n; i++{
		fmt.Scanf("%d",&num)
		if num % 2 == 0{
			fmt.Print(num - 1)
			fmt.Print(" ")
		}else{
			fmt.Print(num)
			fmt.Print(" ")
		}
	}
}

package main

import (
	"fmt"
	)

func main() {
	var arrayLength, element int
	var arrayOfElements []int

	// checkExist := make(map[int]bool)

	fmt.Scan(&arrayLength)

	for i:=0; i<arrayLength; i++ {
		fmt.Scan(&element)

		if element % 2 == 0 {
			element --
		}
		arrayOfElements = append(arrayOfElements, element)
	}

	fmt.Println(arrayOfElements)
}

package main
import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	numbers := make([]int, n)
	var max int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &numbers[i])
		if i == 0 {
			max = numbers[i]
		} else if max < numbers[i] {
			max = numbers[i]
		}
	}
	var temp int
	min := 0
	for ; min != max + max%2; {
		temp = math.MaxInt32
		for i := 0; i < n; i++ {

			if temp > numbers[i] && numbers[i] > min {
				temp = numbers[i]
			}
		}
		for j := 0; j < n; j++ {
			if numbers[j] == temp {
				if numbers[j]%2 == 0 {
					numbers[j]--
				} else {
					numbers[j]++
				}
			}
		}
		min = temp
	}

	for i := 0; i < n; i++ {
		fmt.Printf("%d ", numbers[i])
	}
}


Vasya goes to visit his classmate Petya. Vasya knows that Petya's apartment number is $$$n$$$. There is only one entrance in Petya's house and the distribution of apartments is the following: the first floor contains $$$2$$$ apartments, every other floor contains $$$x$$$ apartments each. Apartments are numbered starting from one, from the first floor. I.e. apartments on the first floor have numbers $$$1$$$ and $$$2$$$, apartments on the second floor have numbers from $$$3$$$ to $$$(x + 2)$$$, apartments on the third floor have numbers from $$$(x + 3)$$$ to $$$(2 \cdot x + 2)$$$, and so on.Your task is to find the number of floor on which Petya lives. Assume that the house is always high enough to fit at least $$$n$$$ apartments.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n, x \le 1000$$$) — the number of Petya's apartment and the number of apartments on each floor of the house except the first one (there are two apartments on the first floor).

For each test case, print the answer: the number of floor on which Petya lives.

NoteConsider the first test case of the example: the first floor contains apartments with numbers $$$1$$$ and $$$2$$$, the second one contains apartments with numbers $$$3$$$, $$$4$$$ and $$$5$$$, the third one contains apartments with numbers $$$6$$$, $$$7$$$ and $$$8$$$. Therefore, Petya lives on the third floor.In the second test case of the example, Petya lives in the apartment $$$1$$$ which is on the first floor.

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	var t, x, n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n, &x)
		fmt.Printf("%.0f\n", math.Ceil(float64(pos(n-2))/float64(x))+1)
	}
}

func pos(a int) int {
	if a < 0 {
		return 0
	}
	return a
}

package main

import "fmt"

func main() {
	var t, n, x int
	fmt.Scanf("%d\n", &t)
	// fmt.Println(t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d %d\n", &n, &x)
		if n < 3 {
			fmt.Println(1)
		} else {
			fmt.Println((n-3)/x + 2)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(in, a...)
}

var err error

func next() (n string) {
	scan(&n)
	return n
}

func nextInt() (n int) {
	scan(&n)
	return n
}

func nextLong() (n int64) {
	scan(&n)
	return n
}

func nextDouble() (n float64) {
	scan(&n)
	return n
}

func Max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func solve() {
	n := nextInt()
	x := nextInt()
	if n <= 2 {
		printf("1\n");
		return
	}
	printf("%d\n", (n+x-3)/x + 1);
}

func main() {
	in = bufio.NewReaderSize(os.Stdin, 8192)
	out = bufio.NewWriterSize(os.Stdout, 8192)

	defer out.Flush()

	for t := nextInt(); t > 0; t-- {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

	in := func() int {
		sc.Scan()
		i, _ := strconv.Atoi(sc.Text())
		return i
	}

	for t := in(); t > 0; t-- {
		n, x := in(), in()

		f := 1

		if n > 2 {
			if (n-2)%x == 0 {
				f += (n - 2) / x
			} else {
				f += (n-2)/x + 1
			}
		}

		fmt.Println(f)
	}

}

package main

import (
	"fmt"
	"io"
	"os"
)

func solve(input io.Reader, output io.Writer) {
	var t, x, y, result int
	fmt.Fscanf(input, "%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Fscanf(input, "%d %d\n", &x, &y)
		if x <= 2 {
			result = 1
		} else {
			result = int((x - 3) / y + 2)
		}
		fmt.Fprintln(output, result)
	}
}

func main() {
	solve(os.Stdin, os.Stdout)
}

package main

import (
	"fmt"
	"bufio"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func solve() {
	var n, x int
	scanf("%d %d\n", &n, &x)
	var ans int
	if n < 3 {
		ans = 1
	} else {
		ans = (n - 3) / x + 2
	}
	printf("%d\n", ans)
}

func main() {
	defer writer.Flush()
	var t int
	scanf("%d\n", &t)
	for ; t > 0;t-- {
		solve()
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	t := ReadInt()
	for i := 0; i < t; i++ {
		fmt.Println(solve(ReadInt64(), ReadInt64()))
	}
}

func solve(n, x int64) int64 {
	if n <= 2 {
		return 1
	}
	return (n - 2 + x + x - 1) / x
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadString() (s string) { Scan(&s); return }
func ReadInt() (i int)       { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
func ReadInt64() (i int64) { Scan(&i); return }
func ReadInt64s(n int) []int64 {
	v := make([]int64, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(in, a...)
}

var err error

func next() (n string) {
	scan(&n)
	return n
}

func nextInt() (n int) {
	scan(&n)
	return n
}

func nextLong() (n int64) {
	scan(&n)
	return n
}

func nextDouble() (n float64) {
	scan(&n)
	return n
}

func Max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

// ==================== 以上是模版 ====================
func solve() {
	n := nextInt()
	x := nextInt()
	if n <= 2 {
		printf("%d\n", 1)
	} else {
		printf("%d\n", (n-2+x-1)/x+1)
	}
}

func main() {
	in = bufio.NewReaderSize(os.Stdin, 8192)

	//x := `4
	//7 3
	//1 5
	//22 5
	//987 13`
	//in = bufio.NewReaderSize(strings.NewReader(x), 8192)

	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()

	for t := nextInt(); t > 0; t-- {
		solve()
	}

}

package main
import."fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var T, n, x int
	for Scan(&T); T > 0; T-- {
		Scan(&n, &x)
		if n < 3 {
			Println(1)
		} else {
			Println((n-3)/x + 2)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func print( a ...interface{}) { fmt.Fprint(w, a...) }
func scan( a ...interface{})  { fmt.Fscan(r, a...) }

//for i := 0; i < n; i++  {

func main() {
defer w.Flush()
	var q int
	scan(&q)
	for ; q > 0; q-- {
		var n int
		scan(&n)
		var x int
		scan(&x)
		if n <= 2 {
			print(1, "\n")
		}else{
			var ans = (n - 2)/x + 2
			if (n - 2)%x == 0 {
				ans--
			}
			print(ans, "\n")
		}
	}
}

package main

import (
"fmt"
"bufio"
"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {

	defer writer.Flush()

	var t,i int
	scanf("%d\n", &t) // t -> no. of test cases
	ans  := make([] int, t)
	for i = 1; i<=t; i++ {

		var n, x int
		scanf("%d %d\n", &n, &x)

		if n<=2 {
			ans[i-1] = 1
		}else if (n-2)%x == 0 {
			ans[i-1] = (n-2)/x + 1
		}else { ans[i-1] = (n-2)/x + 2}

	}
	for i = 0; i<t; i++ {
		printf("%d\n", ans[i])
	}

}

package main

import. "fmt"

func solve() {
  var aptNumber int
  var aptCount int
  Scan(&aptNumber)
  Scan(&aptCount)
  if aptNumber <= 2 {
    Println(1)
  } else {
    aptNumber = aptNumber-2
    if aptNumber%aptCount == 0 {
      Println(aptNumber/aptCount + 1)
    } else {
      Println(aptNumber/aptCount + 2)
    }
  }
}

func main() {
var inputs int
Scan(&inputs)
for inputs>0 {
   solve()
   inputs--
  }
}

package main

import. "fmt"
import. "math"

func solve() {
  var aptNumber int
  var aptCount int
  Scan(&aptNumber)
  Scan(&aptCount)
  if aptNumber <= 2 {
    Println(1)
  } else {
    Println(Ceil(float64(aptNumber-2+aptCount)/ float64(aptCount)))
  }
}

func main() {
var inputs int
Scan(&inputs)
for inputs>0 {
   solve()
   inputs--
  }
}

package main

import. "fmt"

func solve() {
  var aptNumber int
  var aptCount int
  Scan(&aptNumber)
  Scan(&aptCount)
  if aptNumber <= 2 {
    Println(1)
  } else {
    Println((aptNumber-3)/aptCount + 2)
  }
}

func main() {
var inputs int
Scan(&inputs)
for inputs>0 {
   solve()
   inputs--
  }
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)

func main() {
	defer writer.Flush()
	var testCaseNum, n, x int
	fmt.Fscan(reader, &testCaseNum)

	for testCase := 0; testCase < testCaseNum; testCase++ {
		fmt.Fscan(reader, &n, &x)
		if n < 3 {
			fmt.Fprintln(writer, 1)
		} else {
			fmt.Fprintln(writer, (n-3)/x+2)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	var t, x, n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		fmt.Fscan(in, &n, &x)
		fmt.Printf("%.0f\n", math.Ceil(float64(n-2)/float64(x))+1)
	}
}

package main

import "fmt"

func main() {
	var t, n, x int
	fmt.Scanf("%d\n", &t)
	// fmt.Println(t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d %d\n", &n, &x)
		if n < 3 {
			fmt.Println(n)
		} else {
			fmt.Println((n-3)/x + 2)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(in, a...)
}

var err error

func next() (n string) {
	scan(&n)
	return n
}

func nextInt() (n int) {
	scan(&n)
	return n
}

func nextLong() (n int64) {
	scan(&n)
	return n
}

func nextDouble() (n float64) {
	scan(&n)
	return n
}

func Max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

// ==================== 以上是模版 ====================
func solve() {
	n:=nextInt()
	x:=nextInt()
	printf("%d\n", (n-2+x-1)/x + 1)
}

func main() {

	//in = bufio.NewReaderSize(os.Stdin, 8192)
	//x:=`4
	//7 3
	//1 5
	//22 5
	//987 13`

	in = bufio.NewReaderSize(os.Stdin, 8192)
	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()

	for t := nextInt(); t > 0; t-- {
		solve()
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(in, a...)
}

var err error

func next() (n string) {
	scan(&n)
	return n
}

func nextInt() (n int) {
	scan(&n)
	return n
}

func nextLong() (n int64) {
	scan(&n)
	return n
}

func nextDouble() (n float64) {
	scan(&n)
	return n
}

func Max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

// ==================== 以上是模版 ====================
func solve() {
	n := nextInt()
	x := nextInt()
	if n <= 2 {
		printf("%d\n", 1)
	} else {
		printf("%d\n", (n-2+x-1)/x+1)
	}
}

func main() {
	in = bufio.NewReaderSize(os.Stdin, 8192)

	x := `4
	7 3
	1 5
	22 5
	987 13`
	in = bufio.NewReaderSize(strings.NewReader(x), 8192)

	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()

	for t := nextInt(); t > 0; t-- {
		solve()
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(in, a...)
}

var err error

func next() (n string) {
	scan(&n)
	return n
}

func nextInt() (n int) {
	scan(&n)
	return n
}

func nextLong() (n int64) {
	scan(&n)
	return n
}

func nextDouble() (n float64) {
	scan(&n)
	return n
}

func Max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

// ==================== 以上是模版 ====================
func solve() {
	n := nextInt()
	x := nextInt()
	if n <= 2 {
		printf("%d\n", n)
	}
	printf("%d\n", (n-2+x-1)/x+1)
}

func main() {
	in = bufio.NewReaderSize(os.Stdin, 8192)

	//x := `4
	//1 1
	//7 3
	//1 5
	//22 5
	//987 13`
	//in = bufio.NewReaderSize(strings.NewReader(x), 8192)

	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()

	for t := nextInt(); t > 0; t-- {
		solve()
	}

}

package main

import (
"fmt"
"bufio"
"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {

	defer writer.Flush()

	var t,i int
	scanf("%d\n", &t) // t -> no. of test cases
	ans  := make([] int, t)
	for i = 1; i<=t; i++ {

		var n, x int
		scanf("%d %d\n", &n, &x)
		ans[i-1] = (n-2)/x + 1

	}
	for i = 0; i<t; i++ {
		printf("%d\n", ans[i])
	}

}

package main

import (
  "fmt"
  "math"
)

func main() {

var inputs int
var aptNumber int
var aptCount int

fmt.Scanf("%d", &inputs)

for inputs>0 {
  fmt.Scanf("%d", &aptNumber)
  fmt.Scanf("%d", &aptCount)

  if aptNumber == 1 || aptNumber == 2 {
    fmt.Println("1")
    inputs--
    continue
  }

  fmt.Println(math.Ceil(float64(aptNumber-2+aptCount)/float64(aptCount)))
  inputs--

  }

}

package main

import (
  "fmt"
  "math"
)

func solve() {
  var aptNumber int
  var aptCount int
  fmt.Scanf("%d", &aptNumber)
  fmt.Scanf("%d", &aptCount)
  if aptNumber <= 2 {
    fmt.Println("1")
  } else {
  fmt.Println(math.Ceil(float64(aptNumber-2+aptCount)/float64(aptCount)))
  }
}

func main() {
var inputs int
fmt.Scanf("%d", &inputs)
for inputs>0 {
   solve()
   inputs--
  }
}


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.

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.

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

NoteThe picture shows the lines from the first test case of the example. Black circles denote intersection points with integer coordinates.

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var t, n, m int64
	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d\n", &n)
		var no, nj, p int64 = 0, 0, 0
		for i := int64(1); i <= n; i++ {
			if i != n {
				fmt.Fscanf(reader, "%d", &p)
			} else {
				fmt.Fscanf(reader, "%d\n", &p)
			}

			if p%2 == 0 {
				no++
			} else {
				nj++
			}
		}

		fmt.Fscanf(reader, "%d\n", &m)
		var mo, mj, q int64 = 0, 0, 0
		for i := int64(1); i <= m; i++ {
			if i != m {
				fmt.Fscanf(reader, "%d", &q)
			} else {
				fmt.Fscanf(reader, "%d\n", &q)
			}

			if q%2 == 0 {
				mo++
			} else {
				mj++
			}
		}

		fmt.Printf("%d\n", no*mo+nj*mj)
	}

}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		solveOne()
	}
}

func solveOne() {
	var odd1, odd2 int
	n := readInt()
	for i := 0; i < n; i++ {
		v := readInt()
		if v%2 > 0 {
			odd1++
		}
	}
	m := readInt()
	for i := 0; i < m; i++ {
		v := readInt()
		if v%2 > 0 {
			odd2++
		}
	}
	printInt64(int64(odd1)*int64(odd2) + int64(n-odd1)*int64(m-odd2))
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}

package main

import (
    "fmt"
    "bufio"
    "os"
)
var input *bufio.Reader

func solve() {
    var (
        N int
        M int
        ans int64
        N_mod1 int64
        N_mod0 int64
        M_mod1 int64
        M_mod0 int64
    )
    fmt.Fscanf(input, "%d\n", &N)
    p := make([]int, N)
    for i:=0 ; i<N ; i++ {
        fmt.Fscanf(input, "%d", &p[i])
        if p[i]%2==0 {
            N_mod0 += 1
        } else {
            N_mod1 += 1
        }
    }
    fmt.Fscanf(input, "\n")
    fmt.Fscanf(input, "%d\n", &M)
    q := make([]int, M)
    for i:=0 ; i<M ; i++ {
        fmt.Fscanf(input, "%d", &q[i])
        if q[i]%2==0 {
            M_mod0 += 1
        } else {
            M_mod1 += 1
        }
    }
    fmt.Fscanf(input, "\n")

    ans = N_mod0*M_mod0 + N_mod1*M_mod1

    fmt.Println(ans)
}

func main () {
    input = bufio.NewReader(os.Stdin)
    var T int
    fmt.Fscanf(input, "%d\n", &T)
    for i:=0; i<T; i++ {
        solve()
    }
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"sync"
)

const (
	MX_INT int64 = math.MaxInt64
	MN_INT int64 = math.MinInt64
)

func main(){
	for testCases := ScanInt64(); testCases > 0; testCases--{
		n := ScanInt64()
		p := ScanInt64Slice(n)
		m := ScanInt64()
		q := ScanInt64Slice(m)

		pEven, qEven := int64(0), int64(0)

		for i := 0; i < len(p); i++{
			if p[i] % 2 == 0{
				pEven++
			}
		}

		for i := 0; i < len(q); i++{
			if q[i] % 2 == 0{
				qEven++
			}
		}

		fmt.Println(pEven * qEven + (n - pEven) * (m - qEven))

	}
	close(O)
	oWg.Wait()
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var Pl func(a ...interface{}) (n int, err error)

func init() {
	Pl = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e8))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriterSize(os.Stdout, int(1e5))
	go func(writer *bufio.Writer) {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}(writer)
}

func ScanWord() string {
	in.Scan()
	return in.Text()
}

func ScanStringSlice(n int64) []string {
	length := int(n)
	s := make([]string, n)
	for i := 0; i < length; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt() int {
	intStr := ScanWord()
	i, err := strconv.Atoi(intStr)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int64) []int64 {
	length := int(n)
	arr := make([]int64, n)
	for i := 0; i < length; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func Mx(args ...int64) int64 {
	maxVal := MN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Mn(args ...int64) int64 {
	minVal := MX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}

func S(v interface{}) string {
	return fmt.Sprintf("%v", v)
}

package main

import (
	"bufio"
	"os"
	"strconv"
)

var in *bufio.Scanner
var out *bufio.Writer

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	in.Split(bufio.ScanWords)
	defer out.Flush()

	in.Scan();
	t, _ := strconv.Atoi(in.Text());
	for i:=0; i<t; i++ {
		a := int64(0);
		b := int64(0);

		in.Scan();
		n, _ :=strconv.ParseInt(in.Text(), 10, 64);

		for i:=int64(0); i<n; i++ {
			in.Scan();
			temp, _ :=strconv.ParseInt(in.Text(), 10, 64);
			a += (temp&1);
		}
		in.Scan();
		m, _ :=strconv.ParseInt(in.Text(), 10, 64);
		for i:=int64(0); i<m; i++ {
			in.Scan();
			temp, _ :=strconv.ParseInt(in.Text(), 10, 64);
			b += (temp&1);
		}

		out.WriteString(strconv.FormatInt(a*b+(n-a)*(m-b), 10));
		out.WriteByte('\n');
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		pns := readLine(reader)
		pn, _ := strconv.Atoi(string(pns))
		po, pnoto := int64(0), int64(0)
		line := readLine(reader)
		arr := strings.Split(string(line), " ")
		// fmt.Println(pn, arr)
		for j := 0; j < pn; j++ {
			got, _ := strconv.ParseInt(arr[j], 10, 64)
			if got%2 == 0 {
				po++
			} else {
				pnoto++
			}
		}
		qns := readLine(reader)
		qn, _ := strconv.Atoi(string(qns))
		qo, qnoto := int64(0), int64(0)
		line = readLine(reader)
		arr = strings.Split(string(line), " ")
		// fmt.Println(qn, arr)
		for j := 0; j < qn; j++ {
			got, _ := strconv.ParseInt(arr[j], 10, 64)
			// fmt.Println(got)
			if got%2 == 0 {
				qo++
			} else {
				qnoto++
			}
		}
		// fmt.Println(po, pnoto, qo, qnoto)
		result := po*qo + pnoto*qnoto
		fmt.Println(result)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			// fmt.Println(string(result))
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		// str := strconv.FormatInt(A[i], 10)  // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var t int

func main() {
	t = ReadInt()

	for i := 0; i < t; i++ {
		n := ReadInt()
		P := ReadIntSlice(n)
		m := ReadInt()
		Q := ReadIntSlice(m)

		// PP := make([]int, n)
		// QQ := make([]int, m)
		// for j := 0; j < n; j++ {
		// }
		peven := 0
		qeven := 0
		for j := 0; j < n; j++ {
			if P[j]%2 == 0 {
				peven++
			}
		}
		for j := 0; j < m; j++ {
			if Q[j]%2 == 0 {
				qeven++
			}
		}

		ans := int64(peven)*int64(qeven) + int64(n-peven)*int64(m-qeven)

		fmt.Println(ans)
	}
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

/*******************************************************************/

    package main

    import (
    	"bufio"
    	"fmt"
    	"os"
    )
    var (
    	reader *bufio.Reader
    )
    func input() (int64, int64) {
        odd := int64(0)
	    even := int64(0)
    	var n int64
    	fmt.Fscan(reader, &n)
    	arr := make([]int64, n)
    	for i := int64(0); i < n; i++ {
    		fmt.Fscan(reader, &arr[i])
    		if (arr[i]%2 == 0){
    			even++
    		}else {
    			odd++
    		}
    	}
    	return even, odd
    }
    func main(){
    	var t int64
    	reader = bufio.NewReader(os.Stdin)
    	fmt.Fscan(reader, &t)
    	for i := int64(0); i < t; i ++ {
    		var pEven, pOdd, qEven, qOdd int64
    		pEven, pOdd = input()
    		qEven, qOdd = input()
    		fmt.Println(pEven*qEven + pOdd*qOdd)
    	}
    }

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	t := readi()
	for i := 0; i < t; i++ {
		n := readi()
		p := make([]int, n)
		for i := range p {
			p[i] = readi()
		}
		m := readi()
		q := make([]int, m)
		for i := range q {
			q[i] = readi()
		}
		println(solve(n, m, p, q))

	}
}

func solve(n, m int, p, q []int) int64 {
	var pe, qe, po, qo int
	for _, v := range p {
		if v%2 == 0 {
			pe++
		}
	}
	po = n - pe
	for _, v := range q {
		if v%2 == 0 {
			qe++
		}
	}
	qo = m - qe

	return int64(pe)*int64(qe) + int64(po)*int64(qo)
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

const (
	MX_INT int64 = math.MaxInt64
	MN_INT int64 = math.MinInt64
)

func main() {
	for t := ScanInt(); t > 0; t-- {
		n := ScanInt()
		p := ScanInt64Slice(n)

		m := ScanInt()
		q := ScanInt64Slice(m)

		ep, op := evnOdd(p)
		eq, oq := evnOdd(q)

		r := (ep*eq)+(op*oq)

		P(r)
	}

	close(O)
	oWg.Wait()
}

func evnOdd(a []int64) (int64, int64) {
	o, e := int64(0), int64(0)
	for i := 0; i < len(a); i++ {
	    if a[i] % 2 == 0 {
	    	e++
		} else {
			o++
		}
	}
	return e, o
}

func intersect(p, q int64) bool {
	if (p+q)%2 == 0 {
		return true
	}

	return false
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := MX_INT, MN_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader *bufio.Reader
)

func input() (int64, int64) {
	odd := int64(0)
	even := int64(0)

	var n int64
	fmt.Fscan(reader, &n)
	for i := int64(0); i < n; i++ {
		var x int64
		fmt.Fscan(reader, &x)
		if x % 2 == 0 {
			even++
			continue
		}
		odd++
	}
	return odd, even
}
func main(){
	reader = bufio.NewReader(os.Stdin)
	var t int64
	fmt.Fscan(reader, &t)
	for i := int64(0); i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int64
		pOdd, pEven = input()
		qOdd, qEven = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader *bufio.Reader
)

func countOddAndEven() (int64, int64) {
	var odd, even, n, tmp int64
	fmt.Fscan(reader, &n)
	for i := int64(0); i < n; i++ {
		fmt.Fscan(reader, &tmp)
		if tmp%2 == 0 {
			even++
		} else {
			odd++
		}
	}
	return odd, even
}

func main() {

	var t int64
	reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &t)

	for i := int64(0); i < t; i++ {

		var oddD, evenD, oddJ, evenJ int64

		oddD, evenD = countOddAndEven()
		oddJ, evenJ = countOddAndEven()

		fmt.Println(oddD*oddJ + evenD*evenJ)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader *bufio.Reader
)

func countOddAndEven() (int64, int64) {
	var odd, even, n, tmp int64
	fmt.Fscan(reader, &n)
	for i := int64(0); i < n; i++ {
		fmt.Fscan(reader, &tmp)
		if tmp%2 == 0 {
			even++
		} else {
			odd++
		}
	}
	return odd, even
}

func main() {

	reader = bufio.NewReader(os.Stdin)
	var t int64
	fmt.Fscan(reader, &t)

	for i := int64(0); i < t; i++ {
		var pEven, pOdd, qEven, qOdd int64
		pOdd, pEven = countOddAndEven()
		qOdd, qEven = countOddAndEven()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func doSth(DLSLines, JLSLines []int) int {
	var oddD, evenD, oddJ, evenJ, odd, even int

	for i := range DLSLines {
		if DLSLines[i]%2 == 0 {
			evenD++
		} else {
			oddD++
		}
	}

	for i := range JLSLines {
		if JLSLines[i]%2 == 0 {
			evenJ++
		} else {
			oddJ++
		}
	}

	if oddD != 0 && oddJ != 0 {
		odd = max(oddD, oddJ)
	}

	if evenD != 0 && evenJ != 0 {
		even = max(evenD, evenJ)
	}

	return odd + even
}

func main() {

	var numOfTest int
	var DLS, JLS int
	var DLSLines, JLSLines []int

	fmt.Scan(&numOfTest)
	for i := 0; i < numOfTest; i++ {
		fmt.Scan(&DLS)
		DLSLines = make([]int, DLS)
		for i := range DLSLines {
			fmt.Scan(&DLSLines[i])
		}

		fmt.Scan(&JLS)
		JLSLines = make([]int, JLS)
		for i := range JLSLines {
			fmt.Scan(&JLSLines[i])
		}

		fmt.Println(doSth(DLSLines, JLSLines))
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader *bufio.Reader
)

func countOddAndEven(c chan int64) {
	var odd, even, n, tmp int64
	fmt.Fscan(reader, &n)
	for i := int64(0); i < n; i++ {
		fmt.Fscan(reader, &tmp)
		if tmp%2 == 0 {
			even++
		} else {
			odd++
		}
	}

	c <- odd
	c <- even
	close(c)
}

func main() {

	var t int64
	reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &t)

	for i := int64(0); i < t; i++ {

		var pEven, pOdd, qEven, qOdd int64

		c1 := make(chan int64)
		c2 := make(chan int64)

		go countOddAndEven(c1)
		go countOddAndEven(c2)

		pOdd, pEven = <-c1, <-c1
		qOdd, qEven = <-c2, <-c2

		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var t, n, m int64
	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d\n", &n)
		var no, nj, p int64 = 0, 0, 0
		for i := int64(1); i <= n; i++ {
			if i != n {
				fmt.Fscanf(reader, "%d", &p)
			} else {
				fmt.Fscanf(reader, "%d\n", &p)
			}

			if p%2 == 0 {
				no++
			} else {
				nj++
			}
		}

		fmt.Fscanf(reader, "%d\n", &m)
		var mo, mj, q int64 = 0, 0, 0
		for i := int64(1); i <= m; i++ {
			if i != n {
				fmt.Fscanf(reader, "%d", &q)
			} else {
				fmt.Fscanf(reader, "%d\n", &q)
			}

			if q%2 == 0 {
				mo++
			} else {
				mj++
			}
		}

		fmt.Printf("%d\n", no*mo+nj*mj)
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var t, n, m int64
	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d\n", &n)
		var no, nj, p int64
		for i := int64(1); i <= n; i++ {
			if i != n {
				fmt.Fscanf(reader, "%d ", &p)
			} else {
				fmt.Fscanf(reader, "%d\n", &p)
			}

			if p%2 == 0 {
				no++
			} else {
				nj++
			}
		}

		fmt.Fscanf(reader, "%d\n", &m)
		var mo, mj, q int64
		for i := int64(1); i <= m; i++ {
			if i != n {
				fmt.Fscanf(reader, "%d ", &q)
			} else {
				fmt.Fscanf(reader, "%d\n", &q)
			}

			if q%2 == 0 {
				mo++
			} else {
				mj++
			}
		}

		fmt.Printf("%d\n", no*mo+nj*mj)
	}

}

package main

import (
    "fmt"
    "bufio"
    "os"
)
var input *bufio.Reader

func solve() {
    var (
        N int
        M int
        ans int
        N_mod1 int
        N_mod0 int
        M_mod1 int
        M_mod0 int
    )
    fmt.Fscanf(input, "%d\n", &N)
    p := make([]int, N)
    for i:=0 ; i<N ; i++ {
        fmt.Fscanf(input, "%d", &p[i])
        if p[i]%2==0 {
            N_mod0 += 1
        } else {
            N_mod1 += 1
        }
    }
    fmt.Fscanf(input, "\n")
    fmt.Fscanf(input, "%d\n", &M)
    q := make([]int, M)
    for i:=0 ; i<M ; i++ {
        fmt.Fscanf(input, "%d", &q[i])
        if q[i]%2==0 {
            M_mod0 += 1
        } else {
            M_mod1 += 1
        }
    }
    fmt.Fscanf(input, "\n")

    ans = N_mod0*M_mod0 + N_mod1*M_mod1

    fmt.Println(ans)
}

func main () {
    input = bufio.NewReader(os.Stdin)
    var T int
    fmt.Fscanf(input, "%d\n", &T)
    for i:=0; i<T; i++ {
        solve()
    }
}

package main

import (
	"bufio"
	"os"
	"strconv"
)

var in *bufio.Scanner
var out *bufio.Writer

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	in.Split(bufio.ScanWords)
	defer out.Flush()

	in.Scan();
	t, _ := strconv.Atoi(in.Text());
	for i:=0; i<t; i++ {
		a := 0;
		b := 0;

		in.Scan();
		n, _ :=strconv.Atoi(in.Text());

		for i:=0; i<n; i++ {
			in.Scan();
			temp, _ :=strconv.Atoi(in.Text());
			a += (temp&1);
		}
		in.Scan();
		m, _ :=strconv.Atoi(in.Text());
		for i:=0; i<m; i++ {
			in.Scan();
			temp, _ :=strconv.Atoi(in.Text());
			b += (temp&1);
		}

		out.WriteString(strconv.Itoa(a*b + (n-a)*(m-b)));
		out.WriteByte('\n');
	}
}

package main

import (
	"bufio"
	"os"
	"strconv"
)

var in *bufio.Scanner
var out *bufio.Writer

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

	in.Split(bufio.ScanWords)
	defer out.Flush()

	in.Scan();
	t, _ := strconv.Atoi(in.Text());
	for i:=0; i<t; i++ {
		a := 0;
		b := 0;

		in.Scan();
		n, _ :=strconv.Atoi(in.Text());

		for i:=0; i<n; i++ {
			in.Scan();
			temp, _ :=strconv.Atoi(in.Text());
			a += (temp&1);
		}
		in.Scan();
		m, _ :=strconv.Atoi(in.Text());
		for i:=0; i<m; i++ {
			in.Scan();
			temp, _ :=strconv.Atoi(in.Text());
			b += (temp&1);
		}

		out.WriteString(strconv.FormatInt(int64(a*b+(n-a)*(m-b)), 10));
		out.WriteByte('\n');
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var cases int
	fmt.Scanf("%d\n", &cases)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < cases; i++ {
		pns := readLine(reader)
		pn, _ := strconv.Atoi(string(pns))
		po, pnoto := 0, 0
		line := readLine(reader)
		arr := strings.Split(string(line), " ")
		// fmt.Println(pn, arr)
		for j:=0;j<pn;j++ {
			got, _ := strconv.ParseInt(arr[j], 10, 64)
			if got % 2 == 0 {
				po++
			} else {
				pnoto++
			}
		}
		qns := readLine(reader)
		qn, _ := strconv.Atoi(string(qns))
		qo, qnoto := 0,0
		line = readLine(reader)
		arr = strings.Split(string(line), " ")
		// fmt.Println(qn, arr)
		for j:=0;j<qn;j++ {
			got, _ := strconv.ParseInt(arr[j], 10, 64)
			// fmt.Println(got)
			if got % 2 == 0 {
				qo++
			} else {
				qnoto++
			}
		}
		// fmt.Println(po, pnoto, qo, qnoto)
		result := po * qo + pnoto * qnoto
		fmt.Println(result)
	}
}

func readLine(reader *bufio.Reader) []byte {
	result := make([]byte, 0)
	for {
		s, isPrefix, err := reader.ReadLine()
		if err != nil {
			fmt.Printf("error=%+v\n", err)
			break
		}
		result = append(result, s...)
		if !isPrefix {
			// fmt.Println(string(result))
			break
		}
	}
	return result
}

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

/*********** DP sub-functions ***********/

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int, target int) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		// str := strconv.FormatInt(A[i], 10)  // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var t int

func main() {
	t = ReadInt()

	for i := 0; i < t; i++ {
		n := ReadInt()
		P := ReadIntSlice(n)
		m := ReadInt()
		Q := ReadIntSlice(m)

		// PP := make([]int, n)
		// QQ := make([]int, m)
		// for j := 0; j < n; j++ {
		// }
		peven := 0
		qeven := 0
		for j := 0; j < n; j++ {
			if P[j]%2 == 0 {
				peven++
			}
		}
		for j := 0; j < m; j++ {
			if Q[j]%2 == 0 {
				qeven++
			}
		}

		ans := peven*qeven + (n-peven)*(m-qeven)

		fmt.Println(ans)
	}
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

/*******************************************************************/

package main

import "fmt"
func check(p int, q int) bool{
	var status bool
	if (p-q)%2 == 0 {
		status = true
	}
	return status
}
func input() ( []int)   {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)
	for j := 0; j < n; j++ {
		fmt.Scan(&arr[j])
	}
	return arr

}
func main(){
	var t, count int
	count = 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		p := input()
		q := input()
		for _, pi := range p {
			for _, qj := range q {
				if check(pi, qj) {
					count ++
				}
			}
		}
		fmt.Println(count)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func input() (int64, int64) {
	var n, even, odd int64
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &n)
	arr := make([]int64, n)
	for i := int64(0); i < n; i++ {
		fmt.Fscan(reader, &arr[i])
		if (arr[i]%2 == 0){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t int64
	fmt.Scan(&t)
	for i := int64(0); i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int64
		pEven, pOdd = input()
		qEven, qOdd = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

    package main

    import (
    	"bufio"
    	"fmt"
    	"os"
    )
    var (
    	reader *bufio.Reader
    )
    func input() (int64, int64) {
        odd := int64(0)
	    even := int64(0)
    	var n int64
    	reader = bufio.NewReader(os.Stdin)
    	fmt.Fscan(reader, &n)
    	arr := make([]int64, n)
    	for i := int64(0); i < n; i++ {
    		fmt.Fscan(reader, &arr[i])
    		if (arr[i]%2 == 0){
    			even++
    		}else {
    			odd++
    		}
    	}
    	return even, odd
    }
    func main(){
    	var t int64
    	reader = bufio.NewReader(os.Stdin)
    	fmt.Fscan(reader, &t)
    	for i := int64(0); i < t; i ++ {
    		var pEven, pOdd, qEven, qOdd int64
    		pEven, pOdd = input()
    		qEven, qOdd = input()
    		fmt.Println(pEven*qEven + pOdd*qOdd)
    	}
    }

package main

import (
	"bufio"
	"fmt"
	"os"
)

func check(p int) bool{
	if p%2 == 0 {
		return true
	}
	return false
}
func input() (int, int) {
	var n, even, odd int
	reader := bufio.NewReader(os.Stdin)
	fmt.Scan(&n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &arr[i])
		if check(arr[i]){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t, count int
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		pEven, pOdd = input()
		qEven, qOdd = input()
		count = pEven*qEven + pOdd*qOdd
		fmt.Println(count)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func check(p int) bool{
	if p%2 == 0 {
		return true
	}
	return false
}

func numbers(s string) []int {
	var n []int
	for _, f := range strings.Fields(s) {
		i, err := strconv.Atoi(f)
		if err == nil {
			n = append(n, i)
		}
	}
	return n
}

func input() (int, int) {
	var n, even, odd, tmp int
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &tmp)
		if check(tmp){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t int
	fmt.Scan(&t)
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		var count int64
		var n, tmp int
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &tmp)
			if check(tmp){
				pEven++
			}else {
				pOdd++
			}
		}

		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &tmp)
			if check(tmp){
				qEven++
			}else {
				qOdd++
			}
		}

		//pEven, pOdd = input()
		//qEven, qOdd = input()
		count = int64(pEven*qEven) + int64(pOdd*qOdd)
		fmt.Println(count)
	}
}

package main

import (
	"fmt"
)

func check(p int) bool{
	var status bool
	if p%2 == 0 {
		status = true
	} else {
		status = false
	}
	return status
}
func input() ( []int)   {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)
	for j := 0; j < n; j++ {
		fmt.Scan(&arr[j])
	}
	return arr

}
func main(){
	var t, even, odd, count int
	even = 0
	odd = 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		p := input()
		q := input()
		for _, pi := range p {
			if check(pi){
				even ++
			}else {
				odd ++
			}
		}
		for _, qj := range q {
			if check(qj){
				even ++
			}else {
				odd ++
			}
		}
		count = even/2 + odd/2
		fmt.Println(count)
	}
}

package main

import (
	"fmt"
)

func check(p int) bool{
	var status bool
	if p%2 == 0 {
		status = true
	} else {
		status = false
	}
	return status
}
func input() ( []int)   {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)
	for j := 0; j < n; j++ {
		fmt.Scan(&arr[j])
	}
	return arr

}
func main(){
	var t, even, odd, count int
	even = 0
	odd = 0
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		p := input()
		q := input()
		for _, pi := range p {
			if check(pi){
				even ++
			}else {
				odd ++
			}
		}
		for _, qj := range q {
			if check(qj){
				even ++
			}else {
				odd ++
			}
		}
		count = even/2 + odd/2
		fmt.Println(count)
		even = 0
		odd = 0
	}
}

package main
import (
    "fmt"
	"bufio"
	"os"
)

func check(p int) bool{
	var status bool
	if p%2 == 0 {
		status = true
	} else {
		status = false
	}
	return status
}
func input() []int {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &arr[i])
	}
	return arr
}
func main(){
	var t, count int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		p := input()
		q := input()
		for _, pi := range p {
			if check(pi){
				pEven++
			}else {
				pOdd++
			}
		}
		for _, qj := range q {
			if check(qj){
				qEven++
			}else {
				qOdd++
			}
		}
		count = pEven*qEven + pOdd*qOdd
		fmt.Println(count)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func check(p int) bool{
	if p%2 == 0 {
		return true
	}
	return false
}

func numbers(s string) []int {
	var n []int
	for _, f := range strings.Fields(s) {
		i, err := strconv.Atoi(f)
		if err == nil {
			n = append(n, i)
		}
	}
	return n
}

func input() (int, int) {
	var n, even, odd, tmp int
	fmt.Scan(&n)
	reader := bufio.NewReader(os.Stdin)

	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &tmp)
		fmt.Println("WTF NGU HOC", tmp)
		if check(tmp){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		var count int64
		pEven, pOdd = input()
		qEven, qOdd = input()
		count = int64(pEven*qEven) + int64(pOdd*qOdd)
		fmt.Println(count)
	}
}

package main
import (
	"bufio"
	"os"
	"fmt"
)

func check(p int) bool{
	var status bool
	if p%2 == 0 {
		status = true
	} else {
		status = false
	}
	return status
}
func input() []int {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &arr[i])
	}
	return arr
}
func main(){
	var t, count int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		p := input()
		q := input()
		for _, pi := range p {
			if check(pi){
				pEven++
			}else {
				pOdd++
			}
		}
		for _, qj := range q {
			if check(qj){
				qEven++
			}else {
				qOdd++
			}
		}
		count = pEven*qEven + pOdd*qOdd
		fmt.Println(count)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)
var (
	reader *bufio.Reader
)
func input() (int64, int64) {
	var n, even, odd int64
	reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &n)
	arr := make([]int64, n)
	for i := int64(0); i < n; i++ {
		fmt.Fscan(reader, &arr[i])
		if (arr[i]%2 == 0){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t int64
	reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &t)
	for i := int64(0); i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int64
		pEven, pOdd = input()
		qEven, qOdd = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func check(p int) bool{
	if p%2 == 0 {
		return true
	}
	return false
}

func numbers(s string) []int {
	var n []int
	for _, f := range strings.Fields(s) {
		i, err := strconv.Atoi(f)
		if err == nil {
			n = append(n, i)
		}
	}
	return n
}

func input() (int, int) {
	fmt.Println("-----------------------------------------")
	var n, even, odd, tmp int
	fmt.Scan(&n)
	fmt.Println("NGIU DEO CHIU", n)
	for i := 0; i < n; i++ {
		fmt.Scan(tmp)
		fmt.Println("WTF NGU HOC", tmp)
		if check(tmp){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		var count int64
		pEven, pOdd = input()
		qEven, qOdd = input()
		count = int64(pEven*qEven) + int64(pOdd*qOdd)
		fmt.Println(count)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func check(p int) bool{
	if p%2 == 0 {
		return true
	}
	return false
}

func numbers(s string) []int {
	var n []int
	for _, f := range strings.Fields(s) {
		i, err := strconv.Atoi(f)
		if err == nil {
			n = append(n, i)
		}
	}
	return n
}

func input() (int, int) {
	fmt.Println("NGIU DEO CHIU DUOC")
	var n, even, odd, tmp int
	fmt.Scan(&n)
	reader := bufio.NewReader(os.Stdin)
	fmt.Println("NGIU DEO CHIU", n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &tmp)
		fmt.Println("WTF NGU HOC", tmp)
		if check(tmp){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		var count int64
		pEven, pOdd = input()
		qEven, qOdd = input()
		count = int64(pEven*qEven) + int64(pOdd*qOdd)
		fmt.Println(count)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func input() (int64, int64) {
	var n, even, odd int64
	reader := bufio.NewReader(os.Stdin)
	fmt.Scan(&n)
	arr := make([]int64, n)
	for i := int64(0); i < n; i++ {
		fmt.Fscan(reader, &arr[i])
		if (arr[i]%2 == 0){
			even++
		}else {
			odd++
		}
	}
	return even, odd
}
func main(){
	var t int64
	fmt.Scan(&t)
	for i := int64(0); i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int64
		pEven, pOdd = input()
		qEven, qOdd = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

    package main

    import (
    	"bufio"
    	"fmt"
    	"os"
    )

    func input() (int64, int64) {
    	var n, even, odd int64
    	reader := bufio.NewReader(os.Stdin)
    	fmt.Fscan(reader, &n)
    	arr := make([]int64, n)
    	for i := int64(0); i < n; i++ {
    		fmt.Fscan(reader, &arr[i])
    		if (arr[i]%2 == 0){
    			even++
    		}else {
    			odd++
    		}
    	}
    	return even, odd
    }
    func main(){
    	var t int64
    	reader := bufio.NewReader(os.Stdin)
    	fmt.Fscan(reader, &t)
    	for i := int64(0); i < t; i ++ {
    		var pEven, pOdd, qEven, qOdd int64
    		pEven, pOdd = input()
    		qEven, qOdd = input()
    		fmt.Println(pEven*qEven + pOdd*qOdd)
    	}
    }

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	t := readi()
	for i := 0; i < t; i++ {
		n := readi()
		p := make([]int, n)
		for i := range p {
			p[i] = readi()
		}
		m := readi()
		q := make([]int, m)
		for i := range q {
			q[i] = readi()
		}
		println(solve(n, m, p, q))

	}
}

func solve(n, m int, p, q []int) int {
	var pe, qe, po, qo int
	for _, v := range p {
		if v%2 == 0 {
			pe++
		}
	}
	po = n - pe
	for _, v := range q {
		if v%2 == 0 {
			qe++
		}
	}
	qo = m - qe

	return pe*qe + po*qo
}

package main

import (
	"fmt"
)

func main() {
	var numOfTestCase int64
	fmt.Scan(&numOfTestCase)
	for i := 0; int64(i) < numOfTestCase; i++ {
		var n int64
		var tmp int64
		var x1, y1 int64
		var x2, y2 int64

		fmt.Scanf("%d", &n)
		for j := 0; int64(j) < n; j++ {
			fmt.Scanf("%d", &tmp)
			if tmp % 2 == 0 {
			 	x1++
				continue
			}
			y1++
		}

		fmt.Scanf("%d", &n)
		for j := 0; int64(j) < n; j++ {
			fmt.Scanf("%d", &tmp)
			if tmp % 2 == 0 {
			 	x2++
				continue
			}
			y2++
		}
		fmt.Println(x1*x2+y1*y2)
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader *bufio.Reader
)

func input() (int, int) {
	odd := 0
	even := 0

	var n int
	fmt.Fscan(reader, &n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Fscan(reader, &x)
		if x % 2 == 0 {
			even++
			continue
		}
		odd++
	}
	return odd, even
}
func main(){
	reader = bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscan(reader, &t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		pOdd, pEven = input()
		qOdd, qEven = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import "fmt"

func input() (int, int) {
	odd := 0
	even := 0

	var n int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		var x int
		fmt.Scanf("%d", &x)
		if x % 2 == 0 {
			even++
			continue
		}
		odd++
	}
	return odd, even
}
func main(){
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		pOdd, pEven = input()
		qOdd, qEven = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import "fmt"

func input() (int, int) {
	odd := 0
	even := 0

	var n int
	var x int
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x)
		if x % 2 == 0 {
			even++
			continue
		}
		odd++
	}
	return odd, even
}
func main(){
	var t int
	fmt.Scanf("%d", &t)
	for i := 0; i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int
		pOdd, pEven = input()
		qOdd, qEven = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import "fmt"

func input() (int64, int64) {
	odd := int64(0)
	even := int64(0)

	var n int
	var x int64
	fmt.Scanf("%d", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x)
		if x % 2 == 0 {
			even++
			continue
		}
		odd++
	}
	return odd, even
}
func main(){
	var t int64
	fmt.Scanf("%d", &t)
	for i := int64(0); i < t; i ++ {
		var pEven, pOdd, qEven, qOdd int64
		pOdd, pEven = input()
		qOdd, qEven = input()
		fmt.Println(pEven*qEven + pOdd*qOdd)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	reader *bufio.Reader
)

func countOddAndEven(c chan int64) {
	var odd, even, n, tmp int64
	fmt.Fscan(reader, &n)
	for i := int64(0); i < n; i++ {
		fmt.Fscan(reader, &tmp)
		if tmp%2 == 0 {
			even++
		} else {
			odd++
		}
	}

	c <- odd
	c <- even
	close(c)
}

func main() {

	var t int64
	reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &t)

	for i := int64(0); i < t; i++ {

		var oddD, evenD, oddJ, evenJ int64

		c1 := make(chan int64)
		c2 := make(chan int64)

		go countOddAndEven(c1)
		go countOddAndEven(c2)

		oddD, evenD = <-c1, <-c1
		oddJ, evenJ = <-c2, <-c2

		fmt.Println(oddD*oddJ + evenD*evenJ)
	}
}