There are $$$10^{16}$$$ cities, labeled $$$1,2,\dots,10^{16}$$$.
For distinct cities $$$i,j$$$, there is a bidirectional road between city $$$i$$$ and city $$$j$$$ if and only if $$$\operatorname{lcm}(i,j)=A\cdot\gcd(i,j)+B$$$.
Answer $$$Q$$$ queries.
In the $$$i$$$-th query, an integer $$$x_i$$$ is given. Output the bitwise XOR of the labels of all cities that are reachable from city $$$x_i$$$ by traversing zero or more roads.
The first line contains integers $$$A,B$$$ in this order, separated by spaces. ($$$1\leq A,B \leq 10^8$$$)
The second line contains an integer $$$Q$$$. ($$$1\leq Q\leq 10^5$$$)
Each of the following $$$Q$$$ lines contains an integer $$$x_i$$$ for the $$$i$$$-th query. ($$$1\leq x_i\leq 10^{16}$$$)
Print $$$Q$$$ lines.
On the $$$i$$$-th line $$$(1\leq i\leq Q)$$$, output the answer to the $$$i$$$-th query.
3 2842026728
28 26 54 108
81781525 39459251053907475616090625029806730076217696038011341614502367555040341613851468112151358558435129081513506101126478601534519491287293575
53908389 6160906250298067 3007621769603801 9491260218029 2151369618045 4034161385146811 2151369618045 332851610359999 112647860153451 9491260218029
For the first example, the existence of a road between cities $$$i,j$$$ is equivalent to $$$\operatorname{lcm}(i,j)=3\cdot\gcd(i,j)+28$$$.
The bitwise XOR $$$x \oplus y$$$ of non-negative integers $$$x,y$$$ is defined as follows.
For example, $$$3 \oplus 5 = 6$$$ (in binary, $$$011 \oplus 101 = 110$$$).
| Name |
|---|


