There are $n$ candies in a row, they are numbered from left to right from $1$ to $n$. The size of the $i$-th candy is $a_i$.

Alice and Bob play an interesting and tasty game: they eat candy. Alice will eat candy from left to right, and Bob — from right to left. The game ends if all the candies are eaten.

The process consists of moves. During a move, the player eats one or more sweets from her/his side (Alice eats from the left, Bob — from the right).

Alice makes the first move. During the first move, she will eat $1$ candy (its size is $a_1$). Then, each successive move the players alternate — that is, Bob makes the second move, then Alice, then again Bob and so on.

On each move, a player counts the total size of candies eaten during the current move. Once this number becomes strictly greater than the total size of candies eaten by the other player on their previous move, the current player stops eating and the move ends. In other words, on a move, a player eats the smallest possible number of candies such that the sum of the sizes of candies eaten on this move is strictly greater than the sum of the sizes of candies that the other player ate on the previous move. If there are not enough candies to make a move this way, then the player eats up all the remaining candies and the game ends.

For example, if $n=11$ and $a=[3,1,4,1,5,9,2,6,5,3,5]$, then:  move 1: Alice eats one candy of size $3$ and the sequence of candies becomes $[1,4,1,5,9,2,6,5,3,5]$.  move 2: Alice ate $3$ on the previous move, which means Bob must eat $4$ or more. Bob eats one candy of size $5$ and the sequence of candies becomes $[1,4,1,5,9,2,6,5,3]$.  move 3: Bob ate $5$ on the previous move, which means Alice must eat $6$ or more. Alice eats three candies with the total size of $1+4+1=6$ and the sequence of candies becomes $[5,9,2,6,5,3]$.  move 4: Alice ate $6$ on the previous move, which means Bob must eat $7$ or more. Bob eats two candies with the total size of $3+5=8$ and the sequence of candies becomes $[5,9,2,6]$.  move 5: Bob ate $8$ on the previous move, which means Alice must eat $9$ or more. Alice eats two candies with the total size of $5+9=14$ and the sequence of candies becomes $[2,6]$.  move 6 (the last): Alice ate $14$ on the previous move, which means Bob must eat $15$ or more. It is impossible, so Bob eats the two remaining candies and the game ends. 

Print the number of moves in the game and two numbers:  $a$ — the total size of all sweets eaten by Alice during the game;  $b$ — the total size of all sweets eaten by Bob during the game. 


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 5000$) — the number of test cases in the input. The following are descriptions of the $t$ test cases.

Each test case consists of two lines. The first line contains an integer $n$ ($1 \le n \le 1000$) — the number of candies. The second line contains a sequence of integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 1000$) — the sizes of candies in the order they are arranged from left to right.

It is guaranteed that the sum of the values of $n$ for all sets of input data in a test does not exceed $2\cdot10^5$.


-----Output-----

For each set of input data print three integers — the number of moves in the game and the required values $a$ and $b$.


-----Example-----
Input
7
11
3 1 4 1 5 9 2 6 5 3 5
1
1000
3
1 1 1
13
1 2 3 4 5 6 7 8 9 10 11 12 13
2
2 1
6
1 1 1 1 1 1
7
1 1 1 1 1 1 1

Output
6 23 21
1 1000 0
2 1 2
6 45 46
2 2 1
3 4 2
4 4 3

Difficulty: introductory

Starter code:

Solutions:
from fractions import Fraction
import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate


# sys.setrecursionlimit(200000)
# input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline


def input():
    return sys.stdin.readline().strip()


def iinput():
    return int(input())


def tinput():
    return input().split()


def rinput():
    return list(map(int, tinput()))


def rlinput():
    return list(rinput())


# mod = int(1e9)+7


def factors(n):
    return set(reduce(list.__add__,
                      ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))


# ----------------------------------------------------
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')
for _ in range(iinput()):
    n = iinput()
    a = rlinput()
    moves = 0
    i = 0
    j = n-1
    prev = 0
    ans1 = 0
    ans2 = 0
    while i <= j:
        temp = 0
        f = False
        while i<=j and i < n and temp <= prev:
            temp += a[i]
            f = True
            i += 1
        ans1 += temp
        if f:
            moves += 1
        prev = temp
        temp = 0
        f = False
        while j >= i and j > 0 and temp <= prev:
            temp += a[j]
            f = True
            j -= 1
        ans2 += temp
        if f:
            moves += 1
        prev = temp
    print(moves,ans1,ans2)


