URI Online Judge | 2500

William Xorando

By Francisco Elio Parente Arcos Filho, UEA BR Brazil

Timelimit: 1

William recently learned some properties of the bit to bit operator xor (represented by the operator '^' in C language ). He realized that he can do many interesting algorithms with it: Find lonely elements in a sequence, exchange values ​​without auxiliary variable, encryption and many others. Then he began to experiment and decided to name an operation using xor with its name, the w-xor. The w-xor operation is performed on a sequence of values. Example: it is an S={a1, a2, a3, a4}, applying w-xor over the sequence S once is equivalent to:

a1= a1^a2^a3^a4

a2= a1^a2^a3^a4

a3= a1^a2^a3^a4

a4= a1^a2^a3^a4

a1= a1^a2^a3^a4

If S={a1, a2, a3, a4, a5} then applying w-xor over S once is:

a1= a1^a2^a3^a4^a5

a2= a1^a2^a3^a4^a5

a3= a1^a2^a3^a4^a5

a4= a1^a2^a3^a4^a5

a5= a1^a2^a3^a4^a5

a1= a1^a2^a3^a4^a5
 

Given a sequence S and applying w-xor M times over it, you would know what the value of the K-th position?

Input

The input consists of several test cases. Each test case begins with three integers 2 ≤ N ≤ 103, 1 ≤ M ≤ 106  and 1 ≤ KN representing the number of elements of the sequence, the number of w-xor operations applied and the position of the value to be found (note that the first position is 1), respectively. On the next line, there will be N integer values ​​-109Ai ≤ 109. The entry ends when N=M=K=0.

Output

The output consists of one line per test case containing the value of the K-th position of the sequence after applied M times the w-xor on it.

Input Sample Output Sample

4 2 2

7 3 9 3

5 3 2

5 4 3 2 1

0 0 0

3

2