Given a sequence a1…an. You need to perform m queries on it.
In each query, two parameters x,y are given, and we let
l=min(((x+ans⋅t)modn)+1,((y+ans⋅t)modn)+1)r=max(((x+ans⋅t)modn)+1,((y+ans⋅t)modn)+1)
In this statement, t is a given constant, which can be 0 or 1. And ans is the answer of last query, with initial value is 0.
You need to find a pair (i,j), satisfies l≤i≤j≤r, and maximize ai xor ai+1 xor…xor aj.
The answer of this query is ai xor ai+1 xor…xor aj.
Input
The first line contains three integers, n, m, and t.
The second line contains n integers, representing the sequence a.
The next m lines, each line contains two integers, x and y.
Output
For each query, output an integer represents the answer.
Constraints
1≤n,m≤20000
0≤t≤1
0≤x,y,ai≤109
The actual queries are (1,5),(1,3),(3,5).
You can choose (i,j) as (1,2),(1,2),(3,4) to maximize the value.