for _ in range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))
    s1, s2, last, q1, q2, flag = [], [], 0, 0, n-1, 0
    while q1 <= q2:
        sum1 = 0
        while sum1 <= last and q1 <= q2:
            if flag == 0:
                sum1 += a[q1]
                q1 += 1
            else:
                sum1 += a[q2]
                q2 -= 1
        if flag == 0:
            s1.append(sum1)
        else:
            s2.append(sum1)
        flag, last = 1-flag, sum1
    print(len(s1)+len(s2), sum(s1), sum(s2))


for t in range(int(input())):
    n = int(input())
    cand = list(map(int, input().split()))
    a = 0
    b = 0
    i = 0
    j = n - 1
    prev = 0
    moves = 0
    while i <= j:
        curr = 0
        while i <= j and curr <= prev:
            curr += cand[i]
            i += 1
        a += curr
        prev = curr
        moves += bool(curr)
        curr = 0
        while i <= j and curr <= prev:
            curr += cand[j]
            j -= 1
        b += curr
        prev = curr
        moves += bool(curr)
    print(moves, a, b)


t = int(input())
for _ in range(t):
    a = 0
    b = 0
    n = int(input())
    As = list(map(int,input().split()))
    left = 0
    right = n - 1

    a += As[0]
    left = 1
    min = As[0]

    curr = 0
    turn = False
    count = 1
    while left <= right:
        if turn:
            a += As[left]
            curr += As[left]
            left += 1
        else:
            b += As[right]
            curr += As[right]
            right -= 1
        if curr > min:
            count += 1
            min = curr
            curr = 0
            turn = not turn
    if curr != 0:
        count += 1
    print(count, a, b)


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	a, b = 0, 0
	la, lb = 0, 0
	i, j = 0, n-1
	rnds = 0
	while i <= j:
		ca = 0
		while i <= j and ca <= lb:
			ca += L[i]
			i += 1
		a += ca
		la = ca

		rnds += 1
		if i > j:
			break

		cb = 0
		while i <= j and cb <= la:
			cb += L[j]
			j -= 1
		b += cb
		lb = cb

		rnds += 1
	print(rnds, a, b)


from math import *

for zz in range(int(input())):
    n = int(input())
    a = [int(i) for i in input().split()]
    i = 0
    j = n - 1
    ans = 0
    ct = 0
    ps = 0
    x = 0
    y = 0
    while i <= j:
        cs= 0 
        if ct == 0:
            while i <= j and cs <= ps:
                cs += a[i]
                i += 1
            x += cs
        else:
            while i <= j and cs <= ps:
                cs += a[j]
                j -= 1
            y += cs
        ps = cs
        ct = 1 - ct
        ans += 1
    print(ans, x, y)


import math
for _ in range(int(input())):
	n=int(input())
	li=list(map(int,input().split()))
	a=0
	b=0
	l=0
	r=n-1
	p=0
	q=0
	while(l<=r):
		if q%2==0:
			su=0
			for i in range(l,r+1):
				l+=1
				su+=li[i]
				a+=li[i]
				if (su>p):
					p=su
					break
		else:
			su=0
			for i in range(r,l-1,-1):
				r-=1
				su+=li[i]
				b+=li[i]
				if (su>p):
					p=su
					break
		q+=1
	print(q,a,b)






	


t=int(input())
for i in range (t):
    n=int(input())
    A=[int(x) for x in input().split()]
    x=A[0]
    l=1
    r=n-1
    a=x
    b=0
    p=1
    while l<=r:
        p+=1
        c=0
        while c<=x and l<=r:
            c+=A[r]
            r-=1
        b+=c
        if c<=x or l>r:
            break
        x=c

        p+=1
        c=0
        while c<=x and l<=r:
            c+=A[l]
            l+=1
        a+=c
        if c<=x or l>r:
            break
        x=c

    print(p,a,b)

T = int(input())

for t in range(T):
    N = int(input())
    A = [int(_) for _ in input().split()]

    L = 0
    R = N-1
    turn = 0
    previous = 0
    alice = 0
    bob = 0
    moves = 0

    while L <= R:
        eaten = 0
        while eaten <= previous and L <= R:
            if turn == 0:
                eaten += A[L]
                alice += A[L]
                L += 1
            else:
                eaten += A[R]
                bob += A[R]
                R -= 1
        previous = eaten
        turn = 1 - turn
        moves += 1

    print(moves, alice, bob)


import sys


input()
for candies in sys.stdin.readlines()[1::2]:
    candies = [int(c) for c in candies.split()]
    a, b = 0, 0
    idxA, idxB, move = 0, len(candies) - 1, 0

    eaten = 0
    while idxA <= idxB:
        lastEaten = eaten
        eaten = 0
        if move & 1 == 0:
            while idxA <= idxB and eaten <= lastEaten:
                a += candies[idxA]
                eaten += candies[idxA]
                idxA += 1
        else:
            while idxB >= idxA and eaten <= lastEaten:
                b += candies[idxB]
                eaten += candies[idxB]
                idxB -= 1

        move += 1

    print(move, a, b)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return list(map(int, minp().split()))

