A main street in Bali has N sculptures on it, numbered 1 to N in order along the street. Sculpture i is Yi years old, that is, it was made Yi 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:
Find the smallest beauty that a valid split can reach.
The bitwise OR of two non-negative integers P and Q 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:
The first line contains the integers N, A and B, separated by spaces. The second line contains the ages Y1,Y2,…,YN, separated by spaces.
Print the minimum possible beauty on a single line.
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.