You are given an array A of N elements. You are required to determine the specialty of the array that is defined as:
Determine the Bitwise OR of the maximum and minimum elements of every subset of the size that are greater than or equal to 2 and add them.
As the answer can be large, you must print it by taking modulo with 1000000007.
Input format
Output format
For each query, you are required to print an integer denoting the specialty of the array.
Constraints
1≤N≤200000
1≤A[I]≤1000
Array contains 3 integers . Thus all subsets having size >= 2 are :-
{ { 2, 5 } , { 2 , 5} , {5 , 5} , {2 , 5 , 5 } } , thus bitwise OR of the maximum and minimum elements of those subsets are
{ 7 , 7 , 5 , 7 } respectively , thus summation of all is 7 + 7 + 5 + 7 = 26%1000000007 = 26 .