Due to the frantic usage of the racket to kill flies, Marin has sustained a serious bodily injury known to the medical community as epicondylitis lateralis humeri. His grandma has advised smearing rakija over it, the doctor has prescribed a strong painkiller, but Marin has ignored every single advice and decided to look for the answer in integer sequences.
He has discovered a previously undiscovered sequence of integers and called it the xorbonacci sequence.
The
Because of a reason only known to Marin, he determined that all his sorrows will go away if you answer
his
Help Marin and answer his queries.
Please note: The operation
Input
The first line of input contains the integer
The following line contains
All numbers are smaller than
The following line contains the integer
The
Output
Each of the following
Sample Input 1
4
1 3 5 7
3
2 2
2 5
1 5
Sample Output 1
3
1
0
Sample Input 2
5
3 3 4 3 2
4
1 2
1 3
5 6
7 9
Sample Output 2
0
4
7
4
Comments