You are given a sequence A of size N and an integer K. Split the sequence into K contiguous non-empty groups. Every element of the sequence must belong to exactly one group.
Each group is written as two integers L and R, meaning that the L-th number through the R-th number belong to that group. The score of a group is the bitwise OR of every element in it.
The OR score of the sequence is the sum of the scores of all groups.
Write a program that splits the sequence into K contiguous non-empty groups and finds the maximum OR score of the sequence.
Input
The first line contains N and K. (1≤N≤5000, 1≤K≤N)
The second line contains the elements of the sequence A1,A2,…,AN, separated by spaces. (0≤Ai≤230)
Output
Print the maximum OR score of the sequence.
Hint
In the first example, splitting into (1,2) and (2) scores (1 OR 2)+2=3+2=5.
In the second example, splitting into (1,2), (3), (4) scores (1 OR 2)+3+4=3+3+4=10.
In the third example, the only possible split is (1) and (2).