Greatest Common Divisor: GCD (A
Greatest Common Divisor: GCD (A
Input
The first line of the input contains integer n, (1 ≤ n ≤ 105). The next line contains n space separated
integers a1, ..., an, (1 ≤ ai ≤ 109).
The third line of the input contains integer q, (1 ≤ q ≤ 3 × 105), denoting the number of queries.
Then follows q lines, each contain an integer gi, (1 ≤ gi ≤ 109).
Output
For each query print the result in a separate line.
Examples
Standard Input Standard Output
4 2
2463 4
5 2
1 1
2 1
3
4
6
6 10
10 20 3 15 60 16 0
6 3
1 1
2 0
3 2
4
5
15