There are $N$ cars (numbered $1$ through $N$) on a circular track with length $N$. For each $i$ ($2 \le i \le N$), the $i$-th of them is at a distance $i-1$ clockwise from car $1$, i.e. car $1$ needs to travel a distance $i-1$ clockwise to reach car $i$. Also, for each valid $i$, the $i$-th car has $f_i$ litres of gasoline in it initially.
You are driving car $1$ in the clockwise direction. To move one unit of distance in this direction, you need to spend $1$ litre of gasoline. When you pass another car (even if you'd run out of gasoline exactly at that point), you steal all its gasoline. Once you do not have any gasoline left, you stop.
What is the total clockwise distance travelled by your car? 
-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $f_1, f_2, \ldots, f_N$.
-----Output-----
For each test case, print a single line containing one integer ― the total clockwise distance travelled.
-----Constraints-----
- $1 \le T \le 100$
- $1 \le N \le 100$
- $0 \le f_i \le 100$ for each valid $i$
-----Subtasks-----
Subtask #1 (100 points): original constraints
-----Example Input-----
3
5
3 0 0 0 0
5
1 1 1 1 1
5
5 4 3 2 1
-----Example Output-----
3
5
15
# cook your dish here
for t in range(int(input())):
  N = int(input())
  f = list(map(int, input().split()))
  gas = f[0]
  distance = 0
  for _ in range(1, N):
    if gas == 0:
      break
    gas = gas - 1 + f[_]
    distance += 1
  print(distance + gas) 

# cook your dish here
for t in range(int(input())):
  N = int(input())
  f = list(map(int, input().split()))
  gas = f[0]
  distance = 0
  for _ in range(1, N):
    if gas == 0:
      break
    gas = gas - 1 + f[_]
    distance += 1
  print(distance + gas) 
