You are given two multisets of integers, and . Then you are given queries
containing a number
and are asked to find the number of ways to write as a sum of two numbers
and .
Input
The first line of input contains two positive integers
, the number of
values in each multiset. The next two lines then contain the
integers in each multiset. Each value in the multisets satisfies
.
Next there is a line with a positive integer , the number of queries.
Next there are lines,
each containing an integer satisfying .
Output
For each query you
should print the number of ways to pick and such that . Print each number on its
own line.
Sample Input 1 |
Sample Output 1 |
3 4
1 2 3
4 5 6 7
3
5
7
9
|
1
3
2
|