시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 1 1 1 100.000%

문제

Rikka is poor at math. Yuta is worried about that, so he gives Rikka some math tasks to practice. One of them is described below.

There are $n$ children and $m$ kinds of candy. The $i$-th child has $A_i$ dollars, and the unit price of the $i$-th kind of candy is $B_i$. There is an infinite supply of candy of each kind.

Each child has her favorite candy, so she will buy this kind of candy as much as possible and will not buy any candy of other kinds. For example, if a child has $10$ dollars, and the unit price of her favorite candy is $4$ dollars, then she will buy two candies and go home with $2$ dollars left.

Yuta does not know any child's favorite candy. Now Yuta has $q$ queries, each of them consists of an integer $k$. For each query, Yuta wants to know the number of pairs $(i, j)$ ($1 \leq i \leq n$, $1 \leq j \leq m$) with the following property: if the $i$-th child's favorite candy is the $j$-th kind, she will take $k$ dollars home.

To make the problem easier, it is only required to calculate the answers modulo $2$. Help Rikka solve this problem for Yuta!

입력

The first line of the input contains three integers $n$, $m$ and $q$ ($1 \leq n, m, q \leq 5 \cdot 10^4$).

The second line contains $n$ integers $A_i$ ($1 \leq A_i \leq 5 \cdot 10^4$).

The third line contains $m$ integers $B_i$ ($1 \leq B_i \leq 5 \cdot 10^4$).

The fourth line contains $q$ integers $k_i$ which describe the queries ($0 \leq k_i < \max (B_1, B_2, \ldots, B_m)$).

It is guaranteed that $A_i \neq A_j$ and $B_i \neq B_j$ for all $i \neq j$.

출력

For each query, print a single line with a single integer: the answer to the query modulo $2$.

예제 입력 1

5 5 5
1 2 3 4 5
1 2 3 4 5
0 1 2 3 4

예제 출력 1

0
0
0
0
1