human
There are n heaps of stone. The i-th heap has h_i 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 3-rd heap to the n-th heap, in this order. 
  * Let i be the number of the current heap. 
  * You can choose a number d (0 ≤ 3 ⋅ d ≤ h_i), move d stones from the i-th heap to the (i - 1)-th heap, and 2 ⋅ d stones from the i-th heap to the (i - 2)-th heap. 
  * So after that h_i is decreased by 3 ⋅ d, h_{i - 1} is increased by d, and h_{i - 2} is increased by 2 ⋅ d. 
  * You can choose different or same d 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

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 2⋅ 10^5). Description of the test cases follows.

The first line of each test case contains a single integer n (3 ≤ n ≤ 2 ⋅ 10^5).

The second lines of each test case contains n integers h_1, h_2, h_3, …, h_n (1 ≤ h_i ≤ 10^9).

It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case, print the maximum number of stones that the smallest heap can contain.

Example

Input

4
4
1 2 10 100
4
100 100 100 1
5
5 1 1 1 8
6
1 2 3 4 5 6

Output

7
1
1
3

Note

In the first test case, the initial heap sizes are [1, 2, 10, 100]. We can move the stones as follows. 

  * move 3 stones and 6 from the 3-rd heap to the 2-nd and 1 heap respectively. The heap sizes will be [7, 5, 1, 100].

  * move 6 stones and 12 stones from the last heap to the 3-rd and 2-nd heap respectively. The heap sizes will be [7, 17, 7, 82]. 


In the second test case, the last heap is 1, 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 [3, 5, 3, 4, 3, 3].
#!/us ... Write me a Python program to print the maximum number of stones that the smallest heap can contain?
assistant
#Here is Python program to print the maximum number of stones that the smallest heap can contain.
r/bin/env python
from __future__ import division, print_function
from collections import defaultdict

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def chk(m,um,mc,umc):
    ans=float("Inf")
    if(m<0 or um<0 or mc<0 or umc<0):
        return ans
    if(m%2==1 and mc==1+m-mc):
        ans=min(ans,m)
    if(um%2==0 and umc==um-umc):
        ans=min(ans,um)
    return ans

from types import GeneratorType

def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        else:
            to = f(*args, **kwargs)
            while True:
                if type(to) is GeneratorType:
                    stack.append(to)
                    to = next(to)
                else:
                    stack.pop()
                    if not stack:
                        break
                    to = stack[-1].send(to)
            return to

    return wrappedfunc

@bootstrap
def dfs(i,g,vis,color,count):
    vis[i]=True
    contains=False
    for j in g[i]:
        if(not vis[j]):
            x=yield dfs(j,g,vis,color,count)
            count[i]+=x
            if(x==0):
                contains=True
    if(contains==False and color[i]==0):
        count[i]=1
    else:
        count[i]=0
    yield count[i]
@bootstrap
def dfs1(i,g,vis,count,g1):
    vis[i]=True
    ans=1
    for j in g[i]:
        if(not vis[j]):
            g1[i].append(j)
            x=yield dfs1(j,g,vis,count,g1)
            ans+=x
    count[i]=ans
    yield ans
@bootstrap
def dfs2(g1,i,vis):
    vis[i]=True
    for j in g1[i]:
        yield dfs2(g1,j,vis)
    yield 0
class FenwickTree:
    def __init__(self, x):
        """transform list into BIT"""
        self.bit = x
        for i in range(len(x)):
            j = i | (i + 1)
            if j < len(x):
                x[j] += x[i]

    def update(self, idx, x):
        """updates bit[idx] +=...