Problem: There are heaps of stone. The -th heap has stones. You want to change the number of stones in the heap by performing the following process once:
- You go through the heaps from the -rd heap to the -th heap, in this order.
- Let be the number of the current heap.
- You can choose a number (), move stones from the -th heap to the -th heap, and stones from the -th heap to the -th heap.
- So after that is decreased by , is increased by , and is increased by .
- You can choose different or same for different operations. Some heaps may become empty, but they still count as heaps.
What is the maximum number of stones in the smallest heap after the process?
Input Format: Each test contains multiple test cases. The first line contains the number of test cases (). Description of the test cases follows.
The first line of each test case contains a single integer ().
The second lines of each test case contains integers ().
It is guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case, print the maximum number of stones that the smallest heap can contain.
Note: In the first test case, the initial heap sizes are . We can move the stones as follows.
- move stones and from the -rd heap to the -nd and heap respectively. The heap sizes will be ;
- move stones and stones from the last heap to the -rd and -nd heap respectively. The heap sizes will be .
In the second test case, the last heap is , and we can not increase its size.
In the third test case, it is better not to move any stones.
In the last test case, the final achievable configuration of the heaps can be .