Bali Sculptures

No attempts yetTime limit1sMemory limit64 MB

Problem

A main street in Bali has NN sculptures on it, numbered 1 to NN in order along the street. Sculpture ii is YiY_i years old, that is, it was made YiY_i years ago. To make the street prettier, the government wants to split the sculptures into groups and plant trees between neighbouring groups.

The rules for splitting the sculptures are:

  • The sculptures are split into exactly XX groups, where AXBA \le X \le B. Every group holds at least one sculpture, and every sculpture belongs to exactly one group. The sculptures of one group must be consecutive along the street.
  • For each group, add up the ages of the sculptures in that group.
  • Take the bitwise OR of all the group sums. That value is the beauty of the split.

Find the smallest beauty that a valid split can reach.

The bitwise OR of two non-negative integers PP and QQ is computed like this. Write both numbers in binary and pad the shorter one with leading zeros so that the two lengths match. Each bit of the result is decided by the two bits in the same position:

  • 0 OR 0 = 0
  • 0 OR 1 = 1
  • 1 OR 0 = 1
  • 1 OR 1 = 1

Input

The first line contains the integers NN, AA and BB, separated by spaces. The second line contains the ages Y1,Y2,,YNY_1, Y_2, \dots, Y_N, separated by spaces.

  • 1N20001 \le N \le 2000
  • 1ABN1 \le A \le B \le N
  • 0Yi10000000000 \le Y_i \le 1000000000
  • If NN is greater than 100, then A=1A = 1.

Output

Print the minimum possible beauty on a single line.

Hint

In the first example the sculptures are split into (8 1 2) and (1 5 4). The group sums are 11 and 10, and their bitwise OR is 11.