

215 means value 5 is in position 1 at depth 2.
The maximum depth allowed is 4, i.e. the maximum number of positions can be 8 ( or 2 ^ (4 - 1)).
The first line of the input contains ‘T’ denoting the number of test cases.
The first line of each test case contains an integer ‘N’, representing the length of the array.
The second line of each test case contains N space-separated integers of the array A.
For each test case print a single line containing a single integer denoting the sum of all paths from the root node.
The output of each test case is printed on a new line.
1 <= T <= 10
1 <= N <= 150
100 <= A[i] <= 999
1 <= D <= 4
1 <= P <= 8
0 <= V <= 9
Where ‘T’ denotes the number of test cases and 'N' denotes the length of array 'A'.
Time limit: 1 sec.
Explanation:
Algorithm: