You are given $$$t$$$ independent test cases. In each test case, you are given an array of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$.
You can perform the following operation at most once for each integer $$$k$$$ such that $$$2^k \le n$$$:
Your task is to determine the minimum possible sum of the array elements after performing these operations optimally, given that for each valid $$$k$$$, the corresponding operation may be performed at most once (and possibly not at all).
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^5)$$$ — the number of test cases.
Each test case consists of two lines:
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, print a single integer — the minimum sum of the array that can be obtained after performing the operations optimally.
511041 5 4 559 4 9 5 223 313
10 6 28 1 2