AND Array
An integer and an array of non-negative integers are given. All elements of the array are less than .
Let's define (, ) as the result of the following pseudocode:
res = 0 x = power(2, p) for i = s to n: if ((x AND a[i]) == 0): x = (x OR a[i]) res = res + i return res
Here, "power(2, p)" denotes , "AND" denotes the bitwise AND operation, and "OR" denotes the bitwise OR operation.
The bitwise AND of non-negative integers and is equal to a non-negative integer, in which the binary representation has a one at a certain position only if both binary representations of and have ones at that position. For example, AND AND .
The bitwise OR of non-negative integers and is equal to a non-negative integer, in which the binary representation has a zero at a certain position only if both binary representations of and have zeros at that position. For example, OR OR .
For each from to , find
Input
The first line contains two integers and (, ) — the length of array and the limit on the elements of the array, respectively.
The second line contains integers () — the elements of array .
Output
Output integers — the required values.
Examples
Note
In the first example, , , , and the first of the required values is equal to .
Scoring
( points): ;
( points): , where is an integer;
( points): ;
( points): ;
( points): ;
( points): without additional constraints.