couple of realize that Pan and Apollo weren't just engaging for the title of the GOAT performer. A couple of millenniums later, they likewise tested each other in math (or rather in quick estimations). The errand they got to address is the accompanying: Let x1,x2,… ,xn be the arrangement of n non-negative integers. Track down this worth:
Correct answer will be upvoted else Multiple Downvoted. Computer science.
couple of realize that Pan and Apollo weren't just engaging for the title of the GOAT performer. A couple of millenniums later, they likewise tested each other in math (or rather in quick estimations). The errand they got to address is the accompanying:
Let x1,x2,… ,xn be the arrangement of n non-negative integers. Track down this worth:
∑i=1n∑j=1n∑k=1n(xi&xj)⋅(xj|xk)
Here and means the bitwise and, and | indicates the bitwise or.
Skillet and Apollo could tackle this in no time flat. Would you be able to do it as well? For comfort, find the appropriate response modulo 109+7.
Input
The principal line of the input contains a solitary integer t (1≤t≤1000) indicating the number of experiments, then, at that point, t experiments follow.
The main line of each experiment comprises of a solitary integer n (1≤n≤5⋅105), the length of the succession. The subsequent one contains n non-negative integers x1,x2,… ,xn (0≤xi<260), components of the grouping.
The amount of n over all experiments won't surpass 5⋅105.
Output
Print t lines. The I-th line ought to contain the response to the I-th text case.
Step by step
Solved in 4 steps with 1 images