def solve():
	n = mint()
	c = list(mints())
	l = 1
	r = n
	a = c[0]
	b = 0
	la = c[0]
	lb = 0
	ans = 1
	while l<r:
		x = 0
		ans += 1
		while x <= la and l < r:
			r -= 1
			x += c[r]
		lb = x
		b += x
		if l >= r:
			break
		ans += 1
		x = 0
		while x <= lb and l < r:
			x += c[l]
			l += 1
		la = x
		a += x
	print(ans, a, b)

for i in range(mint()):
	solve()


def solve(n, sizes):
    last = sizes[0]

    result = {'n_steps': 1,
              'a': last,
              'b': 0, }

    flag_a = 1     # next candy to eat
    flag_b = n - 1
    turn = 'b'

    if flag_a == flag_b + 1:
        return result

    while True:
        cur = 0
        result['n_steps'] += 1

        if flag_a == flag_b + 1:
            return result

        if turn == 'a':
            while cur <= last:
                cur += sizes[flag_a]
                result['a'] += sizes[flag_a]
                flag_a += 1
                if flag_a == flag_b + 1:
                    return result

            last = cur
            turn = 'b'
        else:
            while cur <= last:
                cur += sizes[flag_b]
                result['b'] += sizes[flag_b]
                flag_b -= 1
                if flag_a == flag_b + 1:
                    return result

            last = cur
            turn = 'a'


def main():
    tests = int(input())

    for t in range(tests):
        n = int(input())
        sizes = list(map(int, input().split()))
        result = solve(n, sizes)

        print(result['n_steps'], result['a'], result['b'])


main()


import sys
def input():
	return sys.stdin.readline()[:-1]

t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	if n == 1:
		print(1, c[0], 0)
		continue
	M = c[0]
	l, r = 1, n
	a, b = c[0], 0
	for i in range(1, 1000000):
		if i%2 == 0:
			a_tmp = 0
			while a_tmp <= M and l < r:
				a_tmp += c[l]
				a += c[l]
				l += 1
			if l == r:
				break
			M = a_tmp
		else:
			b_tmp = 0
			while b_tmp <= M and l < r:
				b_tmp += c[r-1]
				b += c[r-1]
				r -= 1
			if l == r:
				break
			M = b_tmp
	print(i+1, a, b)

for f in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    i=0
    j=n-1
    alice=0
    bob=0
    prev=0
    turn=0
    k=0
    while i<=j:
        cur=0
        if turn==0:
            while cur<=prev and i<=j:
                alice+=a[i]
                cur+=a[i]
                i+=1
        else:
            while cur<=prev and i<=j:
                bob+=a[j]
                cur+=a[j]
                j-=1
        k+=1
        turn=1-turn
        prev=cur
    print(k,alice,bob)

import sys
input = sys.stdin.readline

for t in range(int(input())):
    n = int(input())
    l = list(map(int,input().split()))
    a = l.pop(0); b = 0; move = 0; ad = a; bd = 0; able = True; count = 1
    while l:
        bd = 0
        while bd <= ad:
            bd += l.pop(-1)
            if l == []:
                able = False
                break
        b += bd; count += 1
        if able == False:
            break
        ad = 0
        while ad <= bd:
            ad += l.pop(0)
            if l == []:
                able = False
                break
        a += ad; count += 1
        if able == False:
            break
    print(count, a, b)


from _collections import deque

for _ in range(int(input())):
    n = int(input())
    ar = list(map(int, input().split()))
    ar = deque(ar)
    turn = 0
    a, b = 0, 0
    num2 = 0
    x = 0
    while ar:
        if turn == 0:
            num1 = 0
            while ar and num1 <= num2:
                num1 += ar[0]
                ar.popleft()
            a += num1
            num2 = num1
            turn = 1
        else:
            num1 = 0
            while ar and num1 <= num2:
                num1 += ar[-1]
                ar.pop()
            b += num1
            num2 = num1
            turn = 0
        x += 1
    print(x, a, b)


t = int(input())

for loop in range(t):

    n = int(input())

    lis = list(map(int,input().split()))

    ai = 0
    bi = n-1

    A = [0]
    B = [0]
    move = 0

    while True:

        if ai > bi:
            break

        na = 0
        while na <= B[-1]:

            if ai > bi:
                break

            na += lis[ai]
            ai += 1

        A.append(na)
        if na > 0:
            move += 1

        nb = 0
        while nb <= A[-1]:

            if ai > bi:
                break

            nb += lis[bi]
            bi -= 1
        B.append(nb)
        if nb > 0:
            move += 1

    print(move,sum(A),sum(B))