#arc146b. [arc146_b]Plus and AND

[arc146_b]Plus and AND

Problem Statement

You are given a sequence of NN non-negative integers: A=(A1,A2,dots,AN)A=(A_1,A_2,\\dots,A_N). You may perform the following operation at most MM times (possibly zero):

  • choose an integer ii such that 1leileN1 \\le i \\le N and add 11 to AiA_i.

Then, you will choose KK of the elements of AA.

Find the maximum possible value of the bitwise mathrmAND\\mathrm{AND} of the elements you choose.

What is bitwise rmAND{\\rm AND}?

The bitwise rmAND{\\rm AND} of non-negative integers AA and BB, AmathrmANDBA\\ \\mathrm{AND}\\ B, is defined as follows:

  • When ArmANDBA\\ {\\rm AND}\\ B is written in base two, the digit in the 2k2^k's place (kgeq0k \\geq 0) is 11 if both of the digits in that place of AA and BB are 11, and 00 otherwise.

For example, 3rmAND5=13\\ {\\rm AND}\\ 5 = 1. (In base two, 011rmAND101=001011\\ {\\rm AND}\\ 101 = 001.)
Generally, the bitwise rmAND{\\rm AND} of kk non-negative integers p1,p2,p3,dots,pkp_1, p_2, p_3, \\dots, p_k is defined as $(\\dots ((p_1\\ \\mathrm{AND}\\ p_2)\\ \\mathrm{AND}\\ p_3)\\ \\mathrm{AND}\\ \\dots\\ \\mathrm{AND}\\ p_k)$. We can prove that this value does not depend on the order of p1,p2,p3,dots,pkp_1, p_2, p_3, \\dots, p_k.

Constraints

  • 1leKleNle2times1051 \\le K \\le N \\le 2 \\times 10^5
  • 0leM<2300 \\le M < 2^{30}
  • 0leAi<2300 \\le A_i < 2^{30}
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM KK A1A_1 A2A_2 dots\\dots ANA_N

Output

Print the answer.


Sample Input 1

4 8 2
1 2 4 8

Sample Output 1

10

If you do the following, the bitwise mathrmAND\\mathrm{AND} of the elements you choose will be 1010.

  • Perform the operation on A3A_3 six times. Now, A3=10A_3 = 10.
  • Perform the operation on A4A_4 twice. Now, A4=10A_4 = 10.
  • Choose A3A_3 and A4A_4, whose bitwise mathrmAND\\mathrm{AND} is 1010.

There is no way to choose two elements whose bitwise mathrmAND\\mathrm{AND} is greater than 1010, so the answer is 1010.


Sample Input 2

5 345 3
111 192 421 390 229

Sample Output 2

461