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

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
for i in range(int(input())):
	a = input()
	bi = input().split()
	l = []
	for k in bi:
		l.append(int(k))
	alice = l[0]
	bob = 0
	a = l[0]
	l.pop(0)
	b = 0
	j = 1
	while len(l) != 0:
		temp = 0
		n = 0
		m = len(l) - 1
		if j % 2 == 0:
			if sum(l) > b:
				while temp <= b:
					temp += l[n]
					l.pop(n)
				a = temp
				alice += temp
			else:
				a += sum(l)
				alice += sum(l)
				j += 1
				break
		elif sum(l) > a:
			while temp <= a:
				temp += l[m]
				l.pop(m)
				m -= 1
			b = temp
			bob += temp
		else:
			b += sum(l)
			bob += sum(l)
			j += 1
			break
		j += 1
	print(j, alice, bob)


from sys import stdin

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	total = [0, 0]
	current = [0, 0]
	pos = [1, n - 1]
	turns = 0
	flag = False
	for i in range(n):
		if i == 0:
			current[0] = a[0]
			total[0] += a[0]
		elif i % 2 == 1:
			while True:
				if pos[1] < pos[0]:
					flag = True
					break
				if current[1] > current[0]:
					current[0] = 0
					break
				current[1] += a[pos[1]]
				total[1] += a[pos[1]]
				pos[1] -= 1
		elif i % 2 == 0:
			while True:
				if pos[0] > pos[1]:
					flag = True
					break
				if current[0] > current[1]:
					current[1] = 0
					break
				current[0] += a[pos[0]]
				total[0] += a[pos[0]]
				pos[0] += 1
		turns += 1
		if flag:
			break
	print(turns, end=' ')
	print(*total)


for _ in range(int(input())):
	n = int(input())
	l = [*map(int, input().split())]
	low = 0
	high = n - 1
	x = 0
	val = 0
	val1 = 0
	prefix = 0
	while low <= high:
		if not x & 1:
			temp = 0
			while prefix >= temp and low <= high:
				temp += l[low]
				low += 1
			prefix = temp
			val += temp
		else:
			temp = 0
			while prefix >= temp and low <= high:
				temp += l[high]
				high -= 1
			prefix = temp
			val1 += temp
		x += 1
	print(x, val, val1)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	dq = deque(list(map(int, input().split())))
	cnt = prev = end = a = b = 0
	while len(dq) > 0:
		cur = 0
		while len(dq) > 0 and cur <= prev:
			x = dq.pop() if end else dq.popleft()
			cur += x
		if end:
			b += cur
		else:
			a += cur
		end ^= 1
		cnt += 1
		prev = cur
	print(cnt, a, b)


def readStr():
	return input()

def readInts():
	return list(map(int, readStr().split(' ')))

def main(n, a):
	prev = 0
	this = 0
	idx = [0, n - 1]
	val = [0, 0]
	i = 0
	while idx[0] <= idx[1]:
		this += a[idx[i % 2]]
		if i % 2 == 0:
			idx[0] += 1
		else:
			idx[1] -= 1
		if this > prev:
			val[i % 2] += this
			prev = this
			this = 0
			i += 1
	if this > 0:
		val[i % 2] += this
		i += 1
	return (i, val[0], val[1])
(t,) = readInts()
for _ in range(t):
	(n,) = readInts()
	a = readInts()
	print(*main(n, a))


t = int(input())
from collections import deque
for _ in range(t):
	n = int(input())
	sizes = deque(map(int, input().split()))
	alice = 0
	bob = 0
	moves = 0
	last_round = 0
	while sizes:
		if moves == 0:
			moves += 1
			alice += sizes.popleft()
			last_round = alice
			if len(sizes) == 0:
				break
			continue
		if moves % 2 == 1:
			temp = 0
			while temp <= last_round and sizes:
				temp += sizes.pop()
			last_round = temp
			moves += 1
			bob += temp
			if len(sizes) == 0:
				break
			continue
		if moves % 2 == 0:
			temp = 0
			while temp <= last_round and sizes:
				temp += sizes.popleft()
			last_round = temp
			moves += 1
			alice += temp
			if len(sizes) == 0:
				break
			continue
	print(moves, alice, bob)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	sa = sb = 0
	a = 0
	b = 0
	t = 1
	l = 0
	r = n - 1
	x = 0
	while r >= l:
		x += 1
		if t == 1:
			a = 0
			while a <= b and l <= r:
				a += arr[l]
				sa += arr[l]
				l += 1
		else:
			b = 0
			while b <= a and r >= l:
				b += arr[r]
				sb += arr[r]
				r -= 1
		t *= -1
	print(x, sa, sb)


inp = lambda : map(int, input().split())
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(inp())
	(r, a, b) = (0, 0, 0)
	(ta, tb) = (0, 0)
	i = 0
	j = -1
	while True:
		if len(l) == 0:
			break
		if i == 0:
			ta = l[i]
			a += l[i]
			del l[i]
			r += 1
			i += 1
			continue
		if tb <= ta and r % 2 != 0:
			tb += l[j]
			b += l[j]
			del l[j]
			if tb > ta:
				r += 1
				ta = 0
			if tb <= ta and len(l) == 0:
				r += 1
				break
			continue
		if tb >= ta and r % 2 == 0:
			ta += l[i - 1]
			a += l[i - 1]
			del l[i - 1]
			if tb < ta:
				r += 1
				tb = 0
			if tb >= ta and len(l) == 0:
				r += 1
				break
			continue
	print(r, a, b)


N = int(input())
for _ in range(N):
	l = []
	n = int(input())
	s = list(map(int, input().split()))
	c = 0
	a = 0
	b = 0
	l = 0
	k = 0
	r = n - 1
	ans = 0
	while l <= r:
		if c == 0:
			z = 0
			while l <= r:
				a += s[l]
				z += s[l]
				l += 1
				if z > k:
					k = z
					break
			c = 1
		else:
			z = 0
			while l <= r:
				b += s[r]
				z += s[r]
				r -= 1
				if z > k:
					k = z
					break
			c = 0
		ans += 1
	print(ans, a, b)


def alice_eats(arrangement, alice_count, bob_last, done, alice_now, bob_now):
	now_count = 0
	for element in range(alice_now, bob_now + 1):
		if (now_count <= bob_last or now_count == 0) and alice_now <= bob_now:
			now_count += arrangement[element]
			alice_now = element + 1
		else:
			if alice_now > bob_now:
				done = 1
			break
	alice_last = now_count
	alice_count += now_count
	return (alice_count, alice_last, done, alice_now, bob_now)

def bob_eats(arrangement, bob_count, alice_last, done, alice_now, bob_now):
	now_count = 0
	for element in range(bob_now, alice_now - 1, -1):
		if now_count <= alice_last and alice_now <= bob_now:
			now_count += arrangement[element]
			bob_now = element - 1
		else:
			if alice_now > bob_now:
				done = 1
			break
	bob_count += now_count
	bob_last = now_count
	return (bob_count, bob_last, done, alice_now, bob_now)
for _ in range(int(input())):
	number = input()
	arrangement = list(map(int, input().split()))
	(alice_count, bob_count) = (0, 0)
	(alice_last, bob_last) = (0, 0)
	(alice_now, bob_now) = (0, len(arrangement) - 1)
	done = 0
	count = 0
	while not done and count < len(arrangement):
		(alice_count, alice_last, done, alice_now, bob_now) = alice_eats(arrangement, alice_count, bob_last, done, alice_now, bob_now)
		count += 1
		if done or bob_now < alice_now:
			break
		(bob_count, bob_last, done, alice_now, bob_now) = bob_eats(arrangement, bob_count, alice_last, done, alice_now, bob_now)
		count += 1
		if done or bob_now < alice_now:
			break
	print(count, alice_count, bob_count)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	candies = deque(map(int, input().split()))
	last = 0
	turn = 0
	a = 0
	b = 0
	turns = 0
	while candies:
		turns += 1
		eaten = 0
		if turn == 0:
			turn = 1
			while candies and eaten <= last:
				eaten += candies.popleft()
			a += eaten
			last = eaten
		else:
			turn = 0
			while candies and eaten <= last:
				eaten += candies.pop()
			b += eaten
			last = eaten
	print(turns, a, b)


import collections
t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	de = collections.deque(s)
	(a, b, c) = (0, 0, 0)
	prev = 0
	while True:
		if len(de) == 0:
			break
		count = 0
		if a % 2 == 0:
			while count <= prev and len(de) > 0:
				b += de[0]
				count += de[0]
				de.popleft()
		else:
			while count <= prev and len(de) > 0:
				c += de[len(de) - 1]
				count += de[len(de) - 1]
				de.pop()
		a += 1
		prev = count
	print(a, b, c)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	movecount = 0
	bre = 0
	ta = 0
	tb = 0
	val = arr[0]
	atotal = 0
	ta = arr[0]
	movecount += 1
	ap = 1
	bp = len(arr) - 1
	btotal = 0
	ta = arr[0]
	flag = 1
	moves = 1
	while bre == 0:
		if movecount < len(arr):
			if flag == 0 and movecount < len(arr):
				while atotal <= val and movecount < len(arr):
					atotal += arr[ap]
					ta += arr[ap]
					ap += 1
					movecount += 1
				if atotal > val:
					val = atotal
					atotal = 0
					btotal = 0
				flag = 1
				moves += 1
			elif flag == 1 and movecount < len(arr):
				while btotal <= val and movecount < len(arr):
					btotal += arr[bp]
					tb += arr[bp]
					bp -= 1
					movecount += 1
				if btotal > val:
					val = btotal
					btotal = 0
					atotal = 0
				flag = 0
				moves += 1
		else:
			bre = 1
	print(moves, ta, tb)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	i = 0
	c = 0
	alice = 0
	bob = 0
	while True:
		if not a:
			break
		current = 0
		c += 1
		for (xi, x) in enumerate(a):
			current += x
			alice += x
			if current > i:
				i = current
				break
		a = a[xi + 1:]
		if not a:
			break
		c += 1
		current = 0
		for (xi, x) in reversed(list(enumerate(a))):
			current += x
			bob += x
			del a[xi]
			if current > i:
				i = current
				break
		a = a[:xi]
	print(c, alice, bob)


def main():
	n = int(input())
	candies = list(map(int, input().split()))
	left = 0
	right = n - 1
	alice = 0
	a = 0
	b = 0
	bob = 0
	flag = 0
	moves = 0
	while left <= right:
		if flag == 0:
			while alice <= bob and left <= right:
				alice += candies[left]
				a += candies[left]
				left += 1
			flag = 1
			bob = 0
		else:
			while bob <= alice and left <= right:
				bob += candies[right]
				b += candies[right]
				right -= 1
			flag = 0
			alice = 0
		moves += 1
	print(moves, a, b)
t = int(input())
for _ in range(t):
	main()


import collections

def solve(n, arr):
	(totalMoves, a, b) = (0, 0, 0)

	def go(left, right, alexTurn, prev):
		nonlocal totalMoves, a, b
		if left > right:
			return
		if alexTurn:
			currSum = 0
			while left < n and left <= right and (currSum <= prev):
				currSum += arr[left]
				left += 1
			totalMoves += 1
			a += currSum
			go(left, right, not alexTurn, currSum)
		else:
			currSum = 0
			while right >= 0 and left <= right and (currSum <= prev):
				currSum += arr[right]
				right -= 1
			totalMoves += 1
			b += currSum
			go(left, right, not alexTurn, currSum)
	go(0, n - 1, True, 0.1)
	return ' '.join(map(str, [totalMoves, a, b]))
t = int(input().strip())
for i in range(t):
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	print(solve(n, arr))


from math import ceil
from queue import LifoQueue

def print_sol(c, sol):
	print('Case #{}: {}'.format(c, sol))

def rd_int():
	return int(input())

def rd_str():
	return input()

def rd_str_lst():
	return input().split(' ')

def sp_str_lst():
	return list(input())

def rd_int_lst():
	return [int(i) for i in rd_str_lst()]

def sp_int_lst():
	return [int(i) for i in sp_str_lst()]

def dfs(g, i, v):
	v[i] = True
	for j in g[i]:
		if not v[j]:
			dfs(g, j, v)
	print(i)

def dfs_iter(g, i, n):
	v = [False] * n
	stack = LifoQueue()
	stack.put(i)
	while stack.not_empty:
		u = stack.get()
		v[u] = True
		print(u)
		for i in g[u]:
			if not v[i]:
				stack.put(i)

def hapi(g, i, d, va, da, sa):
	va[i] = True
	d += 1
	da[i] = d
	sa[i] = 1
	for j in g[i]:
		if not va[j]:
			hapi(g, j, d, va, da, sa)
			sa[i] += sa[j]

def hapi_iter(g, i, n):
	va = [False] * n
	da = [0] * n
	sa = [0] * n
	stack = LifoQueue()
	stack.put(i)
	while stack.not_empty:
		u = stack.get()
		va[u] = True
		print(u)
		for i in g[u]:
			if not va[i]:
				stack.put(i)

def main():
	t = rd_int()
	for c in range(1, t + 1):
		n = rd_int()
		a = rd_int_lst()
		f = True
		i = 0
		j = 0
		l = 0
		sa = 0
		sb = 0
		m = 0
		while i + j < n:
			s = 0
			if f:
				while s <= l and i + j < n:
					i += 1
					s += a[i - 1]
				sa += s
			else:
				while s <= l and i + j < n:
					j += 1
					s += a[n - j]
				sb += s
			l = s
			m += 1
			f = not f
		print(m, sa, sb)
main()


t = int(input())
for q in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	a = arr[0]
	totala = arr[0]
	i = 0
	j = n
	b = 0
	totalb = 0
	turn = 'a'
	turns = 1
	while i + 1 != j:
		if turn == 'a' and a <= b:
			i += 1
			a += arr[i]
			totala += arr[i]
		elif turn == 'a' and a > b:
			turn = 'b'
			b = 0
			turns += 1
		elif turn == 'b' and b <= a:
			j -= 1
			b += arr[j]
			totalb += arr[j]
		elif turn == 'b' and b > a:
			turn = 'a'
			a = 0
			turns += 1
	print(turns, totala, totalb)


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)


test = int(input())
for i in range(test):
	total_elements = int(input())
	input_list = list(map(int, input().split()))
	alice_list = []
	alice_list.append(input_list[0])
	bob_list = []
	i = 1
	j = total_elements - 1
	sum = input_list[0]
	counter = 1
	while i <= j:
		if counter % 2 != 0 and i <= j:
			inside = 0
			while inside <= sum and i <= j:
				inside += input_list[j]
				bob_list.append(input_list[j])
				j -= 1
			sum = inside
			counter += 1
		if counter % 2 == 0 and i <= j:
			inside = 0
			while inside <= sum and i <= j:
				inside += input_list[i]
				alice_list.append(input_list[i])
				i += 1
			sum = inside
			counter += 1
	alice_sum = 0
	bob_sum = 0
	for x in alice_list:
		alice_sum += x
	for x in bob_list:
		bob_sum += x
	print(counter, alice_sum, bob_sum)


from math import gcd, ceil
from collections import defaultdict as dd

def lcm(a, b):
	return a * b // gcd(a, b)

def inin():
	return int(input())

def inar():
	return list(map(int, input().split()))

def ar(element, size):
	return [element for i in range(size)]

def digitsum(num):
	su = 0
	while num:
		su += num % 10
		num //= 10
	return su

def pred(n, k, pointer):
	return pointer - k >= n
for i in range(inin()):
	n = inin()
	arr = inar()
	move = 1
	alice = 0
	bob = 0
	aliceprev = 0
	bobprev = 0
	while arr:
		if move % 2 == 1:
			aliceprev = 0
			while arr and aliceprev <= bobprev:
				aliceprev += arr.pop(0)
			alice += aliceprev
			move += 1
		else:
			bobprev = 0
			while arr and bobprev <= aliceprev:
				bobprev += arr.pop()
			bob += bobprev
			move += 1
	print(move - 1, alice, bob)


from math import *
from sys import stdin, stdout
input = stdin.buffer.readline
t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	i = 1
	j = n - 1
	alice = a[0]
	bob = 0
	al = a[0]
	bo = 0
	ans = 1
	while i <= j:
		while i <= j and bo <= al:
			bo += a[j]
			j -= 1
		bob += bo
		al = 0
		if i <= j:
			ans += 2
		else:
			ans += 1
		while i <= j and al <= bo:
			al += a[i]
			i += 1
		alice += al
		bo = 0
	print(ans, alice, bob)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(1, l[0], 0)
		continue
	moves = 0
	ptr1 = -1
	prev1 = 0
	ptr2 = n
	prev2 = 0
	chance = True
	while ptr1 + 1 < ptr2:
		moves += 1
		if chance:
			prev1 = 0
			while prev1 <= prev2 and ptr1 < ptr2:
				if ptr1 + 1 < ptr2:
					ptr1 += 1
					prev1 += l[ptr1]
				else:
					break
			chance = False
		else:
			prev2 = 0
			while prev2 <= prev1 and ptr1 < ptr2:
				if ptr1 < ptr2 - 1:
					ptr2 -= 1
					prev2 += l[ptr2]
				else:
					break
			chance = True
	print(moves, sum(l[0:ptr1 + 1]), sum(l[ptr2:]))


def solve(n, arr):
	(a, b) = (0, 0)
	idx1 = 0
	idx2 = n - 1
	prev = 0
	move = 0
	while True:
		cur = 0
		move += 1
		while idx1 <= idx2 and cur <= prev:
			cur += arr[idx1]
			idx1 += 1
		a += cur
		if idx1 > idx2:
			break
		prev = cur
		cur = 0
		move += 1
		while idx1 <= idx2 and cur <= prev:
			cur += arr[idx2]
			idx2 -= 1
		b += cur
		if idx1 > idx2:
			break
		prev = cur
	print(move, a, b)
t = int(input())
for i in range(0, t):
	n = int(input())
	arr = list(map(int, input().split()))
	solve(n, arr)


for i in range(int(input())):
	n = int(input())
	a = [int(a) for a in input().split()]
	prev = moves = 0
	total = [0, 0]
	while len(a) != 0:
		moves += 1
		cur = 0
		while len(a) != 0 and cur <= prev:
			cur += a[0]
			a.remove(a[0])
		total[moves % 2] += cur
		prev = cur
		a.reverse()
	print(moves, total[1], total[0])


def candies(data):
	i = 1
	a = data.pop(0)
	alice = a
	b = 0
	bob = 0
	while data:
		if i % 2 != 0:
			while b <= a:
				if data:
					b += data.pop()
				else:
					break
			bob += b
			a = 0
		else:
			while a <= b:
				if data:
					a += data.pop(0)
				else:
					break
			alice += a
			b = 0
		i += 1
	print(i, alice, bob)
n = int(input())
for i in range(n):
	x = int(input())
	candies(list(map(int, input().split())))


def eat_candies(candy: list) -> None:
	new_li = candy
	alice = 0
	bob = 0
	turn = True
	previous = 0
	turns = 0
	length = len(new_li)
	while length > 0:
		if turn:
			current = 0
			while current <= previous:
				if len(new_li) == 0:
					break
				temp = new_li.pop(0)
				current += temp
			previous = current
			alice += current
			turn = False
			turns += 1
		else:
			current = 0
			while current <= previous:
				if len(new_li) == 0:
					break
				temp = new_li.pop(-1)
				current += temp
			previous = current
			bob += current
			turn = True
			turns += 1
		length = len(new_li)
	print(turns, alice, bob)

def main():
	cases = int(input())
	for _ in range(cases):
		input()
		li = [int(x) for x in input().split(' ')]
		eat_candies(li)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ar = a[0:]
	ar.reverse()
	sumi = sum(a)
	(ts, s1, s2, k, l, cnt) = (0, 0, 0, 0, 0, 0)
	(sm1, sm2, count) = (0, 0, 0)
	for j in range(n):
		(s1, s2) = (0, 0)
		while s1 <= ts:
			if cnt == len(a):
				break
			s1 = s1 + a[k]
			k = k + 1
			cnt = cnt + 1
		ts = s1
		sm1 = sm1 + ts
		count = count + 1
		if cnt == len(a):
			break
		while s2 <= ts:
			if cnt == len(a):
				break
			s2 = s2 + ar[l]
			l = l + 1
			cnt = cnt + 1
		ts = s2
		sm2 = sm2 + ts
		count = count + 1
		if cnt == len(a):
			break
		if ts == sumi:
			break
	print(count, sm1, sm2)


t = int(input())
e = 10 ** 9 + 7
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	last_a = 0
	last_b = 0
	total_a = 0
	total_b = 0
	i = 0
	j = n - 1
	while i <= j:
		if not x % 2:
			x += 1
			m = 0
			while i <= j and m <= last_b:
				m += l[i]
				i += 1
			total_a += m
			last_a = m
		else:
			x += 1
			m = 0
			while j >= i and m <= last_a:
				m += l[j]
				j -= 1
			total_b += m
			last_b = m
	print(x, total_a, total_b)


for _ in range(int(input())):
	n = int(input())
	M = list(map(int, input().split()))
	(A, B) = (0, 0)
	b = 0
	count = 0
	size = n
	while M:
		a = 0
		i = 0
		while a <= b:
			a += M[i]
			i += 1
			size -= 1
			if size == 0:
				break
		A += a
		del M[0:i]
		count += 1
		if size == 0:
			break
		b = 0
		j = 0
		while b <= a:
			b += M[-j - 1]
			j += 1
			size -= 1
			if size == 0:
				break
		count += 1
		del M[-j:]
		B += b
	print(count, A, B)


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	(c, a, b) = (0, 0, 0)
	(ll, rr) = (0, 0)
	(i, j) = (0, n - 1)
	while i <= j:
		if c % 2 == 1:
			r = 0
			while r <= ll and i <= j:
				r += x[j]
				j -= 1
			b += r
			rr = r
		else:
			l = 0
			while l <= rr and i <= j:
				l += x[i]
				i += 1
			a += l
			ll = l
		c += 1
	print(c, a, b)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	a = 0
	b = 0
	aprev = 0
	bprev = 0
	i = 0
	j = n - 1
	turn = 0
	ans = 0
	while i <= j:
		if turn == 0:
			s = 0
			t = 0
			for k in range(i, j + 1):
				s += arr[k]
				t += 1
				if s > bprev:
					break
			aprev = s
			a += s
			ans += 1
			i += t
			turn = 1
		else:
			s = 0
			t = 0
			for k in range(j, i - 1, -1):
				s += arr[k]
				t += 1
				if s > aprev:
					break
			bprev = s
			b += s
			ans += 1
			j -= t
			turn = 0
	print(ans, a, b)


for _ in range(int(input())):
	n = int(input())
	q = [int(x) for x in input().split()]
	(left, right) = (0, n - 1)
	moves = 0
	prev_a = prev_b = a = b = 0
	flag = True
	while left <= right:
		if flag:
			prev_a = 0
			while prev_a <= prev_b and left <= right:
				prev_a += q[left]
				left += 1
			a += prev_a
		else:
			prev_b = 0
			while prev_b <= prev_a and left <= right:
				prev_b += q[right]
				right -= 1
			b += prev_b
		moves += 1
		flag = not flag
	print(moves, a, b)


try:
	for _ in range(int(input())):
		m = int(input())
		l = list(map(int, input().split()))
		alscore = l[0]
		bscore = 0
		mcount = 1
		i = 1
		j = len(l) - 1
		x = l[0]
		y = 0
		while i <= j:
			while bscore <= alscore and i <= j:
				bscore += l[j]
				j = j - 1
			alscore = 0
			if j < i:
				mcount += 1
				y = y + bscore
				break
			mcount += 1
			while alscore <= bscore and i <= j:
				alscore += l[i]
				i += 1
			mcount += 1
			x = x + alscore
			y = y + bscore
			bscore = 0
		print('{} {} {}'.format(mcount, x, y))
except KeyboardInterrupt:
	pass


for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	A = 0
	B = 0
	move = 0
	prev = 0
	f = 0
	l = 0
	r = n - 1
	while l < n and r >= 0 and (l <= r):
		move += 1
		if f == 0:
			tot = 0
			while l < n and l <= r:
				tot += a[l]
				A += a[l]
				l += 1
				if tot > prev:
					prev = tot
					break
		else:
			tot = 0
			while r >= 0 and r >= l:
				tot += a[r]
				B += a[r]
				r -= 1
				if tot > prev:
					prev = tot
					break
		f ^= 1
	print(move, A, B)


T = int(input())
n = [0] * T
ns = [0] * T
for t in range(T):
	n[t] = int(input())
	ns[t] = [int(i) for i in input().split(' ')]

def ans(n, ns):
	a = ns.pop(0)
	atot = a
	btot = 0
	m = 1
	while len(ns) > 0:
		b = 0
		while b <= a and len(ns) > 0:
			b += ns.pop(-1)
		m += 1
		btot += b
		a = 0
		if len(ns) > 0:
			m += 1
		while a <= b and len(ns) > 0:
			a += ns.pop(0)
		atot += a
	return str(str(m) + ' ' + str(atot) + ' ' + str(btot))
for t in range(T):
	print(ans(n[t], ns[t]))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.append(0)
	l.insert(0, 0)
	n += 2
	prefix = [0] * n
	suffix = [0] * n
	for i in range(1, n):
		prefix[i] = prefix[i - 1] + l[i]
	for i in range(n - 2, -1, -1):
		suffix[i] = suffix[i + 1] + l[i]
	(a, b, aprev, acur, bprev, bcur, moves, f) = (0, 0, 0, 0, n - 1, n - 1, 0, 1)
	while acur < bcur and acur < n - 1 and (bcur > 0):
		moves += 1
		if f == 1:
			f = f ^ 1
			aprev = acur
			acur += 1
			while True:
				if acur == bcur:
					break
				if prefix[acur] - prefix[aprev] > suffix[bcur] - suffix[bprev]:
					break
				acur += 1
			if acur == bcur:
				a = a + (prefix[acur - 1] - prefix[aprev])
				if prefix[acur - 1] - prefix[aprev] == 0:
					moves -= 1
			else:
				a = a + (prefix[acur] - prefix[aprev])
				if prefix[acur] - prefix[aprev] == 0:
					moves -= 1
		else:
			f = f ^ 1
			bprev = bcur
			bcur -= 1
			while True:
				if acur == bcur:
					break
				if prefix[acur] - prefix[aprev] < suffix[bcur] - suffix[bprev]:
					break
				bcur -= 1
			if acur == bcur:
				b = b + (suffix[bcur + 1] - suffix[bprev])
				if suffix[bcur + 1] - suffix[bprev] == 0:
					moves -= 1
			else:
				b = b + (suffix[bcur] - suffix[bprev])
				if suffix[bcur] - suffix[bprev] == 0:
					moves -= 1
	print(moves, a, b)


import sys
from math import sqrt, gcd, ceil, log
from bisect import bisect
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def solve():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		arr = deque(read())
		moves = 0
		eats = [0, 0]
		last_eat = 0
		f = 0
		while arr:
			curr_eat = 0
			while arr and last_eat >= curr_eat:
				if f:
					curr_eat += arr.pop()
				else:
					curr_eat += arr.popleft()
			eats[f] += curr_eat
			last_eat = curr_eat
			f = [1, 0][f]
			moves += 1
		ans += ' '.join(map(str, [moves] + eats)) + '\n'
	print(ans)
solve()


def to_list(s):
	return list(map(lambda x: int(x), s.split(' ')))

def left_pick(a, curr_number):
	i = 0
	number = a[i]
	while (number <= curr_number) & (i < len(a) - 1):
		i += 1
		number += a[i]
	return (number, a[i + 1:])

def right_pick(a, curr_number):
	i = 1
	number = a[-i]
	while (number <= curr_number) & (i < len(a)):
		i += 1
		number += a[-i]
	return (number, a[:-i])

def solve(a):
	curr_number = 0
	moves = 0
	left_numbers = 0
	right_numbers = 0
	curr_list = a.copy()
	while curr_list != []:
		if moves % 2 == 0:
			(curr_number, curr_list) = left_pick(curr_list, curr_number)
			left_numbers += curr_number
		else:
			(curr_number, curr_list) = right_pick(curr_list, curr_number)
			right_numbers += curr_number
		moves += 1
	print(moves, left_numbers, right_numbers)
t = int(input())
for i in range(t):
	n = int(input())
	a = to_list(input())
	solve(a)


from sys import stdin, gettrace
from collections import deque
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		aa = deque((int(a) for a in input().split()))
		asum = 0
		bsum = 0
		alast = 0
		blast = 0
		alice = True
		moves = 1
		while aa:
			if alast < blast or (alice and alast == blast):
				if not alice:
					alice = True
					alast = 0
					moves += 1
				a = aa.popleft()
				alast += a
				asum += a
			else:
				if alice:
					alice = False
					blast = 0
					moves += 1
				a = aa.pop()
				blast += a
				bsum += a
		print(moves, asum, bsum)
	q = int(input())
	for _ in range(q):
		solve()
main()


for _ in ' ' * int(input()):
	n = int(input())
	lst = list(map(int, input().split()))
	i = 0
	j = n - 1
	f = 0
	se = 0
	(a, b) = (0, 0)
	cnt = 0
	while i <= j:
		cnt += 1
		if f == 0:
			s = 0
			while s <= se and i <= j:
				s += lst[i]
				i += 1
			f = 1
			se = s
			a += s
		else:
			s = 0
			while s <= se and i <= j:
				s += lst[j]
				j -= 1
			f = 0
			se = s
			b += s
	print(cnt, a, b)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print(1, arr[0], 0)
	else:
		moves = 0
		(suma, sumb, a, b) = (0, 0, 0, n - 1)
		prev = 0
		while True:
			summ = 0
			while summ <= prev and arr[a] != -1:
				summ += arr[a]
				suma += arr[a]
				arr[a] = -1
				a += 1
			prev = summ
			moves += 1
			if arr[a] == -1:
				break
			summ = 0
			while summ <= prev and arr[b] != -1:
				summ += arr[b]
				sumb += arr[b]
				arr[b] = -1
				b -= 1
			prev = summ
			moves += 1
			if arr[b] == -1:
				break
		print(moves, suma, sumb)


import sys, heapq
from collections import *
from functools import lru_cache
sys.setrecursionlimit(10 ** 6)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = list(map(int, input().split(' ')))
		(a, b, cur, i, j, flag, cnt) = (0, 0, 0, 0, n - 1, -1, 0)
		while i <= j:
			delta = 0
			if flag == -1:
				while i <= j and delta <= cur:
					delta += arr[i]
					i += 1
				a += delta
			else:
				while i <= j and delta <= cur:
					delta += arr[j]
					j -= 1
				b += delta
			flag *= -1
			cur = delta
			cnt += 1
		print(cnt, a, b)
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(i, j) = (-1, len(a))
	c = l = r = L = R = 0
	while True:
		if j - i <= 1:
			break
		l = 0
		while l <= r:
			i += 1
			if j <= i:
				break
			l += a[i]
			L += a[i]
		c += 1
		if j - i <= 1:
			break
		r = 0
		while r <= l:
			j -= 1
			if j <= i:
				break
			r += a[j]
			R += a[j]
		c += 1
	print(c, L, R)


def main():
	LMIIS = lambda : list(map(int, input().split()))
	II = lambda : int(input())
	MOD = 10 ** 9 + 7
	from collections import deque
	for _ in range(II()):
		n = II()
		A = deque(map(int, input().split()))
		alice = 0
		bob = len(A) - 1
		a = b = 0
		turn = True
		prev = 0
		move = 0
		while len(A) > 0:
			if turn:
				tmpa = 0
				while tmpa <= prev and len(A) > 0:
					tmpa += A.popleft()
				a += tmpa
				prev = tmpa
			else:
				tmpb = 0
				while tmpb <= prev and len(A) > 0:
					tmpb += A.pop()
				b += tmpb
				prev = tmpb
			turn ^= True
			move += 1
		print(move, a, b)
main()


t = int(input())
for i in range(t):
	n = int(input())
	cookies = input().split()
	cookies = list(map(int, cookies))
	alice_curr = 0
	bob_curr = len(cookies) - 1
	alice_count = 0
	bob_count = 0
	last_max = 0
	turn_count = 0
	while alice_curr <= bob_curr:
		curr_eat = 0
		while curr_eat <= last_max:
			if turn_count % 2 == 0:
				alice_count += cookies[alice_curr]
				curr_eat += cookies[alice_curr]
				alice_curr += 1
				if alice_curr > bob_curr:
					break
			else:
				bob_count += cookies[bob_curr]
				curr_eat += cookies[bob_curr]
				bob_curr -= 1
				if alice_curr > bob_curr:
					break
		last_max = curr_eat
		turn_count += 1
	print(turn_count, alice_count, bob_count)


import sys
input = sys.stdin.readline
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	a = A[0]
	b = 0
	if n == 1:
		print(1, a, b)
		continue
	pa = A[0]
	pb = -1
	l = 1
	r = n - 1
	cnt = 1
	for i in range(n + 1):
		if i % 2 == 0:
			pb = 0
			while pb <= pa and l <= r:
				pb += A[r]
				r -= 1
			pa = 0
			b += pb
		else:
			pa = 0
			while pa <= pb and l <= r:
				pa += A[l]
				l += 1
			pb = 0
			a += pa
		cnt += 1
		if l > r:
			break
	print(cnt, a, b)


for _ in range(int(input())):
	n = input()
	k = list(map(int, input().split()))
	a = 0
	ra = 0
	b = 0
	rb = 0
	s = 0
	while k:
		if s % 2 == 0:
			while ra <= rb and k:
				ra += k[0]
				a += k[0]
				k = k[1:]
			rb = 0
		else:
			while rb <= ra and k:
				rb += k[-1]
				b += k[-1]
				k.pop()
			ra = 0
		s += 1
	print(s, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	(A, B) = (0, 0)
	(At, Bt, moves) = (0, 0, 0)
	while i <= j:
		(A, flag) = (0, 0)
		while i <= j and A <= B:
			A += a[i]
			i += 1
			flag = 1
		At += A
		moves += flag
		(B, flag) = (0, 0)
		while j >= i and A >= B:
			B += a[j]
			j -= 1
			flag = 1
		Bt += B
		moves += flag
	print(moves, At, Bt)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(m, al, bo, p) = (0, 0, 0, 0)
	while a:
		s = 0
		while s <= p and a:
			if m % 2 == 0:
				te = a.pop(0)
				al += te
				s += te
			else:
				te = a.pop(-1)
				bo += te
				s += te
		p = s
		m += 1
	print(m, al, bo)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	last = 0
	(a, b) = (0, 0)
	(sa, sb) = (0, 0)
	k = 2
	m = 0
	while len(l) != 0:
		if k % 2 == 0:
			m += 1
			while last >= sa:
				sa += l[0]
				l.remove(l[0])
				if len(l) == 0:
					break
			last = sa
			a += sa
			sa = 0
		elif k % 2 == 1:
			m += 1
			while last >= sb:
				sb += l[len(l) - 1]
				del l[len(l) - 1]
				if len(l) == 0:
					break
			last = sb
			b += sb
			sb = 0
		k += 1
	print(m, a, b)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	j = n - 1
	pre1 = 0
	total1 = 0
	total2 = 0
	pre2 = 0
	mov = 0
	ch = 0
	while i <= j:
		if i == 0:
			pre1 = arr[0]
			total1 += arr[0]
			i += 1
			mov += 1
			ch = 1
		elif ch == 0:
			pre1 = 0
			while pre1 <= pre2 and j >= i:
				pre1 += arr[i]
				i += 1
			total1 += pre1
			mov += 1
			ch = 1
		else:
			pre2 = 0
			while pre2 <= pre1 and j >= i:
				pre2 += arr[j]
				j -= 1
			total2 += pre2
			mov += 1
			ch = 0
	print(mov, total1, total2)


for _ in range(int(input())):
	aaa = int(input())
	n = [int(x) for x in input().split(' ')]
	a = 0
	b = 0
	curb = 0
	a = a + n[0]
	cura = n[0]
	n = n[1:]
	turn = 'b'
	not_end = 0
	moves = 1
	while len(n) > 0:
		if turn == 'b':
			if cura >= curb:
				curb += n[-1]
				b += n[-1]
				n = n[:-1]
				not_end = 1
			else:
				not_end = 0
				moves += 1
				turn = 'a'
				cura = 0
		elif curb >= cura:
			a += n[0]
			cura += n[0]
			n = n[1:]
			not_end = 1
		else:
			not_end = 0
			moves += 1
			turn = 'b'
			curb = 0
	if not_end == 1:
		moves = moves + 1
	print(moves, a, b)


for j in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(a, h, k, t, i) = (0, 0, 0, 0, 0)
	while len(l) != 0:
		i = i + 1
		if i % 2 != 0:
			u = a
			while k >= t and len(l) > 0:
				a = a + l[0]
				t = a - u
				del l[0]
		else:
			r = h
			while t >= k and len(l) > 0:
				h = h + l[-1]
				k = h - r
				del l[-1]
	print(i, a, h)


t = int(input())
count = 0
while count < t:
	count += 1
	trash = int(input())
	l = list(map(int, input().split(' ')))
	limit = sum(l)
	alice = l[0]
	bob = 0
	alicemove = l[0]
	bobmove = 0
	moves = 1
	leftright = False
	aindex = 1
	bindex = trash - 1
	while alice + bob < limit:
		moves += 1
		if leftright:
			while alicemove <= bobmove and aindex < bindex + 1:
				alicemove += l[aindex]
				aindex += 1
			bobmove = 0
			alice += alicemove
			leftright = False
		else:
			while bobmove <= alicemove and bindex + 1 > aindex:
				bobmove += l[bindex]
				bindex -= 1
			alicemove = 0
			bob += bobmove
			leftright = True
	print(moves, alice, bob)


t = int(input())
for s in range(t):
	sss = int(input())
	a = input().split()
	a = [int(i) for i in a]
	l = 0
	r = len(a) - 1
	cl = 0
	cr = 0
	(tl, tr) = (0, 0)
	flag = 1
	c = 1
	while l <= r:
		if flag:
			cl += a[l]
			tl += a[l]
			if cl > cr:
				cr = 0
				flag = 0
				if l + 1 <= r:
					c += 1
			l += 1
		else:
			cr += a[r]
			tr += a[r]
			if cr > cl:
				cl = 0
				flag = 1
				if l <= r - 1:
					c += 1
			r -= 1
	print(c, tl, tr)


a = []

def bob(num):
	s = 0
	while s < num:
		s = s + a[-1]
		a.pop(-1)
		if a == []:
			return s
	if s == num:
		s = s + a[-1]
		a.pop(-1)
	return s

def alice(num):
	s = 0
	while s < num:
		s = s + a[0]
		a.pop(0)
		if a == []:
			return s
	if s == num:
		s = s + a[0]
		a.pop(0)
	return s
for _ in range(int(input())):
	n = int(input())
	a = input().split(' ')
	for i in range(n):
		a[i] = int(a[i])
	val = 0
	al = a[0]
	bo = 0
	size = a[0]
	a.pop(0)
	while a != []:
		if val % 2 == 0:
			size = bob(size)
			bo = bo + size
			val = val + 1
			if a == []:
				break
		else:
			size = alice(size)
			al = al + size
			val = val + 1
			if a == []:
				break
	print(val + 1, al, bo)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	num = []
	for i in range(t):
		n = int(input())
		temp = list(map(int, input().split()))
		num.append(temp)
	x = 0
	for i in range(t):
		temp = num[i]
		(a, b, j, k) = (temp[0], 0, 0, temp[0])
		move = 1
		(l, r) = (1, len(temp) - 1)
		while l <= r:
			if j <= k:
				if move % 2 == 1:
					j += temp[r]
					r -= 1
				else:
					j += temp[l]
					l += 1
			else:
				if move % 2 == 1:
					b += j
				else:
					a += j
				k = j
				j = 0
				move += 1
		m = move
		if a + b != sum(temp):
			move = move + 1
		if m % 2 == 0:
			a += sum(temp) - (a + b)
		else:
			b += sum(temp) - (a + b)
		print(str(move) + ' ' + str(a) + ' ' + str(b))
main()


import collections
import operator
for _ in range(int(input())):
	n = int(input())
	ll = [int(i) for i in input().split(' ')]
	move = 0
	left = 0
	right = n - 1
	ls = rs = 0
	current = 0
	isleft = True
	while left <= right:
		move += 1
		if isleft:
			cs = ll[left]
			while left < right and cs <= current:
				left += 1
				cs += ll[left]
			current = cs
			left += 1
			ls += cs
			isleft = False
		else:
			cs = ll[right]
			while left < right and cs <= current:
				right -= 1
				cs += ll[right]
			right -= 1
			current = cs
			rs += cs
			isleft = True
	print(move, ls, rs)


t = int(input())
while t > 0:
	n = int(input())
	a = [int(s) for s in input().split()]
	i = 1
	j = n - 1
	k = 1
	sum1 = k1 = a[0]
	sum2 = k2 = 0
	while i <= j:
		k += 1
		if k % 2 != 0:
			while i <= j and sum1 <= sum2:
				sum1 += a[i]
				i += 1
			k1 += sum1
			sum2 = 0
		else:
			while i <= j and sum2 <= sum1:
				sum2 += a[j]
				j -= 1
			k2 += sum2
			sum1 = 0
	print(k, k1, k2)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pre = -1
	post = n
	a = 0
	b = 0
	count = 0
	prev = 0
	while True:
		if post - pre <= 1:
			break
		count += 1
		if count % 2 == 1:
			temp = 0
			while temp <= prev:
				pre += 1
				if pre >= post:
					break
				temp += l[pre]
			a += temp
			prev = temp
		else:
			temp = 0
			while temp <= prev:
				post -= 1
				if post <= pre:
					break
				temp += l[post]
			b += temp
			prev = temp
	print(count, a, b)


def checker(n, lst):
	(l, r) = (0, n - 1)
	(sl, sr) = (0, 0)
	(count, ansl, ansr) = (0, 0, 0)
	while l <= r:
		if count % 2 == 0:
			s1 = 0
			while l <= r and s1 <= sr:
				s1 += lst[l]
				l += 1
			ansl += s1
			sl = s1
		else:
			s2 = 0
			while l <= r and s2 <= sl:
				s2 += lst[r]
				r -= 1
			ansr += s2
			sr = s2
		count += 1
	return (count, ansl, ansr)
for _ in range(int(input())):
	m = int(input())
	a = [int(i) for i in input().split()]
	print(*checker(m, a))


import sys
I = sys.stdin.readline
pr = sys.stdout.write

def main():
	for _ in range(int(I())):
		n = int(I())
		ar = list(map(int, I().split()[:n]))
		i = 1
		j = n - 1
		a = at = ar[0]
		b = bt = 0
		c = 1
		try:
			while i < j:
				while bt <= at and i <= j:
					bt += ar[j]
					ar[j] = -1
					j -= 1
				c += 1
				at = 0
				b += bt
				while at <= bt and i <= j:
					at += ar[i]
					ar[i] = -1
					i += 1
				a += at
				if at:
					c += 1
				if at > bt:
					bt = 0
			if i == j and ar[i] != -1:
				if bt:
					a += ar[i]
				else:
					b += ar[i]
					c += 1
		except Exception as e:
			pr(f'{e} => {n},{j}')
			break
		pr(f'{c} {a} {b}\n')
main()


t = int(input())
for tt in range(0, t):
	n = int(input())
	l = []
	l = list(map(int, input().split()))
	left = 0
	right = n - 1
	i = 0
	alicesum = 0
	palicesum = 0
	bobsum = 0
	pbobsum = 0
	flag = 0
	while left <= right:
		if i % 2 == 0:
			alicesum += l[left]
			if alicesum <= bobsum:
				flag = 0
			else:
				palicesum += alicesum
				bobsum = 0
				i += 1
				flag = 1
			left += 1
		else:
			bobsum += l[right]
			if alicesum >= bobsum:
				flag = 2
			else:
				pbobsum += bobsum
				alicesum = 0
				i += 1
				flag = 1
			right -= 1
	if flag == 0:
		palicesum += alicesum
		i += 1
	if flag == 2:
		pbobsum += bobsum
		i += 1
	print(i, end=' ')
	print(palicesum, end=' ')
	print(pbobsum)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = l[0]
	b = 0
	m = 1
	flag = 1
	x = l[0]
	l.pop(0)
	while len(l) > 0:
		if flag == 0:
			s = 0
			while s <= x and len(l) > 0:
				s = s + l[0]
				l.pop(0)
			x = s
			flag = 1
			a = a + x
		else:
			s = 0
			while s <= x and len(l) > 0:
				s = s + l[-1]
				l.pop(-1)
			x = s
			flag = 0
			b = b + x
		m += 1
	print(m, a, b)


for i in range(int(input())):
	(a, b, c, a1, l, s) = (0, 0, 0, 0, [], 0)
	(f, f1, i) = (0, 0, 0)
	n = int(input())
	lst = list(map(int, input().split()))
	ls = lst[::-1]
	while True:
		if a <= s and f == 0:
			a = a + lst[i]
			lst.pop(0)
			ls.pop()
			if a > s:
				f = 1
				f1 = 0
				c = c + 1
				a1 = a1 + a
				s = 0
			if len(ls) == 0:
				if a <= s:
					a1 = a1 + a
					c = c + 1
				break
		if s <= a and f1 == 0:
			s = s + ls[i]
			ls.pop(0)
			lst.pop()
			if s > a:
				f = 0
				f1 = 1
				c = c + 1
				b = b + s
				a = 0
			if len(ls) == 0:
				if s <= a:
					b = b + s
					c = c + 1
				break
	print(c, a1, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	alice = []
	bob = []
	move = 0
	while len(a) != 0:
		if move == 0:
			alice.append(a.pop(0))
		elif move % 2 == 0:
			minimum = bob[-1]
			s = 0
			p = 0
			while len(a) != 0:
				s += a.pop(0)
				if s > minimum:
					break
			alice.append(s)
		else:
			minimum = alice[-1]
			s = 0
			p = 0
			while len(a) != 0:
				s += a.pop(-1)
				if s > minimum:
					break
			bob.append(s)
		move += 1
	print(move, sum(alice), sum(bob))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		r = [0] * 3
		i = 0
		j = n - 1
		t = 0
		while i <= j:
			c = 0
			while i <= j and c <= t:
				c += a[i]
				i += 1
			r[1] += c
			if c > 0:
				r[0] += 1
			t = c
			c = 0
			while i <= j and c <= t:
				c += a[j]
				j -= 1
			r[2] += c
			if c > 0:
				r[0] += 1
			t = c
		rr.append(JA(r, ' '))
	return JA(rr, '\n')
print(main())


T = int(input())
for i in range(T):
	n = int(input())
	L = [int(x) for x in input().split()]
	m = 0
	A = 0
	B = 0
	a = 0
	b = 0
	while len(L) > 0:
		while a <= b and L != []:
			a += L.pop(0)
		A += a
		m += 1
		b = 0
		while b <= a and L != []:
			b += L.pop()
		B += b
		if b != 0:
			m += 1
		a = 0
	print(m, A, B)


def solution():
	n = int(input())
	a = list(map(lambda x: int(x), input().split()))
	(alice, bob) = (a[0], 0)
	(alice_pos, bob_pos, pos) = (1, n - 1, -1)
	last = alice
	is_alice_turn = -1
	cnt = 1
	while alice_pos <= bob_pos:
		cnt += 1
		if is_alice_turn == 1:
			pos = alice_pos
		else:
			pos = bob_pos
		s = 0
		while s <= last and alice_pos - 1 <= pos + is_alice_turn <= bob_pos + 1:
			s += a[pos]
			pos += is_alice_turn
		if is_alice_turn == 1:
			alice_pos = pos
			alice += s
		else:
			bob_pos = pos
			bob += s
		last = s
		is_alice_turn = is_alice_turn * -1
	print(cnt, alice, bob)
t = int(input())
for _ in range(t):
	solution()


from collections import deque
t = int(input())
for i in range(0, t):
	a = int(input())
	b = deque(input().split())
	d = 0
	alice = []
	bob = []
	alicemax = 0
	bobmax = 0
	count = 0
	alicecount = 0
	bobcount = 0
	while len(b) != 0:
		alice = []
		while sum(alice) <= bobmax:
			if len(b) == 0:
				break
			d = int(b.popleft())
			alice.append(d)
		if sum(alice) != 0:
			count += 1
		alicecount += sum(alice)
		alicemax = sum(alice)
		bob = []
		while sum(bob) <= alicemax:
			if len(b) == 0:
				break
			d = int(b.pop())
			bob.append(d)
		if sum(bob) != 0:
			count += 1
		bobcount += sum(bob)
		bobmax = sum(bob)
	print(count, alicecount, bobcount)


t = int(input())
for _C in range(t):
	n = map(int, input().split())
	A = list(map(int, input().split()))
	count = 0
	prev = 0
	a = b = 0
	while len(A) > 0:
		count += 1
		if count % 2 == 1:
			s = 0
			while len(A) and s <= prev:
				s += A[0]
				del A[0]
			a += s
			prev = s
		else:
			s = 0
			while len(A) and s <= prev:
				s += A[-1]
				del A[-1]
			b += s
			prev = s
	print(count, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	a = l[0]
	b = 0
	x = l[0]
	y = 0
	i = 1
	j = n - 1
	c = 1
	while i <= j:
		y = 0
		while y <= x and i <= j:
			y += l[j]
			b += l[j]
			j -= 1
		c += 1
		if i > j:
			break
		x = 0
		while x <= y and i <= j:
			x += l[i]
			a += l[i]
			i += 1
		c += 1
	print(c, a, b)


def RA():
	return list(map(int, input().split()))

def solve():
	n = int(input())
	arr = RA()
	l = 0
	r = n
	aliceEat = arr[0]
	a = arr[0]
	b = 0
	count = 1
	while l != r - 1:
		bobEat = 0
		while l != r - 1 and bobEat <= aliceEat:
			r -= 1
			bobEat += arr[r]
		b += bobEat
		count += 1
		if l == r - 1:
			break
		aliceEat = 0
		while l != r - 1 and aliceEat <= bobEat:
			l += 1
			aliceEat += arr[l]
		a += aliceEat
		count += 1
	print(count, a, b)
t = int(input())
for i in range(t):
	solve()


nt = int(input())
for _ in range(nt):
	n = int(input())
	l = list(map(int, input().split()))
	tot_a = l[0]
	tot_b = 0
	preva = l[0]
	prevb = 0
	bufferb = buffera = 0
	ans = 1
	l.pop(0)
	while len(l) != 0:
		if prevb < preva or (prevb <= preva and bufferb > 0):
			prevb += l[-1]
			l.pop(-1)
			if prevb > preva:
				preva = 0
				tot_b += prevb
				bufferb = 0
			else:
				bufferb = prevb
				continue
		else:
			preva += l[0]
			l.pop(0)
			if preva > prevb:
				prevb = 0
				tot_a += preva
				buffera = 0
			else:
				buffera = preva
				continue
		ans += 1
	tot_a += buffera
	tot_b += bufferb
	if buffera != 0 or bufferb != 0:
		ans += 1
	print(ans, tot_a, tot_b)


def brute(n, arr):
	(a, b, target, turn, moves) = (0, 0, None, 0, 0)
	while len(arr) > 0:
		if turn == 0:
			broke = False
			lastIndex = 0
			if target is None:
				target = arr[0]
				s = arr[0]
				broke = True
			else:
				s = 0
				for (i, num) in enumerate(arr):
					s += num
					if s > target:
						target = s
						lastIndex = i
						broke = True
						break
			if broke == True:
				arr = arr[lastIndex + 1:]
				a += s
			else:
				arr = []
				a += s
		else:
			s = 0
			broke = False
			for i in range(len(arr) - 1, -1, -1):
				num = arr[i]
				s += num
				if s > target:
					target = s
					broke = True
					break
			if broke == True:
				arr = arr[:i]
				b += s
			else:
				arr = []
				b += s
		moves += 1
		turn = (turn + 1) % 2
	return ' '.join((str(x) for x in [moves, a, b]))

def soln(n, arr):
	(a, b, target, turn, moves) = (0, 0, None, 0, 0)
	fp = []
	for num in arr:
		if len(fp) == 0:
			fp.append(num)
		else:
			fp.append(fp[-1] + num)
	rp = [0 for _ in arr]
	for i in range(len(arr) - 1, -1, -1):
		num = arr[i]
		if i == len(arr) - 1:
			rp[i] = num
		else:
			rp[i] = num + rp[i + 1]
	sub = 0
	while len(arr) > 0:
		if turn == 0:
			broke = False
			lastIndex = 0
			if target is None:
				target = arr[0]
				s = arr[0]
				broke = True
			else:
				s = 0
				test = 0
				for (i, num) in enumerate(arr):
					s += num
					test = fp[i]
					assert test == s
					if s > target:
						target = s
						lastIndex = i
						broke = True
						break
			if broke == True:
				arr = arr[lastIndex + 1:]
				a += s
				sub += s
			else:
				arr = []
				a += s
				sub += s
		else:
			s = 0
			broke = False
			for i in range(len(arr) - 1, -1, -1):
				num = arr[i]
				s += num
				if s > target:
					target = s
					broke = True
					break
			if broke == True:
				arr = arr[:i]
				b += s
				sub += s
			else:
				arr = []
				b += s
				sub += s
		moves += 1
		turn = (turn + 1) % 2
	return ' '.join((str(x) for x in [moves, a, b]))

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = [int(x) for x in input().split()]
		result = brute(n, arr)
		print(result)
main()


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		arr = list(map(int, input().split()))
		i = 1
		j = len(arr) - 1
		prev = arr[0]
		A = arr[0]
		B = 0
		turn = 0
		move = 1
		while i <= j:
			if not turn:
				s = 0
				while s <= prev and i <= j:
					s += arr[j]
					j -= 1
				prev = s
				B += s
				move += 1
			else:
				s = 0
				while s <= prev and i <= j:
					s += arr[i]
					i += 1
				prev = s
				A += s
				move += 1
			turn = 1 - turn
		print(move, A, B)
main()


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	i = 0
	j = 1
	s1 = 0
	s2 = 0
	p1 = 0
	p2 = 0
	move = 0
	while i + j - 1 != n:
		if i + j - 1 != n:
			p1 = 0
			while p1 <= p2 and i + j - 1 != n:
				s1 += ar[i]
				p1 += ar[i]
				i += 1
			move += 1
		if i + j - 1 != n:
			p2 = 0
			while p2 <= p1 and i + j - 1 != n:
				s2 += ar[-j]
				p2 += ar[-j]
				j += 1
			move += 1
	print(move, s1, s2)


def handle(n, a):
	candies = list(a)
	alice_turn = True
	total_moves = 0
	(a_total, b_total) = (0, 0)
	prev = 0
	while len(candies):
		count = 0
		total = 0
		for c in candies:
			count += 1
			total += c
			if total > prev:
				break
		prev = total
		candies = candies[count:][::-1]
		if alice_turn:
			a_total += total
		else:
			b_total += total
		alice_turn = not alice_turn
		total_moves += 1
	return f'{total_moves} {a_total} {b_total}'
t = int(input())
for case in range(t):
	n = int(input())
	a = map(int, input().split())
	result = handle(n, a)
	print(result)


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = [int(x) for x in input().split()]
	a = [l[0]]
	b = []
	i = 1
	ib = 0
	ia = 1
	j = n - 1
	flag = 0
	c = 1
	while i <= j:
		if flag == 0:
			sum = 0
			while j >= i and sum <= a[ia - 1]:
				sum += l[j]
				j -= 1
			b += [sum]
			ib += 1
			c += 1
			flag = 1
		else:
			sum = 0
			while i <= j and sum <= b[ib - 1]:
				sum += l[i]
				i += 1
			a += [sum]
			ia += 1
			c += 1
			flag = 0
	res = 0
	res1 = 0
	for i in range(len(a)):
		res += a[i]
	for i in range(len(b)):
		res1 += b[i]
	print(c, res, res1)


tc = int(input())
while tc != 0:
	tc = tc - 1
	n = int(input())
	a = list(map(int, input().split(' ')))
	x = a[0]
	y = 0
	p = a[0]
	t = 1
	l = n
	j = 0
	while n > 1:
		if t % 2 == 1:
			s = 0
			while s <= p and l - 1 > j:
				l = l - 1
				s = s + a[l]
			y = y + s
			p = s
			t = t + 1
		else:
			s = 0
			while s <= p and l - 1 > j:
				j = j + 1
				s = s + a[j]
			x = x + s
			p = s
			t = t + 1
		n = l - j
	print(str(t) + ' ' + str(x) + ' ' + str(y))


from math import ceil
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	(c, alice, bob) = (1, 0, 0)
	i = 0
	j = n - 1
	ap = 0
	bp = 0
	while i <= j:
		if c % 2 == 1:
			ap = 0
			while i <= j and ap <= bp:
				ap += a[i]
				alice += a[i]
				i += 1
		else:
			bp = 0
			while j >= i and bp <= ap:
				bp += a[j]
				bob += a[j]
				j -= 1
		c += 1
	print(c - 1, alice, bob)
	t -= 1


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	alice = 0
	bob = 0
	alice_ans = 0
	bob_ans = 0
	cnt = 0
	while l <= r:
		if cnt % 2 == 0:
			alice = 0
			while l <= r and alice <= bob:
				alice += a[l]
				l += 1
			alice_ans += alice
		else:
			bob = 0
			while l <= r and bob <= alice:
				bob += a[r]
				r -= 1
			bob_ans += bob
		cnt += 1
	print(cnt, alice_ans, bob_ans)


for _ in [0] * int(input()):
	n = int(input())
	a = (*map(int, input().split()),)
	i = l = 0
	j = n - 1
	x = y = z = 0
	while i <= j:
		c = 0
		while i <= j and c <= l:
			c += a[i]
			i += 1
		z += 1
		x += c
		l = c
		if i > j:
			break
		c = 0
		while i <= j and c <= l:
			c += a[j]
			j -= 1
		z += 1
		y += c
		l = c
	print(z, x, y)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	de = deque()
	for i in a:
		de.append(i)
	n -= 1
	x = de.popleft()
	alice = x
	bob = 0
	al_curr = x
	bob_curr = 0
	f = 0
	c = 1
	while n > 0:
		if f == 0:
			temp = 0
			while temp <= al_curr and n > 0:
				temp += de.pop()
				n -= 1
			bob_curr = temp
			bob += temp
			f = 1
			c += 1
		else:
			temp = 0
			while temp <= bob_curr and n > 0:
				temp += de.popleft()
				n -= 1
			al_curr = temp
			alice += temp
			c += 1
			f = 0
	print(c, alice, bob)


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	pre = 0
	(a, b) = (0, 0)
	(l, r) = (0, n - 1)
	t = 0
	while True:
		if t % 2 == 0:
			add_a = 0
			while l <= r:
				add_a += A[l]
				l += 1
				if add_a > pre:
					break
			a += add_a
			pre = add_a
		else:
			add_b = 0
			while l <= r:
				add_b += A[r]
				r -= 1
				if add_b > pre:
					break
			b += add_b
			pre = add_b
		t += 1
		if l > r:
			break
	print(t, a, b)


import collections
t = int(input())

def solve(n, arr):
	arr = collections.deque(arr)
	a = 0
	b = 0
	turns = 0
	turn = 0
	last = 0
	while len(arr) > 0:
		turns += 1
		ate = 0
		while ate <= last and len(arr) > 0:
			if turn == 0:
				ate += arr.popleft()
			else:
				ate += arr.pop()
		last = ate
		if turn == 0:
			a += ate
		else:
			b += ate
		turn ^= 1
	print(turns, a, b)
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	solve(n, arr)


t = int(input())
for i in range(t):
	candy = int(input())
	arr = [int(i) for i in input().split()]
	a = []
	b = []
	temp_a = 0
	temp_b = 0
	moves = 0
	game_end = False
	while arr and game_end == False:
		if moves == 0:
			a.append(arr[0])
			temp_a = arr[0]
			arr = arr[1:]
			if not arr:
				game_end = True
			moves = 1
			turn = 'b'
		if turn == 'b' and game_end == False:
			temp_b = 0
			b_pointer = -1
			moves += 1
			while temp_b <= temp_a:
				b.append(arr[b_pointer])
				temp_b += arr[b_pointer]
				b_pointer -= 1
				if abs(b_pointer) == len(arr) + 1:
					game_end = True
					break
			arr = arr[:b_pointer + 1]
			turn = 'a'
		if turn == 'a' and game_end == False:
			temp_a = 0
			a_pointer = 0
			moves += 1
			while temp_a <= temp_b:
				temp_a += arr[a_pointer]
				a.append(arr[a_pointer])
				a_pointer += 1
				if a_pointer == len(arr):
					game_end = True
					break
			arr = arr[a_pointer:]
			turn = 'b'
	print(moves, sum(a), sum(b))


def main():
	n = int(input())
	lst = list(map(int, input().split()))
	left = 0
	right = n
	ltot = lst[0]
	rtot = 0
	lsum = lst[0]
	rsum = 0
	turns = 1
	while left + 1 != right:
		if rsum == 0:
			turns += 1
			while rsum <= lsum and left + 1 != right:
				right -= 1
				rsum += lst[right]
			rtot += rsum
			lsum = 0
		else:
			turns += 1
			while rsum >= lsum and left + 1 != right:
				left += 1
				lsum += lst[left]
			rsum = 0
			ltot += lsum
	print(turns, ltot, rtot)
t = int(input())
for i in range(t):
	main()


for _ in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	l = 0
	r = n - 1
	(left_sum, right_sum) = (0, 0)
	(left_res, right_res) = (0, 0)
	count = 0
	while l <= r:
		if count % 2 == 0:
			now_sum = 0
			while l <= r and now_sum <= right_sum:
				now_sum += data[l]
				l += 1
			left_res += now_sum
			left_sum = now_sum
		elif count % 2 == 1:
			now_sum = 0
			while l <= r and now_sum <= left_sum:
				now_sum += data[r]
				r -= 1
			right_res += now_sum
			right_sum = now_sum
		count += 1
	print(count, left_res, right_res)


import collections
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	al = a[0]
	bo = 0
	(AA, BB) = (a[0], 0)
	(ll, rr, ans) = (0, n, 1)
	while rr - ll > 1:
		if ans % 2 == 0:
			while BB >= AA:
				ll += 1
				if ll == rr:
					break
				else:
					AA += a[ll]
			BB = 0
			al += AA
			ans += 1
		else:
			while AA >= BB:
				rr -= 1
				if ll == rr:
					break
				else:
					BB += a[rr]
			AA = 0
			bo += BB
			ans += 1
	print(ans, al, bo)


t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	count = 1
	alice = [nums.pop(0)]
	bob = []
	turn = 1
	prev = alice[0]
	while nums:
		s = 0
		if turn:
			while nums and s <= prev:
				bob.append(nums.pop(-1))
				s += bob[-1]
		else:
			while nums and s <= prev:
				alice.append(nums.pop(0))
				s += alice[-1]
		turn = not turn
		prev = s
		count += 1
	print(count, sum(alice), sum(bob), end=' ')
	print('')


n = int(input())
for test in range(n):
	ans_a = 0
	ans_b = 0
	m = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = len(l) - 1
	ans = 0
	curB = 0
	s = True
	while s:
		curA = 0
		ans += 1
		cA = True
		while curA <= curB:
			curA += l[i]
			cA = False
			if i == j:
				print(ans - cA, ans_a + curA, ans_b)
				s = False
				break
			i += 1
		curB = 0
		ans += 1
		cB = True
		while curB <= curA and s:
			curB += l[j]
			cB = False
			if i == j:
				print(ans - cA, ans_a + curA, ans_b + curB)
				s = False
				break
			j -= 1
		ans_a += curA
		ans_b += curB


for ii in range(int(input())):
	n = int(input())
	c = [int(i) for i in input().split()]
	l = 0
	r = n - 1
	b = 0
	i = 0
	(sum_a, sum_b) = (0, 0)
	while l <= r:
		if i % 2 == 0:
			a = 0
			while a <= b and l <= r:
				a += c[l]
				l += 1
			sum_a += a
			i += 1
		else:
			b = 0
			while b <= a and l <= r:
				b += c[r]
				r -= 1
			sum_b += b
			i += 1
	print(i, sum_a, sum_b)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	moves = 1
	atotal = 0
	As = 0
	Bs = 0
	btotal = 0
	while len(a) != 0:
		if moves % 2 != 0:
			As = 0
			while len(a) != 0:
				As += a[0]
				atotal += a[0]
				a.pop(0)
				if As > Bs:
					break
			moves += 1
		else:
			Bs = 0
			while len(a) != 0:
				Bs += a[-1]
				btotal += a[-1]
				a.pop(-1)
				if Bs > As:
					break
			moves += 1
	print(moves - 1, atotal, btotal)


t = int(input())
for _ in range(t):
	l = int(input())
	a = list(map(int, input().split(' ')))
	(i, j) = (0, l - 1)
	(x, y, z) = (1, 0, 0)
	temp = 0
	while j >= i:
		total = 0
		if x % 2 == 1:
			while total <= temp and j >= i:
				total += a[i]
				i += 1
			y += total
		else:
			while total <= temp and j >= i:
				total += a[j]
				j -= 1
			z += total
		temp = total
		x += 1
	print(x - 1, y, z)


def solution(t):
	for i in range(t):
		n = int(input())
		k = list(map(int, input().split()))
		s1 = s2 = 0
		i = 0
		j = n - 1
		a = b = 0
		c = 0
		suma = sum(k)
		while a + b < suma:
			s1 = 0
			while s1 <= s2 and a + b < suma:
				s1 += k[i]
				a += k[i]
				i += 1
			s2 = 0
			if s1:
				c += 1
			while s2 <= s1 and a + b < suma:
				s2 += k[j]
				b += k[j]
				j -= 1
			if s2:
				c += 1
		print(c, a, b)
solution(int(input()))


for t in range(int(input())):
	n = int(input())
	mylist = list(map(int, input().split()))
	flag = True
	value = 0
	sumA = 0
	sumB = 0
	totalA = 0
	totalB = 0
	move = 0
	while sum(mylist) > value:
		if flag == True:
			while value >= sumA:
				sumA += mylist[0]
				mylist.pop(0)
			totalA += sumA
			value = sumA
			sumA = 0
			flag = False
			move += 1
		else:
			while value >= sumB:
				sumB += mylist[len(mylist) - 1]
				mylist.pop(len(mylist) - 1)
			totalB += sumB
			value = sumB
			sumB = 0
			flag = True
			move += 1
	if flag == False:
		totalB += sum(mylist)
	else:
		totalA += sum(mylist)
	if len(mylist) == 0:
		move -= 1
	print(move + 1, totalA, totalB)


t = int(input())
k = 0
for _ in range(t):
	n = int(input())
	lis = list(map(int, input().split(' ')))
	l = 1
	r = len(lis) - 1
	a = lis[0]
	b = 0
	ans = 1
	preva = lis[0]
	prevb = 0
	while l <= r:
		suma = 0
		while suma <= preva and l <= r:
			b += lis[r]
			prevb += lis[r]
			suma += lis[r]
			r -= 1
		ans += 1
		preva = 0
		if l > r:
			break
		suma = 0
		while suma <= prevb and l <= r:
			a += lis[l]
			preva += lis[l]
			suma += lis[l]
			l += 1
		ans += 1
		prevb = 0
	print(ans, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	move = 1
	al = a[0]
	tal = a[0]
	bal = 0
	a = a[1:]
	while len(a) > 0:
		bo = 0
		while bo <= al and len(a) != 0:
			bo += a[-1]
			bal += a[-1]
			a.pop()
		move += 1
		if len(a) == 0:
			break
		al = 0
		while al <= bo and len(a) != 0:
			al += a[0]
			tal += a[0]
			a = a[1:]
		move += 1
	print(move, tal, bal)


test = False
if test:
	f = open('/home/cahid/PycharmProjects/untitled/venv/in', 'r')

def getline():
	if test:
		return f.readline()
	else:
		return input()
testcases = int(getline())
for qwe in range(testcases):
	n = int(getline())
	arr = getline().split(' ')
	moves = 0
	a = 0
	b = 0
	pl = 0
	pr = len(arr) - 1
	ac = 0
	bc = 0
	while pl <= pr:
		ac = 0
		while pl <= pr and ac <= bc:
			ac += int(arr[pl])
			pl += 1
		a += ac
		moves += 1
		if pl > pr:
			break
		bc = 0
		while pl <= pr and ac >= bc:
			bc += int(arr[pr])
			pr -= 1
		b += bc
		moves += 1
	print('%d %d %d' % (moves, a, b))


t = int(input())
for i in range(t):
	n = int(input())
	s = [int(i) for i in input().split()]
	a = s[0]
	b = 0
	steps = 1
	tmpa = s[0]
	tmpb = 0
	s.pop(0)
	while s != []:
		step2 = 0
		tmpb = 0
		while s != [] and tmpb <= tmpa:
			x = s.pop(-1)
			tmpb += x
			b += x
		steps += 1
		tmpa = 0
		while s != [] and tmpa <= tmpb:
			step2 = 1
			x = s.pop(0)
			tmpa += x
			a += x
		if step2 == 1:
			steps += 1
	print(steps, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	start = 1
	end = n - 1
	moves = 1
	alice = a[0]
	bob = 0
	ate = a[0]
	eating = 0
	while start <= end:
		if moves % 2 == 1:
			while end >= start and eating <= ate:
				eating += a[end]
				end -= 1
			bob += eating
			moves += 1
		else:
			while start <= end and eating <= ate:
				eating += a[start]
				start += 1
			alice += eating
			moves += 1
		if eating <= ate:
			break
		else:
			ate = eating
			eating = 0
	print(moves, alice, bob)


from collections import deque
from sys import stdin
input = iter(stdin.readlines()).__next__
t = int(input())
for _ in range(t):
	n = int(input())
	a = deque(map(int, input().split()))
	(alice, bob) = (a.popleft(), 0)
	last = alice
	moves = 1
	turn = 1
	while a:
		moves += 1
		if turn == 1:
			turn = 0
			bob_turn = 0
			while a:
				bob_turn += a.pop()
				if bob_turn > last:
					break
			bob += bob_turn
			last = bob_turn
		else:
			turn = 1
			alice_turn = 0
			while a:
				alice_turn += a.popleft()
				if alice_turn > last:
					break
			alice += alice_turn
			last = alice_turn
	print(moves, alice, bob)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	arr = list(map(int, input().split()))
	i = 1
	j = n - 1
	a = arr[0]
	b = 0
	s = a
	nom = 1
	while i <= j:
		temp = 0
		if temp <= s and j >= i:
			nom += 1
		while temp <= s and j >= i:
			temp = temp + arr[j]
			j = j - 1
		b = b + temp
		s = temp
		temp = 0
		if temp <= s and i <= j:
			nom += 1
		while temp <= s and i <= j:
			temp = temp + arr[i]
			i += 1
		a = a + temp
		s = temp
	print(nom, a, b)


def candies(arr):
	(totalAlice, totalBob) = (0, 0)
	aliceTurn = True
	currentAlice = 0
	currentBob = arr[0] - 1
	(i, j) = (0, len(arr) - 1)
	moves = 0
	while i <= j:
		if aliceTurn:
			currentAlice += arr[i]
			if currentAlice > currentBob:
				aliceTurn = False
				currentBob = 0
				moves += 1
			totalAlice += arr[i]
			i += 1
		else:
			currentBob += arr[j]
			if currentBob > currentAlice:
				aliceTurn = True
				currentAlice = 0
				moves += 1
			totalBob += arr[j]
			j -= 1
	if aliceTurn and currentAlice <= currentBob and (currentAlice != 0):
		moves += 1
	if not aliceTurn and currentBob <= currentAlice and (currentBob != 0):
		moves += 1
	return (moves, totalAlice, totalBob)
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*candies(arr))


def calculate(arr, n):
	(a, b) = (0, 0)
	p1 = 0
	p2 = n - 1
	ele = n
	toggle = 1
	flag = 0
	l1 = []
	l2 = []
	prevA = 0
	prevB = 0
	moves = 0
	while ele > 0:
		if toggle == 1:
			flag = 0
			prevA = 0
			moves += 1
			while flag == 0 and ele > 0:
				a += arr[p1]
				prevA += arr[p1]
				l1.append(arr[p1])
				p1 += 1
				ele -= 1
				if prevA > prevB:
					flag = 1
		else:
			flag = 0
			prevB = 0
			moves += 1
			while flag == 0 and ele > 0:
				b += arr[p2]
				prevB += arr[p2]
				l2.append(arr[p2])
				p2 -= 1
				ele -= 1
				if prevB > prevA:
					flag = 1
		toggle *= -1
	print(moves, a, b)
	return
t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	calculate(arr, n)
	t -= 1


T = int(input())
for _ in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	move = 0
	alice_sum = 0
	bob_sum = 0
	while len(a) > 0:
		ate = 0
		alice = 0
		bob = 0
		if move == 0:
			alice += a[0]
			a = a[1:]
			ate += 1
		else:
			while tmp >= 0:
				if len(a) == 0:
					break
				alice += a[0]
				tmp -= a[0]
				a = a[1:]
				ate += 1
		if ate > 0:
			move += 1
			alice_sum += alice
			tmp = alice
		ate = 0
		while tmp >= 0:
			if len(a) == 0:
				break
			bob += a[-1]
			tmp -= a[-1]
			a = a[:-1]
			ate += 1
		if ate > 0:
			move += 1
			bob_sum += bob
			tmp = bob
	print(move, alice_sum, bob_sum)


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
for _ in range(int(cin())):
	n = int(cin())
	a = list(map(int, cin().split()))
	(alice, bob, move) = (a[0], 0, 1)
	(x, y, temp) = (0, n, a[0])
	while x + 1 < y:
		sum = 0
		while sum <= temp and y - 1 > x:
			y -= 1
			sum += a[y]
		temp = sum
		bob += sum
		move += sum > 0
		sum = 0
		while sum <= temp and x + 1 < y:
			x += 1
			sum += a[x]
		temp = sum
		alice += sum
		move += sum > 0
	cout(str(move) + ' ' + str(alice) + ' ' + str(bob) + '\n')


from collections import deque
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	q = deque(l)
	a = 0
	b = 0
	temp = 0
	prev0 = 0
	prev1 = 0
	moves = 0
	while q:
		moves += 1
		if temp == 0:
			if prev1 == 0:
				prev0 = q.popleft()
			else:
				while q and prev0 <= prev1:
					prev0 += q.popleft()
			prev1 = 0
			temp = 1
		else:
			while q and prev1 <= prev0:
				prev1 += q.pop()
			prev0 = 0
			temp = 0
		a += prev0
		b += prev1
	print(moves, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	sweets = list(map(int, input().split()))
	alice_sum = 0
	bob_sum = 0
	count = 0
	alice = 0
	bob = n - 1
	alice_sum += sweets[alice]
	alice_tmp = sweets[alice]
	alice += 1
	count += 1
	while alice <= bob:
		bob_tmp = 0
		was1 = False
		while bob_tmp <= alice_tmp and alice <= bob:
			bob_sum += sweets[bob]
			bob_tmp += sweets[bob]
			bob -= 1
			was1 = True
		alice_tmp = 0
		was2 = False
		while alice_tmp <= bob_tmp and alice <= bob:
			alice_sum += sweets[alice]
			alice_tmp += sweets[alice]
			alice += 1
			was2 = True
		if was1:
			count += 1
		if was2:
			count += 1
	print(count, alice_sum, bob_sum)


import sys
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, sys.stdin.readline().split()))
	i = 0
	moves = 0
	a = 0
	b = 0
	prev = 0
	flag = 0
	while flag == 0:
		summ = 0
		if i % 2 == 0:
			while summ <= prev:
				size = arr.pop(0)
				a += size
				summ += size
				n -= 1
				if n <= 0:
					moves += 1
					flag = 1
					break
		else:
			while summ <= prev:
				size = arr.pop(-1)
				b += size
				summ += size
				n -= 1
				if n <= 0:
					moves += 1
					flag = 1
					break
		prev = summ
		i += 1
		if flag == 0:
			moves += 1
	print(moves, a, b)
	t -= 1


t = int(input())
elem = []
res = []
for i in range(t):
	n = int(input())
	elem.append(list(map(int, input().split())))
for name in elem:
	a = name[0]
	num = 1
	b = 0
	m = name[0]
	name = name[1:]
	fl = True
	while len(name) > 0:
		s = 0
		num += 1
		if fl:
			while s <= m and len(name) > 0:
				s += name[-1]
				name = name[:-1]
			b += s
			m = s
			fl = False
		else:
			while s <= m and len(name) > 0:
				s += name[0]
				name = name[1:]
			a += s
			m = s
			fl = True
	print(num, a, b)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	l = len(a)
	i = j = tas = tbs = pbs = bs = 0
	tm = 1
	als = a[i]
	while i <= l - j - 1 and i < l and (j < l):
		if i >= 1 and i <= l - j - 1:
			als = a[i]
			tm += 1
			if pbs >= als:
				while pbs >= als and i < l - j - 1:
					i += 1
					als += a[i]
		if i < l - j - 1:
			bs = a[l - j - 1]
			tm += 1
			if als >= bs:
				while als >= bs and l - j - 2 > i:
					j += 1
					bs += a[l - j - 1]
		i += 1
		j += 1
		tas += als
		tbs += bs
		pbs = bs
		als = 0
		bs = 0
	print(tm, end=' ')
	print(tas, end=' ')
	print(tbs)
	t = t - 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	moves = 0
	alice = 0
	bob = 0
	prev = 0
	chance = True
	while l <= r:
		if chance:
			s = 0
			if a[l] >= prev:
				alice += a[l]
				prev = a[l] + 1
				l += 1
				moves += 1
			else:
				while s < prev and l <= r:
					s += a[l]
					l += 1
				if s >= prev:
					alice += s
					moves += 1
				else:
					alice += s
					moves += 1
					break
				prev = s + 1
			chance = False
		else:
			s = 0
			if a[r] >= prev:
				bob += a[r]
				prev = a[r] + 1
				r -= 1
				moves += 1
			else:
				while s < prev and r >= l:
					s += a[r]
					r -= 1
				if s >= prev:
					bob += s
					moves += 1
				else:
					bob += s
					moves += 1
					break
				prev = s + 1
			chance = True
	print(moves, alice, bob)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	moves = 0
	alice = 0
	bob = 0
	curr = 0
	l = -1
	r = n
	f = 0
	t = 0
	z = -1
	while r - l > 1:
		t = 0
		if f == 0:
			for i in range(l + 1, r):
				t += a[i]
				if t > curr:
					alice += t
					curr = t
					moves += 1
					l = i
					f = 1
					break
			if f == 0:
				break
		else:
			for i in range(r - 1, l, -1):
				t += a[i]
				if t > curr:
					bob += t
					curr = t
					moves += 1
					r = i
					f = 0
					break
			if f == 1:
				break
	if f == 0 and t != 0 and (r - l != 1):
		alice += t
		moves += 1
	elif f == 1 and t != 0 and (r - l != 1):
		bob += t
		moves += 1
	print(str(moves) + ' ' + str(alice) + ' ' + str(bob))


t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	(A, B) = (0, n - 1)
	S = sum(c)
	(Ac, Bc) = (0, 0)
	(Acs, Bcs) = (0, 0)
	turn = 0
	flg = True
	while flg:
		if turn % 2 == 0:
			Ac = 0
			if S <= Bc:
				Acs += S
				if S > 0:
					turn += 1
				flg = False
				break
			else:
				while Ac <= Bc:
					Ac += c[A]
					Acs += c[A]
					S -= c[A]
					A += 1
		else:
			Bc = 0
			if S <= Ac:
				Bcs += S
				if S > 0:
					turn += 1
				flg = False
				break
			else:
				while Ac >= Bc:
					Bc += c[B]
					Bcs += c[B]
					S -= c[B]
					B -= 1
		turn += 1
	print(turn, Acs, Bcs)


def Move(prev, lis, a, b, moves):
	while True:
		moves += 1
		s = 0
		while s <= prev:
			nlis = lis[1:]
			s += lis[0]
			lis = nlis
			if len(lis) == 0:
				a += s
				return (a, b, moves)
		prev = s
		a += s
		moves += 1
		s = 0
		while s <= prev:
			nlis = lis[:-1]
			s += lis[-1]
			lis = nlis
			if len(lis) == 0:
				b += s
				return (a, b, moves)
		prev = s
		b += s
	return (a, b, moves)
t = int(input())
output = []
for i in range(t):
	x = input()
	lis = input().split()
	for i in range(len(lis)):
		lis[i] = int(lis[i])
	(a, b, move) = Move(0, lis, 0, 0, 0)
	output.append(str(move) + ' ' + str(a) + ' ' + str(b))
for i in output:
	print(i)


def readInt():
	return int(input())

def readList():
	return list(map(int, input().rstrip().split()))

def readString():
	s = input()
	return s

def readInts():
	return map(int, input().rstrip().split())

def solve(n, arr):
	(ialice, ibob) = (0, len(arr) - 1)
	cntbob = 0
	cntalice = 0
	prev = 0
	move = 0
	palice = True
	while ialice <= ibob:
		eaten = 0
		if palice:
			while ialice < len(arr) and eaten <= prev and (ialice <= ibob):
				c = arr[ialice]
				cntalice += c
				eaten += c
				ialice += 1
		else:
			while ibob >= 0 and eaten <= prev and (ialice <= ibob):
				c = arr[ibob]
				cntbob += c
				eaten += c
				ibob -= 1
		prev = eaten
		move += 1
		palice = not palice
	print('{} {} {}'.format(move, cntalice, cntbob))
t = readInt()
for i in range(t):
	n = readInt()
	arr = readList()
	solve(n, arr)


t = int(input())
while t:
	n = int(input())
	lst = list(map(int, input().split()))
	move = 0
	(i, j) = (0, n - 1)
	(a, b) = (lst[0], 0)
	prev = lst[0]
	flag = 2
	lst.remove(lst[0])
	j -= 1
	while len(lst) > 0:
		move += 1
		curr = 0
		while curr <= prev and flag % 2 == 0 and (len(lst) > 0):
			curr += lst[j]
			b += lst[j]
			lst.pop(j)
			j -= 1
		while curr <= prev and flag % 2 == 1 and (len(lst) > 0):
			curr += lst[i]
			a += lst[i]
			lst.pop(i)
			j -= 1
		flag += 1
		prev = curr
	print(move + 1, a, b)
	t -= 1


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	candy = 0
	(A, B) = (0, 0)
	q = deque(a)
	move = 0
	while q:
		tmp_A = 0
		while tmp_A <= candy and q:
			tmp_A += q.popleft()
		A += tmp_A
		candy = tmp_A
		tmp_B = 0
		move += 1
		if q:
			while tmp_B <= candy and q:
				tmp_B += q.pop()
			B += tmp_B
			candy = tmp_B
			move += 1
	output = [move, A, B]
	print(*output)


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
mp = lambda : map(int, input().split())
for _ in range(int(input())):
	n = inp()
	x = ip()
	(a, b) = (0, 0)
	(pa, pb) = (0, 0)
	ctr = 0
	while x:
		t = 0
		while t <= pb and x:
			t += x[0]
			del x[0]
		a += t
		pa = t
		if t:
			ctr += 1
		t = 0
		while t <= pa and x:
			t += x[-1]
			del x[-1]
		b += t
		pb = t
		if t:
			ctr += 1
	print(ctr, a, b)


from collections import deque
T = int(input())
for i in range(T):
	N = int(input())
	A = deque(list(map(int, input().split())))
	(alice, bob) = (0, 0)
	prev = 0
	now = 0
	turn = 1
	flag = 0
	while 1:
		while now <= prev:
			if turn % 2:
				tmp = A.popleft()
				now += tmp
				alice += tmp
			else:
				tmp = A.pop()
				now += tmp
				bob += tmp
			if not A:
				flag = 1
				break
		if flag:
			break
		prev = now
		now = 0
		turn += 1
	print(turn, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	a_sum = b_sum = 0
	last = 0
	i = 0
	j = n - 1
	moves = 0
	while i <= j:
		eaten = 0
		while eaten <= last and i <= j:
			eaten += a[i]
			a[i] = 0
			i += 1
		a_sum += eaten
		last = eaten
		moves += 1
		if i <= j:
			eaten = 0
			while eaten <= last and i <= j:
				eaten += a[j]
				a[j] = 0
				j -= 1
			b_sum += eaten
			last = eaten
			moves += 1
	print(moves, a_sum, b_sum)


from collections import deque
t = int(input())

def solve(candies: deque):
	alices_turn = True
	alice_ate_total = 0
	bob_ate_total = 0
	alice_ate_last_turn = 0
	bob_ate_last_turn = 0
	turns_done = 0
	while candies:
		if alices_turn:
			alice_ate_current_turn = 0
			while alice_ate_current_turn <= bob_ate_last_turn and candies:
				alice_ate_current_turn += candies.popleft()
			alice_ate_last_turn = alice_ate_current_turn
			alice_ate_total += alice_ate_current_turn
			alices_turn = False
		elif not alices_turn:
			bob_ate_current_turn = 0
			while bob_ate_current_turn <= alice_ate_last_turn and candies:
				bob_ate_current_turn += candies.pop()
			bob_ate_last_turn = bob_ate_current_turn
			bob_ate_total += bob_ate_current_turn
			alices_turn = True
		turns_done += 1
	print(turns_done, alice_ate_total, bob_ate_total, flush=False)
for _ in range(t):
	n = int(input())
	candies = deque((int(s) for s in input().split(' ')))
	solve(candies)


import sys
t = int(input())
for j in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	i = 0
	j = n - 1
	f = 0
	pr = 0
	a = 0
	b = 0
	m = 0
	s = 0
	while i <= j:
		if f == 0:
			k = i
			s = arr[k]
			while k < j and s <= pr:
				k += 1
				s = s + arr[k]
			i = k + 1
			a = a + s
			m += 1
			f = 1
			pr = s
		else:
			k = j
			s = arr[k]
			while k > i and s <= pr:
				k -= 1
				s = s + arr[k]
			j = k - 1
			b = b + s
			m += 1
			pr = s
			f = 0
	print(m, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	aa = 0
	saa = 0
	bb = 0
	sbb = 0
	l = 0
	r = n - 1
	turn = 0
	c = 0
	while l <= r:
		if turn == 0:
			aa = 0
			while l <= r and aa <= bb:
				aa += a[l]
				l += 1
			saa += aa
			turn = 1
		elif turn == 1:
			bb = 0
			while r >= l and bb <= aa:
				bb += a[r]
				r -= 1
			sbb += bb
			turn = 0
		c += 1
	print(c, saa, sbb)


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	i = 0
	j = n - 1
	c = 0
	al = 0
	ml = 0
	le = 0
	while i <= j:
		sum = 0
		if c % 2 == 0:
			while sum <= le and i <= j:
				al += x[i]
				sum += x[i]
				i += 1
			c += 1
			if le > sum:
				break
			le = sum
		else:
			while sum <= le and i <= j:
				ml += x[j]
				sum += x[j]
				j -= 1
			c += 1
			if le > sum:
				break
			le = sum
	print(c, al, ml)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	alice = arr[0]
	alice_curr = arr[0]
	arr.pop(0)
	bob = 0
	bob_curr = 0
	move = 1
	while len(arr):
		move += 1
		if sum(arr) <= alice_curr:
			bob += sum(arr)
			break
		bob_curr = 0
		while len(arr):
			bob_curr += arr[-1]
			arr.pop()
			if bob_curr > alice_curr:
				bob += bob_curr
				break
		if len(arr):
			move += 1
		if sum(arr) <= bob_curr:
			alice += sum(arr)
			break
		alice_curr = 0
		while len(arr):
			alice_curr += arr[0]
			arr.pop(0)
			if alice_curr > bob_curr:
				alice += alice_curr
				break
	print(move, alice, bob)


t = int(input())
for _ in range(t):
	input()
	A = list(map(int, input().split()))
	sa = 0
	sb = 0
	low = 0
	high = len(A) - 1
	turn = 0
	threshold = 0
	while sa + sb < sum(A):
		if turn % 2 == 0:
			ca = 0
			while low <= high and low < len(A) and (ca <= threshold):
				ca += A[low]
				low += 1
			sa += ca
			threshold = ca
		else:
			cb = 0
			while low <= high and high > 0 and (cb <= threshold):
				cb += A[high]
				high -= 1
			sb += cb
			threshold = cb
		turn += 1
	print(turn, sa, sb)


from collections import deque as de
for _ in range(int(input())):
	a = input()
	d = de(map(int, input().split()))
	(alice, bob) = (0, 0)
	(frst, scnd) = (0, 0)
	moves = 0
	turn = 1
	while d:
		if turn:
			while d and frst <= scnd:
				frst += d.popleft()
			alice += frst
			turn = 1 - turn
			scnd = 0
		else:
			while d and scnd <= frst:
				scnd += d.pop()
			bob += scnd
			turn = 1 - turn
			frst = 0
		moves += 1
	print(moves, alice, bob)


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, input().split()))
	(res, alice, bob) = (1, a[0], 0)
	i = 1
	j = n - 1
	al = False
	prev_a = a[0]
	prev_b = 0
	while i <= j:
		res += 1
		t = 0
		prev_move = prev_b if al else prev_a
		while t <= prev_move and i <= j:
			if al:
				t += a[i]
				i += 1
			else:
				t += a[j]
				j -= 1
		if al:
			alice += t
			prev_a = t
		else:
			bob += t
			prev_b = t
		al = not al
	print(res, alice, bob)


def fD(arr):
	lsum = 0
	count = 0
	alice = 0
	bob = 0
	start = 0
	end = len(arr) - 1
	while start <= end:
		candy = 0
		if count % 2 == 0:
			while lsum >= candy and start <= end:
				candy += arr[start]
				start += 1
			alice += candy
			lsum = candy
			count += 1
		elif count % 2 != 0:
			while lsum >= candy and start <= end:
				candy += arr[end]
				end -= 1
			bob += candy
			lsum = candy
			count += 1
	return (count, alice, bob)
n = int(input())
for i in range(n):
	k = int(input())
	l = list(map(int, input().split()))
	r = fD(l)
	if r != None:
		for j in r:
			print(j, end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	for i in range(n):
		a[i] = int(a[i])
	A = a[0]
	B = 0
	mv = 1
	last = a[0]
	idxA = 1
	idxB = n - 1
	while idxA <= idxB:
		sum = 0
		mv = mv + 1
		while idxA <= idxB and sum <= last:
			B = B + a[idxB]
			sum = sum + a[idxB]
			idxB = idxB - 1
		last = sum
		if idxA <= idxB:
			mv = mv + 1
			sum = 0
			while idxA <= idxB and sum <= last:
				A = A + a[idxA]
				sum = sum + a[idxA]
				idxA = idxA + 1
			last = sum
	print(str(mv) + ' ' + str(A) + ' ' + str(B))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	alice = []
	bob = []
	move = 1
	alice.append(a[0])
	last = a[0]
	a.pop(0)
	turn = 'b'
	while len(a) > 0:
		if turn == 'a':
			s = 0
			while last >= 0 and len(a) > 0:
				candie = a[0]
				a.pop(0)
				last -= candie
				s += candie
				alice.append(candie)
			turn = 'b'
			last = s
		elif turn == 'b':
			s = 0
			while last >= 0 and len(a) > 0:
				candie = a[-1]
				a.pop()
				last -= candie
				s += candie
				bob.append(candie)
			last = s
			turn = 'a'
		move += 1
	print(move, sum(alice), sum(bob))


import os
import sys
from io import BytesIO, IOBase
import threading

def main():
	for i in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split()))
		start = 0
		end = n - 1
		p_s = 0
		t_s = 0
		p_e = 0
		moves = 0
		while start <= end:
			c_s = arr[start]
			while start + 1 <= end and c_s <= p_e:
				start += 1
				c_s += arr[start]
			moves += 1
			if c_s > p_e and start < end:
				t_s += c_s
				p_s = c_s
				start += 1
			else:
				t_s += c_s
				break
			c_e = arr[end]
			while end - 1 >= start and c_e <= p_s:
				end -= 1
				c_e += arr[end]
			moves += 1
			if c_e > p_s:
				p_e = c_e
				end -= 1
			else:
				break
		print(moves, t_s, sum(arr) - t_s)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = 1
	j = n - 1
	a = l[0]
	b = 0
	ansa = l[0]
	ansb = 0
	turn = 0
	count = 1
	while i <= j:
		if turn % 2:
			start = 0
			while start <= b and i <= j:
				start += l[i]
				i += 1
			a = start
			ansa += a
		else:
			start = 0
			while start <= a and j >= i:
				start += l[j]
				j -= 1
			b = start
			ansb += b
		count += 1
		turn = 1 - turn
	print(count, ansa, ansb)


def solve(arr):
	a = arr.pop(0)
	asum = a
	b = bsum = 0
	index = 'b'
	counter = 1
	while len(arr) > 0:
		if len(arr) == 1:
			counter += 1
		if index == 'b':
			x = arr.pop()
			b += x
			bsum += x
			if b > a and len(arr) > 0:
				index = 'a'
				a = 0
				counter += 1
		elif index == 'a':
			x = arr.pop(0)
			a += x
			asum += x
			if a > b and len(arr) > 0:
				index = 'b'
				b = 0
				counter += 1
	print('{} {} {}'.format(counter, asum, bsum))
i = int(input())
for k in range(i):
	c = int(input())
	j = input().split(' ')
	arr = list(map(int, j))
	solve(arr)


input = __import__('sys').stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cur = a[0]
	cur2 = 0
	alice = a[0]
	del a[0]
	bob = 0
	turn = 1
	fnd = False
	idk = 0
	while len(a) > 0:
		cnt = 0
		if idk != 0:
			cur = cur2
		else:
			idk += 1
		cur2 = 0
		if turn % 2 == 1:
			while cnt <= cur:
				if sum(a) < cur - cur2 or sum(a) == 0:
					turn += 1
					bob += sum(a)
					fnd = True
					break
				cnt += a[-1]
				bob += a[-1]
				cur2 += a[-1]
				del a[-1]
			if not fnd:
				turn += 1
			else:
				break
		elif turn % 2 == 0:
			while cnt <= cur:
				if sum(a) < cur - cur2 or sum(a) == 0:
					turn += 1
					alice += sum(a)
					fnd = True
					break
				cnt += a[0]
				alice += a[0]
				cur2 += a[0]
				del a[0]
			if not fnd:
				turn += 1
			else:
				break
	print(turn, alice, bob)


class answer:

	def __init__(self, a, b, moves):
		self.a = a
		self.b = b
		self.moves = moves

	def output(self):
		print(f'{self.moves} {self.a} {self.b}')

	def refresh(self):
		self.a = 0
		self.b = 0
		self.moves = 0

class candygame:

	def __init__(self, n, candy_list, answer_tmp=answer(0, 0, 0), left_last=0, right_last=0):
		self.n = n
		self.candy_list = candy_list
		self.answer_tmp = answer_tmp
		self.left_last = left_last
		self.right_last = right_last

	def eat_left(self):
		tmp = 0
		limit = self.right_last
		while tmp <= limit and self.n > 0:
			tmp += self.candy_list.pop(0)
			self.n -= 1
		self.answer_tmp.moves += 1
		self.answer_tmp.a += tmp
		self.left_last = tmp

	def eat_right(self):
		tmp = 0
		limit = self.left_last
		while tmp <= limit and self.n > 0:
			tmp += self.candy_list.pop()
			self.n -= 1
		self.answer_tmp.moves += 1
		self.answer_tmp.b += tmp
		self.right_last = tmp

	def solve(self):
		while self.n > 0:
			self.eat_left()
			if self.n > 0:
				self.eat_right()
		return self.answer_tmp
start_ans = answer(0, 0, 0)
t = int(input())
for i in range(t):
	n = int(input())
	inp_str = input()
	input_candies = [int(j) for j in inp_str.split(' ')]
	game = candygame(n, input_candies, start_ans)
	answer = game.solve()
	answer.output()
	start_ans.refresh()


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(a, b) = (l[0], 0)
	m = 1
	ka = l[0]
	(i, j) = (1, n - 1)
	f = 1
	while i <= j:
		if f == 1:
			s = 0
			while i <= j and s <= ka:
				s = s + l[j]
				j = j - 1
			b = b + s
			f = 0
			ka = s
			m = m + 1
		else:
			s = 0
			while i <= j and s <= ka:
				s = s + l[i]
				i = i + 1
			a = a + s
			f = 1
			ka = s
			m = m + 1
	print(m, a, b)


def one_case():
	n = int(input())
	a = list(map(int, input().split()))
	count = [0, 0]
	last = 0
	dir = True
	times = 0
	while len(a) > 0:
		if dir:
			sum = 0
			for i in range(len(a)):
				sum += a[i]
				if sum > last:
					break
			last = sum
			count[0] += sum
			a = a[i + 1:]
		else:
			sum = 0
			for i in range(len(a) - 1, -1, -1):
				sum += a[i]
				if sum > last:
					break
			last = sum
			count[1] += sum
			a = a[:i]
		dir = not dir
		times += 1
	print(times, count[0], count[1])
t = int(input())
for i in range(t):
	one_case()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	c = 0
	cu1 = 0
	cu2 = 0
	f = 0
	while l != []:
		if f == 1:
			i = -1
			f1 = 0
			while cu2 <= cu1:
				try:
					cu2 += l[i]
					i -= 1
				except:
					f1 = 1
					break
			c += 1
			cu1 = 0
			c2 += cu2
			f = 0
			l = l[:i + 1]
			if f1 == 1:
				break
		else:
			i = 0
			f2 = 0
			while cu1 <= cu2:
				try:
					cu1 += l[i]
					i += 1
				except:
					f2 = 1
					break
			c += 1
			cu2 = 0
			c1 += cu1
			f = 1
			l = l[i:]
			if f2 == 1:
				break
	print(c, c1, c2)


t = int(input())
for i in range(t):
	n = int(input())
	main = list(map(int, input().split()))
	suml = 0
	sumr = 0
	a = 0
	b = 0
	r = 0
	l = -1
	count = 0
	while n > 0:
		for j in range(2):
			if j == 0:
				if len(main) == 0:
					break
				suml = 0
				count += 1
				suml = main[r]
				a += main[r]
				pop = main.pop(r)
				n = n - 1
				while suml <= sumr:
					if len(main) == 0:
						break
					suml = suml + main[r]
					a += main[r]
					pop = main.pop(r)
					n = n - 1
			else:
				if len(main) == 0:
					break
				sumr = 0
				count += 1
				sumr = main[l]
				b += main[l]
				pop = main.pop(l)
				n = n - 1
				while sumr <= suml:
					if len(main) == 0:
						break
					sumr = sumr + main[l]
					b += main[l]
					pop = main.pop(l)
					n = n - 1
	result = [count, a, b]
	for ok in result:
		print(ok, end=' ')
	print(end='\n')


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	ialice = 0
	ibob = n - 1
	(nalice, nbob) = (0, 0)
	moves = 0
	previous = 0
	while ialice <= ibob:
		nnalice = 0
		while nnalice <= previous and ialice <= ibob:
			nnalice += a[ialice]
			ialice += 1
		if nnalice > 0:
			moves += 1
			previous = nnalice
			nalice += nnalice
		nnbob = 0
		while nnbob <= previous and ialice <= ibob:
			nnbob += a[ibob]
			ibob -= 1
		if nnbob:
			moves += 1
			previous = nnbob
			nbob += nnbob
	print(f'{moves} {nalice} {nbob}')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


for i1 in range(int(input())):
	n = int(input())
	list1 = list(map(int, input().split()))
	if n == 1:
		print(1, list1[0], 0)
		continue
	if n == 2:
		print(2, list1[0], list1[1])
		continue
	c = 0
	a = 0
	b = 0
	x = -1
	i = 0
	sum_a = 0
	sum_b = 0
	t = 0
	while len(list1) != 0:
		if t == 0:
			sum_a += list1[i]
			if sum_a > sum_b:
				a += sum_a
				c += 1
				sum_b = 0
				t = 1
			list1.remove(list1[0])
		else:
			sum_b += list1[x]
			if sum_b > sum_a:
				b += sum_b
				c += 1
				t = 0
				sum_a = 0
			list1.reverse()
			list1.remove(list1[0])
			list1.reverse()
	if sum_a >= sum_b and t == 1 and (sum_b != 0):
		b += sum_b
		c += 1
	elif sum_a <= sum_b and t == 0 and (sum_a != 0):
		a += sum_a
		c += 1
	print(c, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	prev_sum = arr[0]
	moves = 1
	l = 1
	r = len(arr) - 1
	flag_alice = True
	a = arr[0]
	b = 0
	while l <= r:
		if flag_alice == True:
			cur_sum = 0
			while cur_sum <= prev_sum:
				cur_sum += arr[r]
				r -= 1
				if r < l:
					break
			prev_sum = cur_sum
			b += cur_sum
			flag_alice = False
			moves += 1
		else:
			cur_sum = 0
			while cur_sum <= prev_sum:
				cur_sum += arr[l]
				l += 1
				if l > r:
					break
			prev_sum = cur_sum
			a += cur_sum
			flag_alice = True
			moves += 1
	print(moves, a, b)


def main():
	t = int(input())
	while t > 0:
		n = int(input())
		l = list(map(int, input().split()))
		a = 0
		b = 0
		total_a = 0
		total_b = 0
		turn = 0
		while l:
			if turn % 2 == 0:
				a = 0
				while a <= b and l:
					a += l[0]
					l = l[1:]
				total_a += a
			else:
				l.reverse()
				b = 0
				while b <= a and l:
					b += l[0]
					l = l[1:]
				l.reverse()
				total_b += b
			turn += 1
		print(turn, total_a, total_b)
		t -= 1
main()


import sys
import collections
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = collections.deque(map(int, sys.stdin.readline().split()))
	move_cnt = 0
	judge = False
	total_a = 0
	total_b = 0
	a = 0
	b = 0
	while True:
		temp_a = 0
		for i in range(len(arr)):
			a += arr[i]
			temp_a += arr[i]
			if i == len(arr) - 1 and a <= b:
				judge = True
			if a > b:
				for _ in range(i + 1):
					arr.popleft()
				break
		b = 0
		total_a += temp_a
		move_cnt += 1
		if judge == True or len(arr) == 0:
			print(move_cnt, total_a, total_b)
			break
		temp_b = 0
		for j in range(len(arr) - 1, -1, -1):
			b += arr[j]
			temp_b += arr[j]
			if j == 0 and b <= a:
				judge = True
			if b > a:
				for _ in range(len(arr) - j):
					arr.pop()
				break
		a = 0
		total_b += temp_b
		move_cnt += 1
		if judge == True or len(arr) == 0:
			print(move_cnt, total_a, total_b)
			break


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	l = 0
	r = n
	moves = 0
	sum_l = 0
	sum_r = 0
	cur_l = 0
	cur_r = 0
	prev = 0
	flag = 0
	while l < r:
		if flag == 0:
			moves += 1
			cur_l = 0
			while cur_l <= prev and l < r:
				cur_l += a[l]
				l += 1
			prev = cur_l
			sum_l += cur_l
			flag = 1
		else:
			moves += 1
			cur_r = 0
			while cur_r <= prev and l < r:
				r -= 1
				cur_r += a[r]
			prev = cur_r
			sum_r += cur_r
			flag = 0
	print(moves, sum_l, sum_r)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	p1 = 0
	p2 = 0
	eatenA = 0
	eatenB = 0
	moves = 0
	lastB = 0
	lastA = 0
	while len(arr) > 0:
		while lastA <= lastB:
			eatenA += arr[0]
			lastA += arr[0]
			del arr[0]
			if len(arr) == 0:
				break
		moves += 1
		if len(arr) == 0:
			break
		lastB = 0
		while lastB <= lastA:
			if len(arr) == 0:
				break
			eatenB += arr[-1]
			lastB += arr[-1]
			del arr[-1]
		moves += 1
		lastA = 0
	print(moves, eatenA, eatenB)


import sys
input = sys.stdin.readline

def cum_sum(lst):
	cums = [0] * (len(lst) + 1)
	cums[1] = lst[0]
	for i in range(2, len(lst) + 1):
		cums[i] = cums[i - 1] + lst[i - 1]
	return cums
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ac = cum_sum(a)
	a_l = -1
	b_l = n
	nolma = 0
	ans = 0
	while True:
		cnt = 0
		while cnt <= nolma:
			if a_l == n - 1:
				break
			a_l += 1
			cnt += a[a_l]
			if a_l + 1 == b_l:
				break
		nolma = cnt
		ans += 1
		if a_l + 1 == b_l:
			break
		cnt = 0
		while cnt <= nolma:
			if b_l == 0:
				break
			b_l -= 1
			cnt += a[b_l]
			if a_l == b_l - 1:
				break
		nolma = cnt
		ans += 1
		if a_l == b_l - 1:
			break
	print(ans, ac[a_l + 1], sum(a) - ac[a_l + 1])


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 collections import deque
t = int(input())

def solve():
	t = int(input())
	q = deque(list(map(int, input().split())))
	na = q.popleft()
	nb = 0
	cnt = 1
	prev = na
	while len(q) > 0:
		tmp = 0
		if cnt % 2 == 1:
			while prev >= tmp and len(q) > 0:
				tmp += q.pop()
			prev = tmp
			nb += tmp
		else:
			while prev >= tmp and len(q) > 0:
				tmp += q.popleft()
			prev = tmp
			na += tmp
		cnt += 1
	return (cnt, na, nb)
ans = []
for i in range(t):
	ans.append(solve())
for a in ans:
	print(*a)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	d = 0
	m = 0
	(x, y) = (0, 0)
	i = 0
	while len(a) > 0:
		if i == 0:
			x = x + a[0]
			c = c + a[0]
			a.remove(a[0])
			if c > d:
				d = c
				c = 0
				m = m + 1
				i = 1
			elif len(a) == 1:
				x = x + a[0]
				m = m + 1
				a.remove(a[0])
				break
			elif len(a) == 0:
				m = m + 1
		else:
			a.reverse()
			y = y + a[0]
			c = c + a[0]
			a.remove(a[0])
			a.reverse()
			if c > d:
				d = c
				c = 0
				m = m + 1
				i = 0
			elif len(a) == 1:
				y = y + a[len(a) - 1]
				m = m + 1
				a.remove(a[len(a) - 1])
				break
			elif len(a) == 0:
				m = m + 1
	print(m, x, y)


import math
from sys import stdin, stdout
from heapq import heapify, heappop, heappush
from collections import Counter
T = int(stdin.readline())
for i in range(T):
	N = int(stdin.readline())
	cnd = list(map(int, stdin.readline().split()))
	A = 0
	B = 0
	mvs = 0
	pB = 0
	pA = 0
	ta = 1
	tb = 0
	while cnd:
		if ta:
			cA = 0
			if cnd:
				mvs += 1
			while cA <= pB and cnd:
				cA += cnd[0]
				A += cnd[0]
				cnd.pop(0)
			if not cnd:
				break
			ta = 0
			tb = 1
			pA = cA
		elif tb:
			cB = 0
			if cnd:
				mvs += 1
			while cB <= pA and cnd:
				cB += cnd[-1]
				B += cnd[-1]
				cnd.pop()
			if not cnd:
				break
			ta = 1
			tb = 0
			pB = cB
	print(mvs, A, B)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(1, a[0], 0)
		continue
	alice = 0
	bob = 0
	move = 0
	eat = 1
	pre = 0
	tmp = 0
	while a != []:
		if eat:
			tmp = a[0]
			a.pop(0)
			while tmp <= pre and a != []:
				tmp += a[0]
				a.pop(0)
			pre = tmp
			eat = 0
			move += 1
			alice += tmp
		else:
			tmp = a[-1]
			a.pop(-1)
			while tmp <= pre and a != []:
				tmp += a[-1]
				a.pop(-1)
			pre = tmp
			eat = 1
			move += 1
			bob += tmp
	print(move, alice, bob)


import collections

def solution(deq):
	cnt = 0
	(eat_left, eat_right) = (0, 0)
	flag_left = True
	prev = 0
	while len(deq) > 0:
		cur = 0
		cnt += 1
		if flag_left:
			while cur <= prev:
				if len(deq) == 0:
					break
				item = deq.popleft()
				cur += item
				eat_left += item
			flag_left = False
		else:
			while cur <= prev:
				if len(deq) == 0:
					break
				item = deq.pop()
				cur += item
				eat_right += item
			flag_left = True
		prev = cur
	print(cnt, eat_left, eat_right)
inp = int(input())
for _ in range(inp):
	_ = input()
	input_ = tuple(map(int, input().split()))
	deq = collections.deque()
	deq.extend(input_)
	solution(deq)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = a[0]
	moves = 1
	alice = 0
	bob = 0
	alice += a[0]
	a.remove(a[0])
	while len(a) != 0:
		y = 0
		if moves % 2 != 0:
			while x + 1 > y:
				z = a.pop()
				y = y + z
				if len(a) == 0:
					break
			moves += 1
			bob += y
			x = y
		else:
			while x + 1 > y:
				z = a[0]
				a.remove(a[0])
				y = y + z
				if len(a) == 0:
					break
			moves += 1
			alice += y
			x = y
	print(moves, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	lista = list(map(int, input().split()))
	Alice = []
	Bob = []
	Alice.append(lista[0])
	sum_A = lista[0]
	sum_B = 0
	mark_A = 1
	moves = 1
	mark_B = len(lista) - 1
	while len(Alice) + len(Bob) < len(lista):
		if sum_A > sum_B and len(Alice) + len(Bob) < len(lista):
			sum_B = sum_B + lista[mark_B]
			Bob.append(lista[mark_B])
			mark_B -= 1
			moves += 1
			while sum_A >= sum_B and len(Alice) + len(Bob) < len(lista):
				sum_B = sum_B + lista[mark_B]
				Bob.append(lista[mark_B])
				mark_B -= 1
			sum_A = 0
		if sum_A < sum_B and len(Alice) + len(Bob) < len(lista):
			sum_A = sum_A + lista[mark_A]
			Alice.append(lista[mark_A])
			mark_A += 1
			moves += 1
			while sum_A <= sum_B and len(Alice) + len(Bob) < len(lista):
				sum_A = sum_A + lista[mark_A]
				Alice.append(lista[mark_A])
				mark_A += 1
			sum_B = 0
	print(moves, sum(Alice), sum(Bob))


T = int(input())

def ans(N, candy):
	pos = [0, N - 1]
	ate = [0, 0]
	turn = 0
	last_turn_ate = 0
	this_turn_ate = 0
	moves = 0
	while pos[0] <= pos[1]:
		this_turn_ate += candy[pos[turn]]
		ate[turn] += candy[pos[turn]]
		pos[turn] += [1, -1][turn]
		if pos[0] > pos[1]:
			break
		if this_turn_ate > last_turn_ate:
			turn = 1 - turn
			moves += 1
			last_turn_ate = this_turn_ate
			this_turn_ate = 0
	return ' '.join([str(moves + 1), str(ate[0]), str(ate[1])])
for t in range(T):
	N = int(input())
	candy = input().split(' ')
	candy = [int(x) for x in candy]
	print(ans(N, candy))


for j in range(int(input())):
	(l, r) = (0, int(input()) - 1)
	q = [int(w) for w in input().split()]
	(k, a, b, sa, sb) = (0, 0, 0, 0, 0)
	while l <= r:
		sa = 0
		while l <= r and sa <= sb:
			sa += q[l]
			l += 1
		sb = 0
		while l <= r and sa >= sb:
			sb += q[r]
			r -= 1
		a += sa
		b += sb
		k += (sa > 0) + (sb > 0)
	print(k, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	alice = 1
	bob = n - 1
	alicesum = a[0]
	bobsum = 0
	previous_alice = a[0]
	previous_bob = 0
	pos = 1
	moves = 1
	while alice <= bob:
		if pos == 0:
			pos = 1
			cursum = 0
			while cursum <= previous_bob and alice <= bob:
				alicesum = alicesum + a[alice]
				cursum = cursum + a[alice]
				alice = alice + 1
			previous_alice = cursum
		else:
			pos = 0
			cursum = 0
			while cursum <= previous_alice and alice <= bob:
				bobsum = bobsum + a[bob]
				cursum = cursum + a[bob]
				bob = bob - 1
			previous_bob = cursum
		moves = moves + 1
	print(moves, end=' ')
	print(alicesum, end=' ')
	print(bobsum)


for i in range(int(input())):
	(n, a) = (int(input()), list(map(int, input().split(' '))))
	(mov, prev, i, j, turn, resa, resb) = (0, 0, 0, len(a) - 1, 0, 0, 0)
	while i <= j:
		mov += 1
		sum = 0
		while sum <= prev and i <= j:
			sum = sum + (a[i] if not turn else a[j])
			if not turn:
				i += 1
			else:
				j -= 1
		if not turn:
			resa += sum
		else:
			resb += sum
		prev = sum
		turn ^= 1
	print(mov, resa, resb)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	li = [int(i) for i in input().split(' ')]
	m = 1
	n -= 1
	lim = li[0]
	sa = li[0]
	sb = 0
	flg = 1
	t = 0
	while m != n + 1:
		t += 1
		cur = 0
		if flg:
			while cur <= lim:
				sb += li[n]
				cur += li[n]
				n -= 1
				if m == n + 1:
					break
		else:
			while cur <= lim:
				sa += li[m]
				cur += li[m]
				m += 1
				if m == n + 1:
					break
		lim = cur
		flg ^= 1
	print(t + 1, sa, sb)


tests = int(input())
for i in range(tests):
	n = int(input())
	arr = list(map(int, input().split()))
	k = n - 1
	i = 0
	t = 1
	a = arr.pop(0)
	sum1 = a
	sum2 = 0
	b = 0
	while arr != []:
		f = 0
		while sum2 <= sum1:
			if f == 0:
				t += 1
				f = 1
			c = arr.pop()
			b += c
			sum2 += c
			if arr == []:
				break
		sum1 = 0
		if arr == []:
			break
		f = 0
		while sum1 <= sum2:
			if f == 0:
				t += 1
				f = 1
			c = arr.pop(0)
			a += c
			sum1 += c
			if arr == []:
				break
		sum2 = 0
	print(t, end=' ')
	print(a, end=' ')
	print(b)


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	n = int(input())
	lis = list(map(int, input().split()))
	(i, j, pa, pb) = (0, n - 1, 0, 0)
	(a, b, c) = (0, 0, 0)
	while i <= j:
		d = 0
		while i <= j and d <= pb:
			d += lis[i]
			i += 1
		pa = d
		a += d
		if i <= j:
			c += 1
		d = 0
		while i <= j and d <= pa:
			d += lis[j]
			j -= 1
		pb = d
		b += d
		if i <= j:
			c += 1
	print(c + 1, a, b)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d = 0
	c = 0
	al = 0
	mi = 0
	bo = 0
	k = n - 1
	m = 0
	f = 0
	while d == 0:
		su = 0
		f = 1
		if c % 2 == 0:
			for i in range(m, k + 1):
				su = su + arr[i]
				if su > mi:
					f = 0
					mi = su
					m = i + 1
					break
			al = al + su
		else:
			for i in range(k, m - 1, -1):
				su = su + arr[i]
				if su > mi:
					f = 0
					mi = su
					k = i - 1
					break
			bo = bo + su
		if f == 1 or m > k:
			d = 1
		c = c + 1
	print(c, al, bo)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

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

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(str(i)[2:-1]) for i in input().rstrip()]
for _ in range(val()):
	n = val()
	d = li()
	l = deque()
	for i in d:
		l.append(i)
	moves = 0
	a = b = last = 0
	while len(l):
		curr = 0
		moves += 1
		while len(l) and curr <= last:
			temp = l.popleft()
			curr += temp
			a += temp
		last = curr
		curr = 0
		if not len(l):
			break
		moves += 1
		while len(l) and curr <= last:
			temp = l.pop()
			b += temp
			curr += temp
		last = curr
	print(moves, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	s = [int(i) for i in input().split()]
	(a, b, previous, count) = (0, 0, 0, 0)
	while 1:
		(now, a_before) = (0, a)
		while now <= previous and len(s) > 0:
			a += s[0]
			now += s[0]
			s.pop(0)
		count += 1
		previous = a - a_before
		if len(s) == 0:
			break
		(now, b_before) = (0, b)
		while now <= previous and len(s) > 0:
			b += s[-1]
			now += s[-1]
			s.pop(-1)
		count += 1
		previous = b - b_before
		if len(s) == 0:
			break
	print(count, a, b, sep=' ')


ans = []
for _ in ' ' * int(input()):
	n = int(input())
	arr = list(map(int, input().split()))
	h = 0
	alice_temp = 0
	bob_temp = 0
	i = [0]
	(alice, bob, k) = (0, 0, 0)
	while i:
		if len(arr) != 0:
			if h == 0:
				if alice_temp <= bob_temp:
					alice += arr[0]
					alice_temp += arr[0]
					arr.pop(0)
					if len(arr) == 0:
						k += 1
						bob_temp = 0
				else:
					bob_temp = 0
					h = 1
					k += 1
			elif bob_temp <= alice_temp:
				bob += arr[-1]
				bob_temp += arr[-1]
				arr.pop()
				if len(arr) == 0:
					k += 1
					alice_temp = 0
			else:
				alice_temp = 0
				h = 0
				k += 1
		else:
			ans.append((k, alice, bob))
			break
for i in ans:
	print(*i)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s1 = l[0]
	s2 = 0
	ss1 = l[0]
	ss2 = 0
	cnt = 1
	i = 1
	j = n - 1
	while i <= j:
		if s1 > s2:
			while s1 >= s2 and i <= j:
				s2 += l[j]
				j -= 1
			s1 = 0
		else:
			while s2 >= s1 and i <= j:
				s1 += l[i]
				ss1 += l[i]
				i += 1
			s2 = 0
		cnt += 1
	ss2 = sum(l) - ss1
	print(cnt, ss1, ss2)


for _ in range(int(input())):
	n = int(input())
	can = list(map(int, input().split()))
	a = can.pop(0)
	pre = a
	b = 0
	mov = 1
	tmp = []
	while can:
		if mov % 2:
			while sum(tmp) <= pre:
				try:
					tmp.append(can.pop(-1))
				except IndexError:
					break
			pre = sum(tmp)
			tmp.clear()
			b += pre
		else:
			while sum(tmp) <= pre:
				try:
					tmp.append(can.pop(0))
				except IndexError:
					break
			pre = sum(tmp)
			tmp.clear()
			a += pre
		mov += 1
	print(mov, a, b)


import math
t = int(input())
for u in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	lc = 0
	rc = 0
	sl = 0
	sr = 0
	deff = 0
	ca = 0
	while l <= r:
		deff = 0
		while lc <= rc and l <= r:
			lc += a[l]
			l += 1
			deff = 1
		if deff == 1:
			ca += 1
		sl += lc
		rc = 0
		deff = 0
		while rc <= lc and l <= r:
			rc += a[r]
			r -= 1
			deff = 1
		if deff == 1:
			ca += 1
		sr += rc
		lc = 0
	print(ca, sl, sr)


t = int(input())
for i in range(0, t):
	n = int(input())
	check = list(map(int, input().split(' ')))
	pointer1 = 0
	pointer2 = n - 1
	moves = 0
	sum2 = 0
	total_a = 0
	total_b = 0
	while pointer1 <= pointer2:
		if moves % 2 == 0:
			sum1 = 0
			while sum2 >= sum1 and pointer1 <= pointer2:
				sum1 = sum1 + check[pointer1]
				pointer1 = pointer1 + 1
			total_a = total_a + sum1
		else:
			sum2 = 0
			while sum1 >= sum2 and pointer1 <= pointer2:
				sum2 = sum2 + check[pointer2]
				pointer2 = pointer2 - 1
			total_b = total_b + sum2
		moves = moves + 1
	print(moves, total_a, total_b)


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	i = 0
	j = len(list1) - 1
	p_bob = 0
	p_alice = 0
	bob_s = 0
	alice_s = 0
	f1 = 0
	move = 0
	while i <= j:
		temp1 = 0
		while i < len(list1):
			if i >= j:
				f1 = 1
				alice_s += list1[i]
				move += 1
				break
			temp1 += list1[i]
			alice_s += list1[i]
			if temp1 > p_bob:
				i += 1
				break
			i += 1
		if f1 == 1:
			break
		move += 1
		p_alice = temp1
		p_bob = 0
		temp2 = 0
		while j > 0:
			if j <= i:
				f1 = 1
				bob_s += list1[j]
				move += 1
				break
			temp2 += list1[j]
			bob_s += list1[j]
			if temp2 > p_alice:
				j -= 1
				break
			j -= 1
		if f1 == 1:
			break
		move += 1
		p_bob = temp2
		p_alice = 0
	print(move, alice_s, bob_s)
	t -= 1


def solve(n, sizes):
	last = sizes[0]
	result = {'n_steps': 1, 'a': last, 'b': 0}
	flag_a = 1
	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 math
t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().strip().split(' ')))
	alice = lst[0]
	bob = 0
	j = 1
	k = n - 1
	c = 1
	while j < n and k > 0 and (j <= k):
		f = 0
		if bob < alice:
			while bob <= alice and j < n and (k > 0) and (j <= k):
				bob += lst[k]
				k -= 1
				f = 1
		if f == 1:
			c += 1
		alice = 0
		if bob > alice:
			while bob >= alice and j < n and (k > 0) and (j <= k):
				alice += lst[j]
				j += 1
				f = 2
		if f == 2:
			c += 1
		bob = 0
	alc = sum(lst[:j])
	bo = sum(lst[:k:-1])
	print(c, alc, bo, end=' ')
	print()


t = int(input())
for i1 in range(t):
	l = int(input())
	a = list(map(int, input().split()))
	(turn, turns) = (0, 0)
	(pos_a, pos_b) = (-1, l)
	(sum_a, sum_b) = (0, 0)
	(c, c_last) = (0, 0)
	while True:
		if turn == 0:
			pos_a += 1
			if pos_a >= pos_b:
				if c != 0:
					turns += 1
				break
			c += a[pos_a]
			sum_a += a[pos_a]
			if c > c_last:
				turns += 1
				turn = 1
				c_last = c
				c = 0
		else:
			pos_b -= 1
			if pos_a >= pos_b:
				if c != 0:
					turns += 1
				break
			c += a[pos_b]
			sum_b += a[pos_b]
			if c > c_last:
				turns += 1
				turn = 0
				c_last = c
				c = 0
	print(turns, sum_a, sum_b)


def main():
	caseNum = int(input())
	for _ in range(caseNum):
		(_, candy) = (input(), list(map(int, input().split(' '))))
		(aliceSize, bobSize) = [0, 0]
		(it, maximum) = [0, 0]
		while not isEmpty(candy):
			it += 1
			if it % 2 == 1:
				[candy, aliceSize, maximum] = aliceTurn(candy, aliceSize, maximum)
			else:
				[candy, bobSize, maximum] = bobTurn(candy, bobSize, maximum)
		print(f'{it} {aliceSize} {bobSize}')

def isEmpty(ls):
	return len(ls) == 0

def aliceTurn(candy: list, aliceSize: int, minimum: int):
	return eatCandy(candy, aliceSize, minimum, 0)

def bobTurn(candy: list, bobSize: int, minimum: int):
	return eatCandy(candy, bobSize, minimum, -1)

def eatCandy(candy: list, playerSize: int, minimum: int, loc: int):
	if minimum == 0:
		maximum = candy.pop(loc)
		playerSize += maximum
		return (candy, playerSize, maximum)
	maximum = 0
	while not isEmpty(candy) and minimum >= 0:
		size = candy.pop(loc)
		playerSize += size
		maximum += size
		minimum -= size
	return (candy, playerSize, maximum)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	t1 = a[0]
	c = 1
	i = 1
	j = n - 1
	s1 = 0
	s2 = a[0]
	while i <= j:
		if c % 2 != 0:
			s = 0
			while s <= t1 and i <= j:
				s += a[j]
				j -= 1
			s1 += s
			t1 = s
		else:
			s = 0
			while s <= t1 and i <= j:
				s += a[i]
				i += 1
			s2 += s
			t1 = s
		c += 1
	print(c, s2, s1)


test_cases = int(input())
while test_cases > 0:
	num = input()
	gameData = list(map(int, input().split()))
	move = 1
	a = gameData[0]
	b = 0
	toEat = gameData[0]
	gameState = 1
	del gameData[0]
	while len(gameData) > 0:
		sum1 = 0
		for element in gameData:
			sum1 += element
		if toEat >= sum1:
			if gameState % 2 == 0:
				a += sum1
			else:
				b += sum1
			move += 1
			break
		else:
			curr = 0
			while curr <= toEat:
				if gameState % 2 != 0:
					curr += gameData[-1]
					del gameData[-1]
				else:
					curr += gameData[0]
					del gameData[0]
			if gameState % 2 == 0:
				a += curr
				move += 1
			else:
				b += curr
				move += 1
			toEat = curr
			gameState += 1
	print(move, a, b)
	test_cases -= 1


import sys
from math import ceil
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())
ans = 1
(la, lb) = (1, 1)
for _ in range(cin()):
	n = cin()
	a = li()
	(alice, bob) = (0, 0)
	(ai, bi) = (-1, n)
	mv = 0
	while ai + 1 != bi:
		if mv % 2 == 0:
			alice = 0
			while ai + 1 < bi and alice <= bob:
				ai += 1
				alice += a[ai]
		else:
			bob = 0
			while ai < bi - 1 and bob <= alice:
				bi -= 1
				bob += a[bi]
		mv += 1
	print(mv, sum(a[:ai + 1]), sum(a[bi:]))


for ad in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = 0
	x = 0
	y = 0
	t = 0
	alp = 0
	c = 0
	while alp == 0:
		if t == 0:
			x = 0
			while x <= y:
				try:
					x += l.pop(0)
				except IndexError:
					alp = 1
					break
			a += x
			t = 1
			if x != 0:
				c += 1
		else:
			y = 0
			while x >= y:
				try:
					y += l.pop(-1)
				except IndexError:
					alp = 1
					break
			if y != 0:
				c += 1
			b += y
			t = 0
	print(str(c) + ' ' + str(a) + ' ' + str(b))


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
import threading
import bisect
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	sumA = 0
	sumB = 0
	sumAsA = 0
	sumAsB = 0
	l = 0
	r = n - 1
	turn = 'A'
	answer = 0
	while l <= r:
		if turn == 'A':
			answer += 1
			turn = 'B'
			while sumA <= sumB and l <= r:
				sumA += arr[l]
				sumAsA += arr[l]
				l += 1
			sumB = 0
		else:
			turn = 'A'
			answer += 1
			while sumB <= sumA and l <= r:
				sumB += arr[r]
				sumAsB += arr[r]
				r -= 1
			sumA = 0
	print(answer, sumAsA, sumAsB)


for x in range(int(input())):
	i_cuk = int(input())
	cuksy = list(map(int, input().split()))
	(suma_a, suma_b, ind_a, ind_b, czy_a, kolejki) = (0, 0, 0, i_cuk - 1, True, 0)
	mala_suma_a = 0
	mala_suma_b = 0
	while True:
		if czy_a:
			mala_suma_a = 0
			while mala_suma_a <= mala_suma_b:
				mala_suma_a += cuksy[ind_a]
				suma_a += cuksy[ind_a]
				ind_a += 1
				if ind_a - 1 >= ind_b:
					break
		else:
			mala_suma_b = 0
			while mala_suma_b <= mala_suma_a:
				mala_suma_b += cuksy[ind_b]
				suma_b += cuksy[ind_b]
				ind_b -= 1
				if ind_a >= ind_b + 1:
					break
		czy_a = not czy_a
		kolejki += 1
		if ind_a - 1 >= ind_b:
			break
	print(kolejki, suma_a, suma_b)


for test in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s1 = 0
	s2 = 0
	c1 = 0
	c2 = 0
	t = 0
	move = 0
	i = 0
	j = n - 1
	while i <= j:
		if t == 0:
			c1 = 0
			while c1 <= c2 and i <= j:
				c1 += a[i]
				i += 1
			s1 += c1
		if t == 1:
			c2 = 0
			while c2 <= c1 and i <= j:
				c2 += a[j]
				j -= 1
			s2 += c2
		t ^= 1
		move += 1
	print(move, s1, s2)


t = int(input())
for i in range(t):
	n = int(input())
	weight = [int(s) for s in input().split()]
	alice = 0
	bob = 0
	prev_alice = 0
	prev_bob = 0
	turn = 'A'
	point_alice = 0
	point_bob = len(weight) - 1
	turns = 0
	present_alice = 0
	present_bob = 0
	while point_alice <= point_bob:
		if turn == 'A':
			while present_alice <= prev_bob and point_alice <= point_bob:
				alice += weight[point_alice]
				prev_alice += weight[point_alice]
				present_alice += weight[point_alice]
				point_alice += 1
			prev_bob = 0
			turn = 'B'
			turns += 1
			present_alice = 0
		else:
			while present_bob <= prev_alice and point_alice <= point_bob:
				bob += weight[point_bob]
				prev_bob += weight[point_bob]
				present_bob += weight[point_bob]
				point_bob -= 1
			prev_alice = 0
			turn = 'A'
			turns += 1
			present_bob = 0
	print(turns, alice, bob, end=' ')


t = int(input())
for _ in range(t):
	suma = 0
	sumb = 0
	n = int(input())
	a = list(map(int, input().split()))
	alice = True
	prevb = 0
	cnt = 0
	while len(a) > 0:
		cnt += 1
		if alice:
			alice = False
			preva = 0
			while preva <= prevb and len(a) > 0:
				suma += a[0]
				preva += a[0]
				a.pop(0)
		else:
			alice = True
			prevb = 0
			while prevb <= preva and len(a) > 0:
				sumb += a[-1]
				prevb += a[-1]
				a.pop(-1)
	print(cnt, suma, sumb)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	alice = 0
	bob = 0
	ap = 0
	bp = 0
	l = 0
	r = n - 1
	t = 0
	while l <= r:
		temp = 0
		if t % 2 == 0:
			while bp >= temp and l <= r:
				temp += a[l]
				l += 1
			alice += temp
			ap = temp
			t += 1
		else:
			while ap >= temp and l <= r:
				temp += a[r]
				r -= 1
			bob += temp
			bp = temp
			t += 1
	print(t, alice, bob)


n = int(input())
for i in range(n):
	num = int(input())
	string = input().split()
	candies = [int(j) for j in string]
	candies_trans = [int(string[j]) for j in range(len(string) - 1, -1, -1)]
	step = 0
	last_step_candies = 0
	ans1 = 0
	ans2 = 0
	while True:
		temp = candies[0]
		cnt = 1
		while not temp > last_step_candies and cnt < len(candies):
			temp += candies[cnt]
			cnt += 1
		if cnt == len(candies):
			step += 1
			ans1 += temp
			break
		else:
			step += 1
			for j in range(cnt):
				candies.pop(0)
				candies_trans.pop()
			last_step_candies = temp
			ans1 += last_step_candies
		temp = candies_trans[0]
		cnt = 1
		while not temp > last_step_candies and cnt < len(candies_trans):
			temp += candies_trans[cnt]
			cnt += 1
		if cnt == len(candies_trans):
			step += 1
			ans2 += temp
			break
		else:
			step += 1
			for j in range(cnt):
				candies_trans.pop(0)
				candies.pop()
			last_step_candies = temp
			ans2 += last_step_candies
	print(step, ans1, ans2)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	(l, r) = (0, len(a) - 1)
	(step, ali, bob) = (0, 0, 0)
	(tmp, sum) = (0, 0)
	while l <= r:
		while sum <= tmp and l <= r:
			sum += a[l]
			l += 1
		ali += sum
		step += 1
		if l > r:
			break
		(tmp, sum) = (sum, 0)
		while sum <= tmp and l <= r:
			sum += a[r]
			r -= 1
		bob += sum
		step += 1
		(tmp, sum) = (sum, 0)
	print(step, ali, bob)


def solve(n, arr):
	alice = [arr[0]]
	arr.pop(0)
	bob = []
	flag = 1
	while len(arr) > 0:
		s = 0
		if flag == 1:
			while len(arr) > 0:
				s = s + arr.pop()
				if s > alice[-1]:
					break
			bob.append(s)
			flag = 0
		else:
			while len(arr) > 0:
				s = s + arr.pop(0)
				if s > bob[-1]:
					break
			alice.append(s)
			flag = 1
	print(len(alice) + len(bob), end=' ')
	print(sum(alice), end=' ')
	print(sum(bob))
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	solve(n, arr)


q = int(input())
while q > 0:
	q -= 1
	n = int(input())
	w = [int(x) for x in input().split()]
	(a, b) = (0, 0)
	t = 0
	sumb = 0
	while len(w) > 0:
		suma = 0
		while suma <= sumb and len(w) > 0:
			suma += w[0]
			del w[0]
		a += suma
		t += 1
		sumb = 0
		while sumb <= suma and len(w) > 0:
			sumb += w[-1]
			del w[-1]
		b += sumb
		if sumb > 0:
			t += 1
	print(t, a, b)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	step = 1
	l_step = False
	l_res = a[0]
	r_res = 0
	prev_step = a[0]
	this_step = 0
	l_last = 0
	r_last = n
	finished = True
	while r_last - l_last > 1:
		finished = False
		if this_step > prev_step:
			if l_step:
				l_res += this_step
			else:
				r_res += this_step
			prev_step = this_step
			this_step = 0
			step += 1
			l_step = not l_step
			finished = True
			continue
		last = l_last + 1 if l_step else r_last - 1
		this_step += a[last]
		if l_step:
			l_last += 1
		else:
			r_last -= 1
	if not finished:
		if l_step:
			l_res += this_step
		else:
			r_res += this_step
		step += 1
	print(step, l_res, r_res)
for _ in range(int(input())):
	main()


t = int(input())
while t:
	n = int(input())
	candy = [int(x) for x in input().split()]
	alice = 0
	bob = 0
	turn = 'bob'
	i = 0
	j = len(candy) - 1
	moves = 0
	alice_current = candy[0]
	alice += alice_current
	moves += 1
	i += 1
	bob_current = 0
	candy_rem = len(candy)
	candy_rem -= 1
	while candy_rem:
		if turn == 'alice':
			alice_current = 0
			moves += 1
			while i <= j and alice_current <= bob_current:
				alice_current += candy[i]
				i += 1
				candy_rem -= 1
			alice += alice_current
			turn = 'bob'
		elif turn == 'bob':
			bob_current = 0
			moves += 1
			while j >= i and bob_current <= alice_current:
				bob_current += candy[j]
				j -= 1
				candy_rem -= 1
			bob += bob_current
			turn = 'alice'
	ans = [str(moves), str(alice), str(bob)]
	print(' '.join(ans))
	t -= 1


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n
	a = l[0]
	b = 0
	prev = l[0]
	c = 1
	while i < j:
		if c % 2 != 0:
			v = 0
			while i < j:
				j -= 1
				if i == j:
					break
				v += l[j]
				if v > prev:
					break
			if v != 0:
				c += 1
			b += v
			prev = v
		else:
			v = 0
			while i < j:
				i += 1
				if i == j:
					break
				v += l[i]
				if v > prev:
					break
			if v != 0:
				c += 1
			a += v
			prev = v
	print(c, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	lis = list(map(int, input().split(' ')))
	move = 0
	a = 0
	b = 0
	prev = 0
	moves = 0
	while len(lis) != 0:
		if move == 0:
			cur = 0
			while cur <= prev and len(lis) != 0:
				cur += lis[0]
				a += lis[0]
				lis.pop(0)
			prev = cur
			move = 1
			moves += 1
		else:
			cur = 0
			while cur <= prev and len(lis) != 0:
				cur += lis[-1]
				b += lis[-1]
				lis.pop()
			prev = cur
			move = 0
			moves += 1
	print(moves, a, b)


def numCandies(n, a):
	alice = 0
	bob = 0
	current = 0
	i = 0
	j = len(a) - 1
	moves = 0
	newSum = 0
	while i <= j:
		while current >= newSum:
			if moves % 2 == 0 and i <= j:
				newSum += a[i]
				alice += a[i]
				i += 1
			elif moves % 2 != 0 and i <= j:
				bob += a[j]
				newSum += a[j]
				j -= 1
			else:
				break
		current = newSum
		newSum = 0
		moves += 1
	print('{} {} {}'.format(moves, alice, bob))
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	numCandies(n, a)


import math
t = int(input())
for i in range(0, t):
	num = int(input())
	list1 = list(map(int, input().split()))
	moves = 0
	sum1 = 0
	sum2 = 0
	alice = 0
	bob = 0
	pos1 = 0
	pos2 = len(list1) - 1
	counter = 0
	while pos1 <= pos2:
		if counter % 2 == 0:
			moves += 1
			alice = 0
			while alice <= bob and pos1 <= pos2:
				alice += list1[pos1]
				pos1 += 1
			counter += 1
			sum1 += alice
		if counter % 2 != 0:
			moves += 1
			bob = 0
			while bob <= alice and pos1 <= pos2:
				bob += list1[pos2]
				pos2 -= 1
			counter += 1
			sum2 += bob
		if alice == 0 or bob == 0:
			moves -= 1
	print(moves, sum1, sum2)


t = int(input())
for _ in range(t):
	_ = int(input())
	L = list(map(int, input().split()))
	(a, b) = (0, 0)
	(ap, bp) = (0, 0)
	n = 0
	(i, j) = (0, len(L) - 1)
	while True:
		(ac, bc) = (0, 0)
		if i > j:
			break
		while i <= j and ac <= bp:
			ac += L[i]
			i += 1
		n += 1
		a += ac
		ap = ac
		if i > j:
			break
		while i <= j and bc <= ap:
			bc += L[j]
			j -= 1
		n += 1
		b += bc
		bp = bc
	print(n, a, b)


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	numofa = 0
	numofb = 0
	move = 0
	curr = 0
	while li != []:
		if move % 2 == 0:
			sumnow = 0
			while li != [] and sumnow <= curr:
				sumnow += li[0]
				numofa += li[0]
				li.pop(0)
			curr = sumnow
			move += 1
		else:
			sumnow = 0
			while li != [] and sumnow <= curr:
				sumnow += li[-1]
				numofb += li[-1]
				li.pop(-1)
			curr = sumnow
			move += 1
	print(move, numofa, numofb)


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 _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	(moves, aSize, bSize, lastmove, turn) = (0, 0, 0, 0, 0)
	while len(a) != 0:
		temp = 0
		if turn == 0:
			while temp <= lastmove and len(a) != 0:
				temp += a[0]
				del a[0]
			aSize += temp
			lastmove = temp
		if turn == 1:
			while temp <= lastmove and len(a) != 0:
				temp += a[-1]
				del a[-1]
			bSize += temp
			lastmove = temp
		moves += 1
		turn = 1 - turn
	print(f'{moves} {aSize} {bSize}')


from collections import deque
for _ in range(int(input())):
	n = int(input())
	(steps, a, b) = (0, [0], [0])
	(tempa, tempb) = (0, 0)
	f = 0
	l = list(map(int, input().split()))
	l = deque(l)
	while len(l):
		if f == 0:
			tempa += l.popleft()
			if tempa > b[-1]:
				f = 1
				a.append(tempa)
				tempa = 0
		else:
			tempb += l.pop()
			if tempb > a[-1]:
				f = 0
				b.append(tempb)
				tempb = 0
	if f == 0:
		if tempa != 0:
			a.append(tempa)
	elif tempb != 0:
		b.append(tempb)
	steps = len(a) + len(b) - 2
	print(steps, sum(a), sum(b))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = l[0]
	y = 0
	ix = 1
	iy = n - 1
	m = 1
	a = x
	b = 0
	while ix <= iy:
		y = 0
		while y <= x and ix <= iy:
			y += l[iy]
			b += l[iy]
			iy -= 1
		if y != 0:
			x = 0
			m += 1
		while x <= y and ix <= iy:
			x += l[ix]
			a += l[ix]
			ix += 1
		if x != 0:
			y = 0
			m += 1
	print(m, a, b)


for _ in range(int(input())):
	n = int(input())
	k = list(map(int, input().split()))
	alice = k[0]
	bob = 0
	sumi = alice
	i = 1
	j = n - 1
	moves = 1
	sump = 0
	while i <= j:
		if moves % 2 == 1:
			if sumi >= sump:
				sump += k[j]
				j -= 1
			else:
				moves += 1
				bob += sump
				sumi = sump
				sump = 0
		elif sumi >= sump:
			sump += k[i]
			i += 1
		else:
			moves += 1
			alice += sump
			sumi = sump
			sump = 0
	if moves % 2 == 0:
		alice += sump
		moves += 1
	elif moves % 2 == 1:
		bob += sump
		moves += 1
	if n == 1:
		alice = k[0]
		bob = 0
		moves = 1
	print(moves, alice, bob)


for t in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	a = b = c = p = k = m = i = 0
	j = n - 1
	while i <= j:
		if m == 0:
			a += x[i]
			c += x[i]
			i += 1
		else:
			b += x[j]
			c += x[j]
			j -= 1
		if c > p:
			p = c
			c = 0
			m = 1 - m
			k += 1
	if c > 0:
		k += 1
	print(k, a, b)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	left = 1
	right = len(a) - 1
	if len(a) == 1:
		print(*[1, a[0]], 0)
		continue
	alice = a[0]
	bob = 0
	ctr = 2
	btotal = 0
	atotal = a[0]
	while left <= right:
		if ctr % 2 == 0:
			if alice >= bob:
				bob += a[right]
				right -= 1
			else:
				btotal += bob
				alice = 0
				ctr += 1
		elif bob >= alice:
			alice += a[left]
			left += 1
		else:
			atotal += alice
			bob = 0
			ctr += 1
	if bob != 0 and ctr % 2 == 0:
		btotal += bob
	if alice != 0 and ctr % 2 != 0:
		atotal += alice
	print(*[ctr, atotal, btotal])


def summ(a, b):
	return a + b

def pro(a, b):
	return a * b

def mains():
	for tets in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		if n == 2:
			print(2, a[0], a[1])
		elif n == 1:
			print(1, a[0], 0)
		else:
			i = 1
			j = n - 1
			bob = 0
			chance = 0
			s = 1
			x = a[0]
			alice = a[i - 1]
			while i <= j:
				s += 1
				if chance == 1:
					summ = 0
					while i <= j:
						summ += a[i]
						i += 1
						if summ > x:
							break
					alice += summ
					x = summ
				else:
					summ = 0
					while i <= j:
						summ += a[j]
						j -= 1
						if summ > x:
							break
					bob += summ
					x = summ
				chance ^= 1
			print(s, alice, bob)
x = summ(1, 999)
mains()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	i = 0
	j = n - 1
	ss = sum(a)
	cnt = 0
	c = 0
	d = 0
	pre = 0
	while n > 0:
		cnt += 1
		s = 0
		if cnt % 2 == 1:
			while s <= pre:
				if n != 0:
					s += a[i]
					i += 1
				else:
					break
				n -= 1
			c += s
		else:
			while s <= pre:
				if n != 0:
					s += a[j]
					j -= 1
				else:
					break
				n -= 1
			d += s
		pre = s
		ss -= s
	print('%d %d %d' % (cnt, c, d))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	len_of_a = len(a)
	alices_move = 0
	bobs_move = -1
	alices_weight = 0
	bobs_weight = 0
	alices_entire_weight = 0
	bobs_entire_weight = 0
	flag = 0
	number_of_steps = 0
	while len_of_a > 0:
		if flag == 0:
			while alices_weight <= bobs_weight and len_of_a > 0:
				alices_weight += a[alices_move]
				alices_move += 1
				len_of_a -= 1
			number_of_steps += 1
			bobs_entire_weight += bobs_weight
			bobs_weight = 0
			flag = 1
		else:
			while bobs_weight <= alices_weight and len_of_a > 0:
				bobs_weight += a[bobs_move]
				bobs_move -= 1
				len_of_a -= 1
			number_of_steps += 1
			alices_entire_weight += alices_weight
			alices_weight = 0
			flag = 0
	if flag == 0:
		print(number_of_steps, alices_entire_weight, bobs_entire_weight + bobs_weight)
	else:
		print(number_of_steps, alices_entire_weight + alices_weight, bobs_entire_weight)


from collections import deque
from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		N = int(input())
		A = map(int, input().split())
		candy = deque(A)
		(alice, bob) = (candy.popleft(), 0)
		(a, b) = (alice, 0)
		ans = 1
		for i in range(N - 1):
			if i % 2:
				alice = 0
				while alice <= bob:
					if not candy:
						break
					alice += candy.popleft()
				a += alice
			else:
				bob = 0
				while bob <= alice:
					if not candy:
						break
					bob += candy.pop()
				b += bob
			ans += 1
			if not candy:
				break
		print(ans, a, b)
main()


import math
r1 = lambda : int(input())
rm = lambda : map(int, input().split())
rls = lambda : list(rm())
test = r1()
while test:
	test -= 1
	n = r1()
	ls = rls()
	alice = 0
	bob = 0
	a = ls[0]
	alice += a
	ls = ls[1:]
	b = a + 1
	flag = 1
	while ls != []:
		i = 0
		x = 0
		flag += 1
		if flag % 2 == 0:
			while x < b and len(ls) > i:
				x += ls[-(i + 1)]
				i += 1
			if x < b:
				bob += x
				break
			else:
				bob += x
				a = x + 1
				ls = ls[:-i]
		else:
			i = 0
			x = 0
			while x < a and len(ls) > i:
				x += ls[i]
				i += 1
			alice += x
			if x < a:
				break
			b = x + 1
			ls = ls[i:]
	print(flag, alice, bob)


t = int(input())

def solve():
	t = int(input())
	a = [int(x) for x in input().split(' ')]
	alice = 0
	bob = 0
	cnt = 1
	alice += a[0]
	a = a[1:]
	chance = 'b'
	lastsum = alice + 1
	while len(a) != 0:
		if chance == 'b':
			temp = 0
			while temp < lastsum and len(a) > 0:
				temp += a[-1]
				a = a[:-1]
			cnt += 1
			bob += temp
			lastsum = temp + 1
			chance = 'a'
		elif chance == 'a':
			temp = 0
			while temp < lastsum and len(a) > 0:
				temp += a[0]
				a = a[1:]
			cnt += 1
			alice += temp
			lastsum = temp + 1
			chance = 'b'
	print(cnt, alice, bob)
for i in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	(x, y, cnt) = (0, 0, 0)
	(alice, bob) = (0, 0)
	while l <= r:
		while x <= y and l <= r:
			x += a[l]
			l += 1
		alice += x
		y = 0
		cnt += 1
		if l > r:
			break
		while y <= x and l <= r:
			y += a[r]
			r -= 1
		bob += y
		x = 0
		cnt += 1
	print(cnt, alice, bob)


t = int(input())
candies = []
for _ in range(t):
	n = int(input())
	candies.append(list(map(int, input().split())))
for candy in candies:
	a = 0
	b = 0
	turn = 0
	while len(candy) > 0:
		if turn % 2 == 0:
			if turn == 0:
				alice = candy.pop(0)
				a = alice
			else:
				alice = 0
				while alice <= bob and len(candy) > 0:
					alice += candy.pop(0)
				a += alice
		else:
			bob = 0
			while bob <= alice and len(candy) > 0:
				bob += candy.pop(-1)
			b += bob
		turn += 1
	print(turn, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	moves = 0
	ta = 0
	tb = 0
	pa = 0
	pb = 0
	flag = 1
	while i <= j:
		first = second = False
		while flag == 1 and pa <= pb and (i <= j):
			pa += a[i]
			i += 1
			first = True
			if pa > pb:
				flag = 0
		if first:
			moves += 1
			ta += pa
			pb = 0
		while flag == 0 and pb <= pa and (j >= i):
			pb += a[j]
			j -= 1
			second = True
			if pb > pa:
				flag = 1
		if second:
			moves += 1
			tb += pb
			pa = 0
	print(moves, ta, tb)


def answer(n, A):
	a = A[0]
	b = 0
	a_p = a
	b_p = 0
	count = 1
	l = 0
	r = n - 1
	while r > l:
		if count % 2 != 0:
			while r > l and b_p <= a_p:
				b_p += A[r]
				r -= 1
			a_p = 0
			b += b_p
			count += 1
		else:
			while r > l and a_p <= b_p:
				l += 1
				a_p += A[l]
			a += a_p
			b_p = 0
			count += 1
	return [count, a, b]
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*answer(n, arr))


def run():
	t = int(input())
	for f in range(t):
		n = int(input())
		num = []
		num = [int(k) for k in input().split()]
		eats = 0
		a = b = 0
		antA = 0
		antB = 0
		i = 0
		j = n - 1
		rounds = 0
		while eats < n:
			auxA = auxB = 0
			while auxA < antB + 1 and eats < n:
				auxA += num[i]
				i += 1
				eats += 1
			if eats < n:
				rounds += 1
			antA = auxA
			while antA + 1 > auxB and eats < n:
				auxB += num[j]
				j -= 1
				eats += 1
			a += auxA
			b += auxB
			antB = auxB
			if eats < n:
				rounds += 1
		print(rounds + 1, a, b)
run()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = 0
	pos1 = 0
	pos2 = n - 1
	prev1 = 0
	prev2 = 0
	a = 0
	b = 0
	while 1:
		if pos1 > pos2:
			break
		if cnt % 2 == 1:
			tmp = 0
			while tmp <= prev1 and pos1 <= pos2:
				tmp += arr[pos2]
				pos2 -= 1
			b += tmp
			prev2 = tmp
		else:
			tmp = 0
			while tmp <= prev2 and pos1 <= pos2:
				tmp += arr[pos1]
				pos1 += 1
			a += tmp
			prev1 = tmp
		cnt += 1
	print(cnt, a, b)


for i in range(int(input())):
	n = int(input())
	k = [int(x) for x in input().split()]
	at = 0
	bt = 0
	p = 0
	m = 0
	q = 0
	while len(k) > 0:
		s = 0
		if not q % 2:
			at += k[0]
			s += k[0]
			del k[0]
			m += 1
			if len(k) == 0:
				break
			while s <= p:
				if len(k) == 0:
					break
				at += k[0]
				s += k[0]
				del k[0]
			p = s
			s = 0
		else:
			m += 1
			bt += k[len(k) - 1]
			s += k[len(k) - 1]
			del k[len(k) - 1]
			if len(k) == 0:
				break
			while s <= p:
				if len(k) == 0:
					break
				bt += k[len(k) - 1]
				s += k[len(k) - 1]
				del k[len(k) - 1]
			p = s
			s = 0
		q += 1
	print(m, at, bt)


n = int(input())
for i in range(n):
	length = int(input())
	candies = input().split(' ')
	candies = [int(i) for i in candies]
	alice_ate = candies.pop(0)
	alice_last_ate = alice_ate
	moves = 1
	bob_ate = 0
	bob_last_ate = 0
	bob_bool = True
	while len(candies) != 0:
		if bob_bool:
			while bob_last_ate <= alice_last_ate and len(candies) != 0:
				bob_last_ate += candies.pop(-1)
			bob_ate += bob_last_ate
			bob_bool = False
			moves += 1
			alice_last_ate = 0
		else:
			while alice_last_ate <= bob_last_ate and len(candies) != 0:
				alice_last_ate += candies.pop(0)
			bob_bool = True
			alice_ate += alice_last_ate
			moves += 1
			bob_last_ate = 0
	print(moves, alice_ate, bob_ate)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	x = 0
	y = 0
	a = 0
	b = n - 1
	p = 0
	q = 0
	s = 0
	while a <= b:
		if s % 2 == 0:
			while p <= q and a <= b:
				p += arr[a]
				a += 1
			q = 0
			x += p
		else:
			while q <= p and a <= b:
				q += arr[b]
				b -= 1
			p = 0
			y += q
		s += 1
	print(s, x, y)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	alice = 0
	bob = 0
	l = 0
	r = n - 1
	summ = 0
	curr = 0
	move = 1
	i = 0
	while i < n:
		curr = 0
		while curr <= summ:
			if move % 2 == 1:
				alice += arr[l]
				curr += arr[l]
				l += 1
				i += 1
				if i == n:
					move -= 1
					break
			else:
				bob += arr[r]
				curr += arr[r]
				r -= 1
				i += 1
				if i == n:
					move -= 1
					break
		move += 1
		summ = curr
	print(move, alice, bob)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	arr = map(int, input().split())
	de = deque(arr)
	sumA = de.popleft()
	sumB = 0
	tempA = sumA
	tempB = 0
	moves = 1
	while de:
		while tempB <= tempA and de:
			tempB += de.pop()
		sumB += tempB
		moves += 1
		tempA = 0
		while tempA <= tempB and de:
			tempA += de.popleft()
		if de or tempA:
			sumA += tempA
			moves += 1
			tempB = 0
	print(moves, sumA, sumB)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	i = 1
	j = n - 1
	a = l[0]
	b = 0
	count = 1
	prev = l[0]
	flag = 0
	if n == 2:
		print(2, end=' ')
		print(l[0], end=' ')
		print(l[1])
		continue
	while i <= j:
		if count % 2 == 1:
			present = 0
			while prev >= present:
				present = present + l[j]
				j = j - 1
			if j >= i:
				prev = present
				count += 1
				b = b + present
			else:
				count += 1
				flag = 1
				break
		else:
			present = 0
			while prev >= present:
				present = present + l[i]
				i += 1
			if i <= j:
				prev = present
				count += 1
				a += present
			else:
				count += 1
				flag = 2
				break
	print(count, end=' ')
	s = sum(l)
	if flag == 1:
		print(a, end=' ')
		print(s - a)
	else:
		print(s - b, end=' ')
		print(b)


j = int(input())
for i in range(j):
	n = int(input())
	k = list(map(int, input().split()))
	a = k[0]
	k.pop(0)
	k.reverse()
	b = 0
	s = 1
	sum_a = a
	sum_b = 0
	while k:
		s += 1
		if s % 2 == 1:
			while a <= b and k:
				a += k[0]
				k.pop(0)
			k.reverse()
			b = 0
			sum_a += a
		else:
			while b <= a and k:
				b += k[0]
				k.pop(0)
			k.reverse()
			a = 0
			sum_b += b
	print(s, sum_a, sum_b)


import sys
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
for t in range(int(input())):
	n = int(input())
	arr = intInp()
	totalSum = sum(arr)
	arrCopy = [] + arr
	arrCopy.reverse()
	total = arrCopy.pop()
	a = [total]
	b = []
	moves = 1
	while total < totalSum:
		if moves % 2 == 0:
			aSum = 0
			while b[len(b) - 1] >= aSum:
				popVal = arrCopy.pop()
				total += popVal
				if total > totalSum:
					break
				aSum += popVal
			a.append(aSum)
		else:
			bSum = 0
			while a[len(a) - 1] >= bSum:
				popVal = arr.pop()
				total += popVal
				if total > totalSum:
					break
				bSum += popVal
			b.append(bSum)
		moves += 1
	print(moves, sum(a), sum(b))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n != 1:
		(a, b, c) = (0, 0, 0)
		(sa, sb) = (0, 0)
		(j, k) = (0, n - 1)
		while j - k != 1:
			c += 1
			if c % 2:
				while a <= b and arr[j] > 0:
					a += arr[j]
					arr[j] = 0
					j += 1
				sa += a
				b = 0
			else:
				while b <= a and arr[k] > 0:
					b += arr[k]
					arr[k] = 0
					k -= 1
				sb += b
				a = 0
		print(c, sa, sb)
	else:
		print(1, arr[0], 0)


t = int(input())
while t > 0:
	n = int(input())
	c = [int(x) for x in input().split()]
	a = c.pop(0)
	b = 0
	tota = a
	totb = b
	tot = 1
	while c != []:
		b = 0
		if b <= a and c != []:
			tot += 1
			while b <= a and c != []:
				s = c.pop()
				b += s
				totb += s
		a = 0
		if a <= b and c != []:
			tot += 1
			while a <= b and c != []:
				s = c.pop(0)
				a += s
				tota += s
	print(tot, tota, totb)
	t -= 1


for t in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	a = [arr[0]]
	arr.pop(0)
	b = []
	flag = True
	while arr:
		if flag:
			b.append(0)
			while arr and b[-1] <= a[-1]:
				b[-1] += arr[-1]
				arr.pop()
			flag = False
		else:
			a.append(0)
			while arr and a[-1] <= b[-1]:
				a[-1] += arr[0]
				arr.pop(0)
			flag = True
	print(len(a + b), sum(a), sum(b))


def CandiesEating(candies):
	Alice = 0
	Bob = 0
	r = [0, 0, 0]
	flag = False
	while True:
		flag = False
		Alice = 0
		while len(candies) != 0 and Alice <= Bob:
			flag = True
			Alice += candies[0]
			r[1] += candies[0]
			del candies[0]
		if flag:
			r[0] += 1
		flag = False
		Bob = 0
		while len(candies) != 0 and Bob <= Alice:
			flag = True
			Bob += candies[-1]
			r[2] += candies[-1]
			del candies[-1]
		if flag:
			r[0] += 1
		if len(candies) == 0:
			break
	return r
t = int(input())
Result = list()
for i in range(t):
	n = int(input())
	candies_list = [int(x) for x in input().split()]
	Result.append(CandiesEating(candies_list))
for result in Result:
	for x in result:
		print(x, end=' ')
	print()


from collections import deque
t = int(input())
for tt in range(t):
	n = int(input())
	a = deque((int(i) for i in input().split()))
	moves = 1
	prev = a.popleft()
	turn = 1
	(a_sum, b_sum) = (prev, 0)
	while a:
		cur = 0
		while a and cur <= prev:
			if turn:
				cur += a.pop()
			else:
				cur += a.popleft()
		if turn:
			b_sum += cur
		else:
			a_sum += cur
		prev = cur
		turn ^= 1
		moves += 1
	print(moves, a_sum, b_sum)


numcases = int(input())
cases = []
for n in range(numcases):
	input()
	case = input().split(' ')
	for x in case:
		x = int(x)
	cases.append(case)
for case in cases:
	A = 0
	a = 0
	B = 0
	b = 0
	x = 0
	a += int(case.pop(0))
	A += a
	x += 1
	while len(case):
		b = 0
		if len(case):
			x += 1
		while a >= b and len(case):
			c = int(case.pop(-1))
			b += c
			B += c
		a = 0
		if len(case):
			x += 1
		while b >= a and len(case):
			c = int(case.pop(0))
			A += c
			a += c
	print(f'{x} {A} {B}')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	prev = 0
	count = 0
	bob_prev = 0
	alice = 0
	bob = 0
	while arr != []:
		count += 1
		alice_prev = arr.pop(0)
		while alice_prev <= bob_prev:
			if arr == []:
				break
			alice_prev += arr.pop(0)
		alice += alice_prev
		if arr == []:
			break
		count += 1
		bob_prev = arr.pop()
		while bob_prev <= alice_prev:
			if arr == []:
				break
			bob_prev += arr.pop()
		bob += bob_prev
	print(count, alice, bob)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	(l, r, m) = (0, n - 1, 0)
	(t, x) = (0, 0)
	(p, q) = (0, 0)
	while l <= r:
		if t:
			y = 0
			while y <= x and l <= r:
				y += a[r]
				r -= 1
			q += y
		else:
			y = 0
			while y <= x and l <= r:
				y += a[l]
				l += 1
			p += y
		t = 1 - t
		x = y
		m += 1
	print(m, p, q)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(i, j) = (0, len(l) - 1)
	(movecount, move, a, b, A, B) = (1, True, 0, 0, 0, 0)
	while i <= j:
		if move == True:
			a += l[i]
			A += l[i]
			i += 1
			if i <= j and a > b:
				b = 0
				move = False
				movecount += 1
		else:
			b += l[j]
			B += l[j]
			j -= 1
			if i <= j and b > a:
				a = 0
				move = True
				movecount += 1
	print(movecount, A, B)


for _ in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	a_sum = 0
	b_sum = 0
	a = -1
	b = n
	a_prev = 0
	b_prev = 0
	moves = 0
	while a + 1 < b:
		moved = False
		a_now = 0
		while True:
			if a + 1 >= b:
				a_prev = a_now
				break
			moved = True
			a += 1
			a_now += data[a]
			a_sum += data[a]
			if a_now > b_prev:
				a_prev = a_now
				break
		if moved:
			moves += 1
		moved = False
		b_now = 0
		while True:
			if b - 1 <= a:
				b_prev = b_now
				break
			moved = True
			b -= 1
			b_now += data[b]
			b_sum += data[b]
			if b_now > a_prev:
				b_prev = b_now
				break
		if moved:
			moves += 1
	print(moves, a_sum, b_sum)


import sys
from collections import deque

def eat(last, turn):
	global list_num, a, b
	now_sum = -1
	now_count = 0
	if not turn % 2:
		while now_sum < last and list_num:
			now_sum += list_num.popleft()
		a += now_sum + 1
	else:
		while now_sum < last and list_num:
			now_sum += list_num.pop()
		b += now_sum + 1
	if not list_num:
		return False
	else:
		return now_sum + 1
T = int(sys.stdin.readline())
for _ in range(T):
	N = int(sys.stdin.readline())
	list_num = deque(list(map(int, sys.stdin.readline().split())))
	turn = 0
	last = 0
	(a, b) = (0, 0)
	result = []
	while True:
		check = eat(last, turn)
		if check == False:
			turn += 1
			break
		else:
			last = check
		turn += 1
	print(turn, a, b)


def answer(sweets, n):
	steps = 0
	alice = 0
	bob = 0
	prev_step = 0
	(left, right) = (0, n - 1)
	alice_steps = True
	while left <= right:
		current_step = 0
		while current_step <= prev_step and left <= right:
			if alice_steps:
				current_step += sweets[left]
				left += 1
			else:
				current_step += sweets[right]
				right -= 1
		prev_step = current_step
		steps += 1
		if alice_steps:
			alice += current_step
		else:
			bob += current_step
		alice_steps = not alice_steps
	return (steps, alice, bob)
t = int(input())
for _ in range(t):
	n = int(input())
	sweets = list(map(int, input().split()))
	print(' '.join(map(str, answer(sweets, n))))


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		bomboni = list(map(int, input().split()))
		(alice, bob) = (0, 0)
		red = 'a'
		prije = 0
		(pocetak, kraj) = (0, n - 1)
		potezi = 0
		while n > 0:
			if red == 'a':
				ukupno = 0
				potezi += 1
				for i in range(pocetak, kraj + 1):
					ukupno += bomboni[i]
					n -= 1
					alice += bomboni[i]
					pocetak += 1
					if ukupno > prije:
						red = 'b'
						break
				prije = ukupno
			else:
				ukupno = 0
				potezi += 1
				for i in range(kraj, pocetak - 1, -1):
					ukupno += bomboni[i]
					n -= 1
					bob += bomboni[i]
					kraj -= 1
					if ukupno > prije:
						red = 'a'
						break
				prije = ukupno
		print(potezi, alice, bob)
main()


from math import *
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	al = a[0]
	bo = 0
	al1 = a[0]
	bo1 = 0
	i = 1
	j = n - 1
	moves = 1
	flag = True
	while i <= j:
		if flag:
			bo1 = 0
			while i <= j and al1 >= bo1:
				bo1 += a[j]
				j -= 1
				if i == j and bo1 <= al1:
					bo1 += a[j]
					j -= 1
					break
			bo += bo1
			moves += 1
			flag = False
		else:
			al1 = 0
			while i <= j and bo1 >= al1:
				al1 += a[i]
				i += 1
				if i == j and bo1 >= al1:
					al1 += a[i]
					i += 1
					break
			al += al1
			moves += 1
			flag = True
	print(moves, al, bo)


t = int(input())
for _ in range(0, t):
	n = int(input())
	x = input().split()
	arr = [int(a) for a in x]
	a = arr[0]
	b = 0
	total = 1
	size = 1
	i = 1
	j = len(arr) - 1
	previous = arr[0]
	current = 0
	while size < len(arr):
		flag = 0
		current = 0
		while current <= previous and size < len(arr):
			b += arr[j]
			current += arr[j]
			j -= 1
			size += 1
		total += 1
		previous = current
		if size >= len(arr):
			flag = 1
		current = 0
		while current <= previous and size < len(arr):
			a += arr[i]
			current += arr[i]
			i += 1
			size += 1
		previous = current
		if flag == 0:
			total += 1
	s = str(total) + ' ' + str(a) + ' ' + str(b)
	print(s)


t = int(input())
for x in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	alice = 0
	bob = 0
	l = 0
	r = n - 1
	prev = 0
	temp = 0
	pos = 0
	while l <= r:
		if pos % 2 == 0:
			while temp <= prev and l <= r:
				temp += a[l]
				l += 1
			alice += temp
			prev = temp
			temp = 0
			pos += 1
		else:
			while temp <= prev and l <= r:
				temp += a[r]
				r -= 1
			bob += temp
			prev = temp
			temp = 0
			pos += 1
	print(pos, alice, bob)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))[:n]
	a = 0
	b = 0
	i = 0
	x = 0
	y = 0
	j = n
	step1 = 0
	step2 = 0
	if n == 1:
		print(n, *l, b)
	else:
		x = l[i]
		a += x
		step1 += 1
		b += y
		while a + b < sum(l):
			if x <= y:
				x = 0
				while x <= y:
					i += 1
					x += l[i]
					if i + 1 == j:
						break
				a += x
				step1 += 1
			if a + b == sum(l):
				break
			if y <= x:
				y = 0
				while y <= x:
					j -= 1
					y += l[j]
					if j == i + 1:
						break
				b += y
				step2 += 1
		print(step1 + step2, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	a = list((int(num) for num in input().split(' ')))[:n]
	al = []
	sa = a[0]
	m = 1
	sb = 0
	al.append(a.pop(0))
	c1 = 0
	while a:
		apr = sum(al)
		bp = 0
		al = []
		bl = []
		while bp <= apr:
			if a:
				sb = sb + a[len(a) - 1]
				bp = bp + a[len(a) - 1]
				bl.append(a.pop(len(a) - 1))
			else:
				c1 = 1
				break
		m += 1
		if c1 == 0 and a:
			bpr = sum(bl)
			ap = 0
			while ap <= bpr:
				if a:
					sa = sa + a[0]
					ap = ap + a[0]
					al.append(a.pop(0))
				else:
					break
			m += 1
	print(m, ' ', sa, ' ', sb)


for p in range(int(input())):
	n = int(input())
	arr = input().split(' ')
	arr = map(int, arr)
	arr = list(arr)
	alice = 0
	pa = 0
	bob = 0
	pb = 0
	i = 0
	j = n - 1
	moves = 0
	if n == 1:
		print(1, arr[0], 0)
	else:
		while True:
			while pa <= pb and i < n and (i - j <= 0):
				alice += arr[i]
				pa += arr[i]
				i += 1
			pb = 0
			moves += 1
			if i - j > 0:
				break
			while pb <= pa and j > -1 and (i - j <= 0):
				bob += arr[j]
				pb += arr[j]
				j -= 1
			pa = 0
			moves += 1
			if i - j > 0:
				break
		print(moves, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	candies = [int(i) for i in input().split()]
	alice = 0
	bob = 0
	k = 0
	a_turn = 1
	prev_a = 0
	prev_b = 0
	while True:
		if a_turn == 1:
			if sum(candies) > prev_b:
				prev_a = 0
				while prev_a <= prev_b and candies != []:
					prev_a += candies.pop(0)
				alice += prev_a
			elif candies != []:
				alice += sum(candies)
				k += 1
				break
			else:
				break
			a_turn = 0
			k += 1
		else:
			if sum(candies) > prev_a:
				prev_b = 0
				while prev_b <= prev_a and candies != []:
					prev_b += candies.pop(len(candies) - 1)
				bob += prev_b
			elif candies != []:
				bob += sum(candies)
				k += 1
				break
			else:
				break
			a_turn = 1
			k += 1
	print(k, alice, bob)


t = int(input())
import math

def solve(arr):
	a = -1
	b = len(arr)
	at = 0
	att = 0
	btt = 0
	bt = 0
	turns = 0
	avail = len(arr)
	turn = 1
	while avail > 0:
		turns += 1
		if turn:
			turn = 0
			while at <= bt:
				if a + 1 != b:
					a += 1
					at += arr[a]
					att += arr[a]
					avail -= 1
				else:
					break
			bt = 0
		else:
			turn = 1
			while bt <= at:
				if b - 1 != a:
					b -= 1
					bt += arr[b]
					btt += arr[b]
					avail -= 1
				else:
					break
			at = 0
	return ' '.join((str(turns), str(att), str(btt)))
for _ in range(t):
	n = int(input())
	print(solve([int(x) for x in input().strip().split()]))


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	(totA, totB) = (0, 0)
	(A, B) = (0, 0)
	ans = 0
	turn = True
	while True:
		if len(a) != 0:
			ans += 1
		if turn:
			A = 0
			while A <= B and len(a) > 0:
				A += a[0]
				del a[0]
			totA += A
			if A <= B:
				print(ans, totA, totB)
				return
			turn = False
		else:
			B = 0
			while B <= A and len(a) > 0:
				B += a[-1]
				del a[-1]
			totB += B
			if B <= A:
				print(ans, totA, totB)
				return
			turn = True
	print(ans, totA, totB)
for _ in range(int(input())):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	apos = 0
	bpos = n - 1
	preva = prevb = 0
	turns = 0
	while apos <= bpos:
		preva = 0
		while preva <= prevb and apos <= bpos:
			preva += a[apos]
			apos += 1
		turns += 1
		if apos > bpos:
			break
		prevb = 0
		while prevb <= preva and apos <= bpos:
			prevb += a[bpos]
			bpos -= 1
		turns += 1
	print(turns, sum(a[:apos]), sum(a[bpos + 1:]))


j = int(input())
for i in range(j):
	n = int(input())
	a = [int(x) for x in input().split(maxsplit=n)]
	l = 0
	r = n - 1
	sum = 0
	sumr = 0
	cnt = 0
	ansl = 0
	ansr = 0
	while l <= r:
		if cnt % 2 == 0:
			nsuml = 0
			while l <= r and nsuml <= sumr:
				nsuml += a[l]
				l += 1
			ansl += nsuml
			suml = nsuml
		else:
			nsumr = 0
			while l <= r and nsumr <= suml:
				nsumr += a[r]
				r -= 1
			ansr += nsumr
			sumr = nsumr
		cnt += 1
	print(cnt, ansl, ansr, sep=' ')
	print(end='\n')


import bisect
import heapq

def main():
	k = int(input())
	for i in range(k):
		n = int(input())
		arr = list(map(int, input().split()))
		(l, r) = (0, n)
		(tmp_r, tmp_l) = (0, 0)
		(a, b) = (0, 0)
		counter = 0
		while l < r:
			if l == 0:
				counter += 1
				a = arr[0]
				tmp_l = arr[0]
				l += 1
			else:
				if l < r:
					counter += 1
				while tmp_l <= tmp_r and l < r:
					tmp_l += arr[l]
					a += arr[l]
					l += 1
				tmp_r = 0
			if l < r:
				counter += 1
			while tmp_r <= tmp_l and l < r:
				tmp_r += arr[r - 1]
				b += arr[r - 1]
				r -= 1
			tmp_l = 0
		print(counter, a, b)
main()


def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	n = read_ints()
	a = read_ints()
	(i, j) = (0, len(a) - 1)
	(alice, bob) = (0, 0)
	(total_alice, total_bob) = (0, 0)
	count = 0
	while i <= j:
		while i <= j and alice <= bob:
			alice += a[i]
			total_alice += a[i]
			i += 1
		count += 1
		bob = 0
		if i > j:
			break
		while i <= j and bob <= alice:
			bob += a[j]
			total_bob += a[j]
			j -= 1
		alice = 0
		count += 1
	print(count, total_alice, total_bob)
T = read_int()
for _ in range(T):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(e) for e in input().split()]
	a_idx = 0
	a_c = 0
	b_idx = n - 1
	b_c = 0
	a = 0
	b = 0
	turn = 0
	c = 0
	while a_idx <= b_idx:
		c += 1
		s = 0
		if turn == 0:
			while a_idx <= b_idx and s <= b:
				s += arr[a_idx]
				a_idx += 1
			a_c += s
			a = s
		else:
			while b_idx >= a_idx and s <= a:
				s += arr[b_idx]
				b_idx -= 1
			b_c += s
			b = s
		turn ^= 1
	print(c, a_c, b_c)


for tc in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	(a, b) = (1, n - 1)
	turns = 1
	counts = [arr[0], 0]
	last = [arr[0], 0]
	turn = 0
	while b >= a:
		curr = 0
		if turn:
			last[0] = 0
			while curr <= last[1] and b >= a:
				last[0] += arr[a]
				counts[0] += arr[a]
				curr += arr[a]
				a += 1
			turn = 0
		else:
			last[1] = 0
			while curr <= last[0] and b >= a:
				last[1] += arr[b]
				counts[1] += arr[b]
				curr += arr[b]
				b -= 1
			turn = 1
		turns += 1
	print(turns, counts[0], counts[1])


ans = []
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	k = 0
	alisa = 0
	bob = 0
	q = 0
	w = 0
	d = 'a'
	while j >= i:
		if d == 'a':
			alisa += a[i]
			w += a[i]
			a[i] = 0
			i += 1
			if w > q or a[i] == 0:
				q = w
				w = 0
				d = 'b'
				k += 1
		if d == 'b' and j >= i:
			bob += a[j]
			w += a[j]
			a[j] = 0
			j -= 1
			if w > q or a[j] == 0:
				q = w
				w = 0
				d = 'a'
				k += 1
	ans.append([k, alisa, bob])
for i in ans:
	print(' '.join(map(str, i)))


n = int(input())
for i in range(n):
	candies = int(input())
	lst = [int(x) for x in input().split()]
	moves = 1
	prev = 0
	current = 0
	alice = 0
	bob = 0
	while len(lst) > 0:
		if moves % 2 == 1:
			value = lst.pop(0)
			current += value
			alice += value
		else:
			value = lst.pop()
			current += value
			bob += value
		if current > prev and len(lst) > 0:
			prev = current
			current = 0
			moves += 1
		elif current > prev and len(lst) == 0:
			break
	print(moves, alice, bob)


from collections import deque
t = int(input())
while t:
	n = int(input())
	d = deque([int(x) for x in input().split()])
	(a, b, turn, cnt, turns) = (d[0], 0, True, d[0], 1)
	d.popleft()
	while d:
		temp = 0
		if turn:
			while temp <= cnt and d:
				b += d[-1]
				temp += d[-1]
				d.pop()
		else:
			while temp <= cnt and d:
				a += d[0]
				temp += d[0]
				d.popleft()
		turns += 1
		cnt = temp
		turn = not turn
	print(turns, a, b)
	t -= 1


import sys
import math
from collections import defaultdict

def solve(test):
	n = int(input())
	a = list(map(int, input().split()))
	moves = 0
	(i, j) = (0, n - 1)
	last = 0
	curr = 0
	flag = 0
	alice = 0
	bob = 0
	while i <= j:
		if not flag:
			curr += a[i]
			alice += a[i]
			if curr > last:
				last = curr
				curr = 0
				moves += 1
				flag = 1
			i += 1
		else:
			curr += a[j]
			bob += a[j]
			if curr > last:
				last = curr
				curr = 0
				moves += 1
				flag = 0
			j -= 1
	if curr:
		moves += 1
	print('{} {} {}'.format(moves, alice, bob))
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


def f(n, arr):
	p1 = 0
	p2 = n - 1
	cur = arr[0]
	al = 0
	bl = 0
	moves = 0
	total_al = 0
	total_bl = 0
	while p1 <= p2:
		while cur > al and p1 <= p2:
			al += arr[p1]
			p1 += 1
		total_al += al
		cur = al + 1
		if al > 0:
			moves += 1
		while cur > bl and p1 <= p2:
			bl += arr[p2]
			p2 -= 1
		total_bl += bl
		cur = bl + 1
		if bl > 0:
			moves += 1
		al = 0
		bl = 0
	return [moves, total_al, total_bl]
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*f(n, a))


from bisect import bisect
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = []
	l2 = []
	(c1, c2) = (0, 0)
	for j in range(n):
		c1 += l[j]
		c2 += l[n - 1 - j]
		l1.append(c1)
		l2.append(c2)
	(c, d) = (l[0], 0)
	(e, f) = (l[0], 0)
	t = 0
	t1 = 1
	while c + d < sum(l):
		t1 += 1
		if t == 0:
			b = bisect(l2, f + c)
			d = l2[b] - f
			f = l2[b]
			if e + f >= sum(l):
				f = sum(l) - e
				break
			t = 1
		else:
			a = bisect(l1, e + d)
			c = l1[a] - e
			e = l1[a]
			if e + f >= sum(l):
				e = sum(l) - f
				break
			t = 0
	print(t1, e, f)


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	arr = input().split(' ')
	arr = list(map(int, arr))
	step = 0
	l = 0
	r = n - 1
	last = 0
	lvalue = 0
	rvalue = 0
	while l <= r:
		temp = 0
		while temp <= last and l <= r:
			temp += arr[l]
			l += 1
		if temp > 0:
			step += 1
			last = temp
			lvalue += temp
		temp = 0
		while temp <= last and l <= r:
			temp += arr[r]
			r -= 1
		if temp > 0:
			step += 1
			last = temp
			rvalue += temp
	print(step, lvalue, rvalue)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(a) for a in input().split()]
	sum_a = 0
	sum_b = 0
	a_i = 0
	b_i = n - 1
	total_eaten = 0
	hods = 0
	prev = 0
	while total_eaten < n:
		cur = 0
		if hods % 2 == 0:
			while total_eaten < n and cur <= prev:
				cur += arr[a_i]
				a_i += 1
				total_eaten += 1
			sum_a += cur
		else:
			while total_eaten < n and cur <= prev:
				cur += arr[b_i]
				b_i -= 1
				total_eaten += 1
			sum_b += cur
		prev = cur
		hods += 1
	print(hods, sum_a, sum_b)


t = int(input())
for i in range(t):
	n = int(input())
	candies = list(map(int, input().split()))
	idx_a = 0
	idx_b = n - 1
	turn = True
	objective = 0
	current = 0
	moves = 0
	a = 0
	b = 0
	while idx_a <= idx_b:
		if turn:
			current += candies[idx_a]
			a += candies[idx_a]
			idx_a += 1
		else:
			current += candies[idx_b]
			b += candies[idx_b]
			idx_b -= 1
		if current > objective or idx_a > idx_b:
			moves += 1
			objective = current
			current = 0
			turn = not turn
	print(moves, a, b)


t = int(input())
for q in range(t):
	n = int(input())
	c = [int(x) for x in input().split()]
	ai = 0
	bi = n - 1
	a = 0
	b = 0
	num = 0
	count = 0
	acur = 0
	bcur = 0
	while num < n:
		while acur <= bcur and num < n:
			a += c[ai]
			acur += c[ai]
			ai += 1
			num += 1
		bcur = 0
		if num == n:
			count += 1
			break
		else:
			count += 1
		while bcur <= acur and num < n:
			b += c[bi]
			bcur += c[bi]
			bi -= 1
			num += 1
		if num == n:
			count += 1
			break
		else:
			count += 1
		acur = 0
	print(count, a, b)


def solve(n, a):
	global alice, bob
	current = a[0]
	cnt = 1
	a.pop(0)
	person = 'Bob'
	while a:
		newCur = 0
		cnt += 1
		while newCur <= current:
			if a:
				newCur += a.pop() if person == 'Bob' else a.pop(0)
			else:
				break
		current = newCur
		if person == 'Alice':
			alice += current
		else:
			bob += current
		person = 'Alice' if person == 'Bob' else 'Bob'
	return cnt
for j in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(alice, bob) = (a[0], 0)
	print(solve(n, a), alice, bob)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(a, b, cur1, cur2) = (0, 0, 0, 0)
	a = l[0]
	cur1 = l[0]
	(idx1, idx2) = (1, n - 1)
	count = 1
	while idx1 <= idx2:
		cur2 = 0
		while cur2 <= cur1 and idx2 >= idx1:
			cur2 += l[idx2]
			idx2 -= 1
		b += cur2
		if cur2 != 0:
			count += 1
		if idx2 < idx1:
			break
		cur1 = 0
		while cur1 <= cur2 and idx1 <= idx2:
			cur1 += l[idx1]
			idx1 += 1
		a += cur1
		if cur1 != 0:
			count += 1
		if idx1 > idx2:
			break
	print(count, a, b)


T = int(input())
for t in range(T):
	n = int(input())
	x = list(map(int, input().split()))
	tot = sum(x)
	(a, b) = (0, 0)
	i = 0
	j = n - 1
	c = 0
	fin = False
	p = 0
	now = 0
	while True:
		p = now
		now = 0
		c += 1
		while now <= p:
			tot -= x[i]
			a += x[i]
			now += x[i]
			i += 1
			if tot == 0:
				fin = True
				break
		if fin:
			break
		p = now
		now = 0
		c += 1
		while now <= p:
			tot -= x[j]
			b += x[j]
			now += x[j]
			j -= 1
			if tot == 0:
				fin = True
				break
		if fin:
			break
	print(c, a, b)


for t in range(int(input())):
	n = int(input())
	candy = list(map(int, input().split()))
	alice = 0
	bob = 0
	steps = 0
	prev_move = 0
	d = 0
	while n != 0:
		s = candy[d]
		while s <= prev_move and n > 1:
			candy.pop(d)
			s += candy[d]
			n -= 1
		if n != 0:
			candy.pop(d)
			n -= 1
		if d == 0:
			alice += s
		else:
			bob += s
		steps += 1
		d = -1 * abs(d + 1)
		prev_move = s
	print(steps, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	l = 1
	r = n - 1
	a = arr[0]
	b = 0
	i = 1
	p = a
	if n <= 2:
		if n == 1:
			print(1, arr[0], 0)
		else:
			print(2, arr[0], arr[1])
	else:
		while l < r:
			if i % 2 == 1:
				s = 0
				while s < p + 1:
					if l <= r:
						s += arr[r]
						r -= 1
					else:
						break
				b += s
			else:
				s = 0
				while s < p + 1:
					if l <= r:
						s += arr[l]
						l += 1
					else:
						break
				a += s
			p = s
			i += 1
		if a + b < sum(arr):
			if i % 2 == 0:
				print(i + 1, a + arr[l], b)
			else:
				print(i + 1, a, b + arr[l])
		else:
			print(i, a, b)


t = int(input())
for case in range(t):
	n = int(input())
	candies = [int(x) for x in input().split()]
	present = 0
	alice = candies[0]
	prev = alice
	moves = 1
	r_candies = list(reversed(candies))
	alice_candies = [candies[0]]
	bob_candies = []
	flag = 0
	j = 1
	k = 0
	for i in range(1, n):
		while present <= prev:
			if i % 2 != 0:
				present += r_candies[k]
				bob_candies.append(r_candies[k])
				k += 1
			else:
				present += candies[j]
				alice_candies.append(candies[j])
				j += 1
			if len(alice_candies) + len(bob_candies) == n:
				flag = 1
				break
		moves += 1
		if flag == 1:
			break
		prev = present
		present = 0
	print('{} {} {}'.format(moves, sum(alice_candies), sum(bob_candies)))


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	(al, bob) = ([a[0]], [])
	(i, j) = (1, n - 1)
	flag = True
	while i <= j:
		if flag:
			bob.append(0)
			while i <= j and bob[-1] <= al[-1]:
				bob[-1] += a[j]
				j -= 1
			flag = False
		else:
			al.append(0)
			while i <= j and al[-1] <= bob[-1]:
				al[-1] += a[i]
				i += 1
			flag = True
	print(len(al + bob), sum(al), sum(bob))


def main():
	x = int(input())
	for _ in range(x):
		z = int(input())
		i = [int(i) for i in input().split()]
		counter = 0
		max_first = 0
		max_second = 0
		first = 0
		second = 0
		while len(i) > 0:
			while first <= second and i != []:
				first += i.pop(0)
			max_first += first
			counter += 1
			second = 0
			while second <= first and i != []:
				second += i.pop()
			max_second += second
			if second != 0:
				counter += 1
			first = 0
		print(counter, max_first, max_second)
main()


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	i = 1
	j = n - 1
	al = A[0]
	bo = 0
	prev = [al]
	al = 0
	d = 1
	ans = 0
	A[0] = 0
	while i < n and j >= i:
		if d % 2 != 0:
			bo += A[j]
			A[j] = 0
			if bo <= prev[-1]:
				j -= 1
			elif bo > prev[-1]:
				prev.append(bo)
				bo = 0
				ans += 1
				j -= 1
				d += 1
		if d % 2 == 0:
			al += A[i]
			A[i] = 0
			if al <= prev[-1]:
				i += 1
			elif al > prev[-1]:
				prev.append(al)
				al = 0
				ans += 1
				i += 1
				d += 1
	if al > 0:
		prev.append(al)
		ans += 1
	if bo > 0:
		prev.append(bo)
		ans += 1
	suma = 0
	sumb = 0
	for i in range(len(prev)):
		if i % 2 == 0:
			suma += prev[i]
		else:
			sumb += prev[i]
	print(len(prev), suma, sumb)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	f = 1
	r = a[0]
	sa = sb = x = y = c = 0
	while i <= j:
		if f:
			sa = 0
			while sb >= sa and i <= j:
				sa += a[i]
				x += a[i]
				i += 1
			f = 0
		else:
			sb = 0
			while sa >= sb and i <= j:
				sb += a[j]
				y += a[j]
				j -= 1
			f = 1
		c += 1
	print(c, x, y)


from collections import deque
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	A = deque(A)
	a = 0
	b = 0
	prea = 0
	preb = 0
	move = 0
	turn = 1
	while A:
		if turn > 0:
			prea = 0
			while prea <= preb and A:
				c = A.popleft()
				prea += c
			a += prea
		if turn < 0:
			preb = 0
			while preb <= prea and A:
				c = A.pop()
				preb += c
			b += preb
		turn *= -1
		move += 1
	print(move, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 1
	j = n - 1
	ls = a[0]
	rs = 0
	prev = a[0]
	sum = 0
	mov = 1
	flag = 0
	while i <= j:
		while sum <= prev and i <= j:
			sum = sum + a[j]
			j = j - 1
			flag = 1
		if flag == 1:
			mov += 1
			rs = rs + sum
			prev = sum
			sum = 0
			flag = 0
		while sum <= prev and i <= j:
			sum = sum + a[i]
			i = i + 1
			flag = 1
		if flag == 1:
			mov = mov + 1
			ls = ls + sum
			prev = sum
			sum = 0
			flag = 0
	print(mov, ls, rs)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 2
	s1 = 0
	s2 = 0
	s1 += a.pop(0)
	x = s1
	y = 0
	z = 1
	while n > 1:
		z += 1
		if i % 2 == 0:
			s2 = 0
			while s2 <= s1 and n > 1:
				n -= 1
				s2 += a.pop()
			y += s2
		else:
			s1 = 0
			while s1 <= s2 and n > 1:
				n -= 1
				s1 += a.pop(0)
			x += s1
		i += 1
	print(z, x, y)


t = int(input())
for w in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	(i, j) = (0, n - 1)
	(tsi, tsj) = (0, 0)
	(si, sj) = (0, 0)
	m = 0
	while i <= j:
		if m % 2 == 0:
			si = 0
			while si <= sj and i <= j:
				si += l[i]
				tsi += l[i]
				i += 1
			m += 1
		else:
			sj = 0
			while sj <= si and j >= i:
				sj += l[j]
				tsj += l[j]
				j -= 1
			m += 1
	print(m, tsi, tsj)


q = int(input())
while q > 0:
	q -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a.insert(0, 0)
	l = 1
	r = n + 1
	start = a[1] + 1
	turn = 1
	ans1 = a[1]
	ans2 = 0
	cnt = 1
	while l < r - 1:
		cnt += 1
		turn ^= 1
		x = start
		if turn == 0:
			while l < r - 1 and x > 0:
				x -= a[r - 1]
				r -= 1
				ans2 += a[r]
		else:
			while l < r - 1 and x > 0:
				x -= a[l + 1]
				l += 1
				ans1 += a[l]
		start -= x - 1
	print(cnt, ans1, ans2)


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)


from math import *
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = 1
	alice = bob = cnt = 0
	i = j = 0
	alicep = bobp = alicen = bobn = 0
	while l != []:
		if a == 1:
			while bobp >= alicen and l != []:
				alicen += l[0]
				l.pop(0)
			a *= -1
			alice += alicen
			alicep = alicen
			alicen = 0
			cnt += 1
		else:
			while alicep >= bobn and l != []:
				bobn += l[-1]
				l.pop(-1)
			a *= -1
			bob += bobn
			bobp = bobn
			bobn = 0
			cnt += 1
	print(cnt, alice, bob)


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

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

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

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

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

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

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)))
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)


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		candie = list(map(int, input().split()))
		a = 0
		b = 0
		j = 0
		cur_a = 0
		cur_b = 0
		flag = False
		while True:
			cur_a = 0
			while cur_b >= cur_a:
				try:
					cur_a += candie.pop(0)
				except IndexError:
					a += cur_a
					j += 1
					flag = True
					break
			if flag:
				break
			a += cur_a
			if candie != []:
				j += 1
			cur_b = 0
			while cur_a >= cur_b:
				try:
					cur_b += candie.pop(-1)
				except IndexError:
					b += cur_b
					j += 1
					flag = True
					break
			if flag:
				break
			b += cur_b
			if candie != []:
				j += 1
		print(j, a, b)
main()


for i in range(int(input())):
	x = int(input())
	y = [int(i) for i in input().split()]
	z = 0
	a = 0
	b = 0
	c = 0
	m1 = 0
	m2 = 0
	while y != []:
		c += 1
		if z == 0:
			for i in range(x):
				try:
					b += y[0]
					m1 += y[0]
					del y[0]
					if b > a:
						z = 1
						a = b
						b = 0
						break
				except:
					break
		else:
			for i in range(x):
				try:
					b += y[-1]
					m2 += y[-1]
					del y[-1]
					if b > a:
						z = 0
						a = b
						b = 0
						break
				except:
					break
	print(c, m1, m2)


t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	al = 0
	bo = 0
	ct = 0
	mv = 1
	pre = a[0]
	al += a[0]
	ct += 1
	a.pop(0)
	while len(a) > 0:
		cur = 0
		if mv == 1:
			while cur <= pre:
				poped = a.pop()
				cur += poped
				if len(a) == 0:
					break
			bo += cur
		else:
			while cur <= pre:
				poped = a.pop(0)
				cur += poped
				if len(a) == 0:
					break
			al += cur
		mv = 1 - mv
		pre = cur
		ct += 1
	print(ct, al, bo)
	t -= 1


t = int(input())
for _ in range(0, t):
	o = input()
	li = list(map(int, input().split()))
	cnt = [0, 0]
	upperbound = 0
	start = 0
	end = -1
	sumv = 0
	rev = 0
	while start <= len(li) + end:
		if rev % 2 == 0:
			sumv += li[start]
			start += 1
		else:
			sumv += li[end]
			end -= 1
		if sumv > upperbound:
			cnt[rev % 2] += sumv
			upperbound += sumv - upperbound
			sumv = 0
			rev += 1
	if sumv != 0:
		cnt[rev % 2] += sumv
		rev += 1
	print(rev, cnt[0], cnt[1], sep=' ')


import sys

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

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

def mints():
	return 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()


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

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

def main():
	for _ in range(II()):
		n = II()
		cc = LI()
		a = cc[0]
		b = 0
		i = 1
		j = n - 1
		ps = a
		cnt = 1
		while i <= j:
			s = 0
			while i <= j and s <= ps:
				s += cc[j]
				j -= 1
			b += s
			cnt += 1
			ps = s
			if j < i:
				break
			s = 0
			while i <= j and s <= ps:
				s += cc[i]
				i += 1
			a += s
			cnt += 1
			ps = s
		print(cnt, a, b)
main()


def solve(size, array):
	alice = 1
	bob = size - 1
	alice_candies = array[0]
	bob_candies = 0
	moves = 1
	bob_total = bob_candies
	alice_total = alice_candies
	visited = [False] * size
	visited[0] = True
	while alice <= bob:
		bob_candies = 0
		while not visited[bob] and bob_candies <= alice_candies:
			flag_bob = 1
			flag_alice = 0
			bob_candies += array[bob]
			visited[bob] = True
			bob -= 1
		bob_total += bob_candies
		if flag_bob == 1:
			moves += 1
		alice_candies = 0
		while not visited[alice] and alice_candies <= bob_candies:
			flag_alice = 1
			flag_bob = 0
			alice_candies += array[alice]
			visited[alice] = True
			alice += 1
		alice_total += alice_candies
		if flag_alice == 1:
			moves += 1
	print(moves, alice_total, bob_total)
testCases = int(input())
while testCases:
	n = int(input())
	A = [int(x) for x in input().split()]
	solve(n, A)
	testCases -= 1


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)


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	a = 0
	b = 0
	mo = 0
	mo += 1
	a += A.pop(0)
	prev = a
	boo = False
	while len(A) != 0:
		temp = 0
		if boo == False:
			plp = -1
			while temp <= prev and len(A) != 0:
				temp += A.pop(plp)
			b += temp
			prev = temp
			mo += 1
			boo = True
		else:
			plp = 0
			while temp <= prev and len(A) != 0:
				temp += A.pop(plp)
			a += temp
			prev = temp
			mo += 1
			boo = False
	print(mo, a, b)


amount = int(input())
for i in range(amount):
	n = int(input())
	sweets = list(map(int, input().split()))
	alice = sweets[0]
	sweets = sweets[1:]
	bob = 0
	steps = 1
	last_step = alice
	while len(sweets) > 0:
		if steps % 2 == 1:
			new_step = 0
			while new_step <= last_step and len(sweets) > 0:
				new_step += sweets[-1]
				sweets = sweets[:-1]
			last_step = new_step
			bob += last_step
		else:
			new_step = 0
			while new_step <= last_step and len(sweets) > 0:
				new_step += sweets[0]
				sweets = sweets[1:]
			last_step = new_step
			alice += last_step
		steps += 1
	print('{} {} {}'.format(steps, alice, bob))


t = int(input())
for _ in range(t):
	n = int(input())
	candies = list(map(int, input().split()))
	num_to_beat = 0
	left_total = 0
	right_total = 0
	this_turn = 0
	turn = 'a'
	moves = 1
	while n > 0:
		if turn == 'a':
			left_total += candies[0]
			this_turn += candies[0]
			candies.pop(0)
		else:
			right_total += candies[-1]
			this_turn += candies[-1]
			candies.pop(-1)
		if this_turn > num_to_beat:
			num_to_beat = this_turn
			this_turn = 0
			if turn == 'a':
				turn = 'b'
			else:
				turn = 'a'
			if len(candies) != 0:
				moves += 1
		n -= 1
	print(f'{moves} {left_total} {right_total}')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = 0
	turn = True
	pa = 0
	pb = a[0] - 1
	aacc = 0
	bacc = 0
	while True:
		m += 1
		if not turn:
			i = len(a) - 1
			s = 0
			while s <= pa and i >= 0:
				s += a[i]
				i -= 1
			pb = s
			bacc += s
			a = a[:i + 1]
			turn = True
		else:
			i = 0
			s = 0
			while s <= pb and i < len(a):
				s += a[i]
				i += 1
			pa = s
			aacc += s
			a = a[i:]
			turn = False
		if len(a) == 0 or (turn and sum(a) < pb) or (not turn and sum(a) < pa):
			if len(a) != 0:
				m += 1
			if turn:
				aacc += sum(a)
			else:
				bacc += sum(a)
			break
	print(m, aacc, bacc)


def eat(candies):
	(a_last, a_total) = (0, 0)
	(b_last, b_total) = (0, 0)
	(a_turn, b_turn) = (True, False)
	moves = 0
	while len(candies) > 0:
		if a_turn:
			candy = candies.pop(0)
			a_last += candy
			a_total += candy
			if a_last > b_last or len(candies) == 0:
				b_turn = True
				a_turn = False
				b_last = 0
				moves += 1
		else:
			candy = candies.pop(-1)
			b_last += candy
			b_total += candy
			if b_last > a_last or len(candies) == 0:
				a_turn = True
				b_turn = False
				a_last = 0
				moves += 1
	return (moves, a_total, b_total)
import os
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	candies = list(map(int, input().split()))
	(moves, a_total, b_total) = eat(candies)
	print(moves, a_total, b_total)


t = int(input())
for _ in range(t):
	n = int(input())
	(*arr,) = map(int, input().split())
	if n == 1:
		print(1, arr[0], 0)
	else:
		count = 1
		a_total = arr[0]
		b_total = 0
		a_curr = arr[0]
		b_curr = 0
		a_ind = 1
		b_ind = n - 1
		while a_ind <= b_ind:
			flag = False
			while b_ind >= a_ind and b_curr <= a_curr:
				b_curr += arr[b_ind]
				b_ind -= 1
				flag = True
			if flag:
				count += 1
				b_total += b_curr
			a_curr = 0
			flag = False
			while b_ind >= a_ind and a_curr <= b_curr:
				a_curr += arr[a_ind]
				a_ind += 1
				flag = True
			if flag:
				count += 1
				a_total += a_curr
			b_curr = 0
		print(count, a_total, b_total)


t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split(' ')))
	(alice, bob, moves) = (0, 0, 1)
	alice = ar[0]
	ar.pop(0)
	(curalice, curbob) = (alice, 0)
	while len(ar) > 0:
		while len(ar) > 0 and curbob <= curalice:
			bob += ar[-1]
			curbob += ar[-1]
			ar.pop()
			if len(ar) == 0 or curbob > curalice:
				curalice = 0
				moves += 1
		while len(ar) > 0 and curalice <= curbob:
			alice += ar[0]
			curalice += ar[0]
			ar.pop(0)
			if len(ar) == 0 or curalice > curbob:
				curbob = 0
				moves += 1
	print(str(moves) + ' ' + str(alice) + ' ' + str(bob))


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	start = 0
	end = n - 1
	A = 0
	B = 0
	alice = 1
	bob = 0
	ct = 0
	k = 0
	while start <= end:
		if alice:
			ct += 1
			sum = 0
			i = start
			while i <= end and sum <= k:
				sum += arr[i]
				i += 1
			start = i
			A += sum
			k = sum
		else:
			ct += 1
			sum = 0
			j = end
			while j >= start and sum <= k:
				sum += arr[j]
				j -= 1
			end = j
			k = sum
			B += sum
		alice ^= 1
		bob ^= 1
	print(ct, A, B)


tests = int(input())
for test in range(tests):
	n = int(input())
	a = list(map(int, input().split()))
	moves = 0
	alice = 0
	bob = 0
	first = 0
	last = n - 1
	turn = 0
	prevalice = 0
	prevbob = 0
	while True:
		if first > last:
			break
		moves += 1
		if turn == 0:
			prevalice = 0
			while first <= last and prevalice <= prevbob:
				prevalice += a[first]
				alice += a[first]
				first += 1
			if prevalice <= prevbob:
				break
		else:
			prevbob = 0
			while first <= last and prevalice >= prevbob:
				prevbob += a[last]
				bob += a[last]
				last -= 1
			if prevalice >= prevbob:
				break
		turn = 1 - turn
	print(moves, alice, bob)


for i in range(int(input())):
	q = int(input())
	w = list(map(int, input().split()))
	k = [w[0]]
	p = 'a'
	t = 0
	l = []
	r = 0
	i = 1
	j = q - 1
	while i < j:
		while i <= j and r <= k[-1]:
			r += w[j]
			j -= 1
		if r != 0:
			l.append(r)
			p = 'b'
		r = 0
		while i <= j and t <= l[-1]:
			t += w[i]
			i += 1
		if t != 0:
			k.append(t)
			p = 'a'
		t = 0
	o = sum(w) - sum(k) - sum(l)
	if o > 0:
		print(len(k) + len(l) + 1, sum(k), sum(l) + o)
	else:
		print(len(k) + len(l), sum(k), sum(l))


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	temp_a = 0
	temp_b = 0
	s_a = 0
	s_b = 0
	i = 1
	while len(l) != 0:
		if i % 2 != 0:
			j = 0
			temp_a = 0
			while True:
				if len(l) == 0:
					break
				if temp_a > temp_b:
					break
				temp_a += l[j]
				s_a += l[j]
				l.pop(j)
			i += 1
		else:
			temp_b = 0
			while True:
				if len(l) == 0:
					break
				if temp_b > temp_a:
					break
				temp_b += l[len(l) - 1]
				s_b += l[len(l) - 1]
				l.pop(len(l) - 1)
			i += 1
	print(i - 1, s_a, s_b)


t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	i = 0
	j = n - 1
	moves = 0
	a = 0
	b = 0
	(diffA, diffB) = (0, 0)
	while i <= j:
		if moves == 0:
			diffA = c[i]
			i += 1
			moves += 1
		else:
			diffA = 0
			while diffA <= diffB and i <= j:
				diffA += c[i]
				i += 1
			moves += 1
		a += diffA
		diffB = 0
		while diffB <= diffA and i <= j:
			diffB += c[j]
			j -= 1
		if diffB > 0:
			moves += 1
		b += diffB
	print('{} {} {}'.format(moves, a, b))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	al = 0
	bb = 0
	t = 0
	i = 0
	j = n - 1
	s = n
	ali = True
	mv = 0
	while s:
		mv += 1
		if ali:
			c = 0
			while c <= t and s:
				c += a[i]
				i += 1
				s -= 1
			al += c
			t = c
		else:
			c = 0
			while c <= t and s:
				c += a[j]
				j -= 1
				s -= 1
			bb += c
			t = c
		ali = not ali
	print(mv, al, bb)


n = int(input())
for i in range(0, n):
	o = int(input())
	p = input().rstrip().split(' ')
	totA = 0
	totB = 0
	moves = 0
	S = 0
	D = 0
	I = 0
	while 1:
		if I % 2 == 0:
			totA = 0
			while len(p) != 0 and totA <= totB:
				totA += int(p[0])
				del p[0]
			I += 1
			S += totA
		else:
			totB = 0
			while len(p) != 0 and totB <= totA:
				totB += int(p[len(p) - 1])
				del p[len(p) - 1]
			I += 1
			D += totB
		moves += 1
		if len(p) == 0:
			break
	print(moves, S, D)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	mov = []
	moves = 0
	a = 0
	b = 0
	while len(l) > 0:
		moves += 1
		if moves == 1:
			mov.append(l[0])
			a += l[0]
			l.remove(l[0])
			continue
		s = 0
		if moves % 2 == 0:
			l.reverse()
			for j in range(len(l)):
				if j != 0:
					j = 0
				s += l[j]
				l.remove(l[j])
				if s > mov[len(mov) - 1]:
					break
			b += s
			mov.append(s)
		if moves % 2 == 1:
			l.reverse()
			for j in range(len(l)):
				if j != 0:
					j = 0
				s += l[j]
				l.remove(l[j])
				if s > mov[len(mov) - 1]:
					break
			a += s
			mov.append(s)
	print(len(mov), a, b)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	steps = 0
	alice = 0
	a_counter = 0
	bob = 0
	b_counter = 0
	while a:
		if steps % 2 == 0:
			a_counter = 0
			pos = 0
			if sum(a) <= b_counter:
				alice += sum(a)
				a = []
			else:
				while a_counter <= b_counter:
					a_counter += a[pos]
					pos += 1
				a = a[pos:]
				alice += a_counter
		else:
			b_counter = 0
			pos = len(a) - 1
			if sum(a) <= a_counter:
				bob += sum(a)
				a = []
			else:
				while b_counter <= a_counter:
					b_counter += a[pos]
					pos -= 1
				a = a[:pos + 1]
				bob += b_counter
		steps += 1
	print(steps, alice, bob)

def main():
	for _ in range(int(input())):
		solve()
main()


t = int(input())
for p in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	i = 0
	j = n - 1
	p = 0
	x = 0
	y = 0
	a = 0
	c = 0
	while i <= j:
		if p % 2 == 0:
			r = i
			x = 0
			while r <= j:
				x += b[r]
				a += b[r]
				if x > y:
					r += 1
					break
				r += 1
			i = r
		else:
			r = j
			y = 0
			while r >= i:
				y += b[r]
				c += b[r]
				if y > x:
					r += -1
					break
				r += -1
			j = r
		p += 1
	print(p, a, c)


c = int(input())
for _ in range(c):
	n = int(input())
	string = input().split()
	alisa = 0
	i_alisa = 0
	bob = 0
	i_bob = n - 1
	count = 0
	tmp_alisa = 0
	tmp_bob = 0
	while i_alisa <= i_bob:
		tmp_alisa = 0
		while tmp_alisa <= tmp_bob and i_alisa <= i_bob:
			tmp_alisa += int(string[i_alisa])
			i_alisa += 1
		count += 1
		alisa += tmp_alisa
		if tmp_alisa <= tmp_bob or i_alisa > i_bob:
			break
		tmp_bob = 0
		while tmp_bob <= tmp_alisa and i_bob >= i_alisa:
			tmp_bob += int(string[i_bob])
			i_bob -= 1
		count += 1
		bob += tmp_bob
		if tmp_bob <= tmp_alisa or i_alisa > i_bob:
			break
	print(f'{count} {alisa} {bob}')


t = int(input())
for z in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	at = 0
	bt = 0
	al = -1
	bl = -1
	f = True
	run = True
	m = 0
	while len(l) > 0 and run:
		m += 1
		if f:
			if al == -1:
				at += l[0]
				al = l[0]
				l.pop(0)
			else:
				al = 0
				while al <= bl:
					at += l[0]
					al += l[0]
					l.pop(0)
					if len(l) == 0:
						run = False
						break
			f = False
		else:
			bl = 0
			while bl <= al:
				bt += l[-1]
				bl += l[-1]
				l.pop()
				if len(l) == 0:
					run = False
					break
			f = True
	print(m, at, bt)


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	arr = intl()
	ans = 0
	turn = 1
	a = 0
	b = 0
	al = 0
	bl = 0
	i = 0
	j = n - 1
	while i <= j:
		if turn == 1:
			ans += 1
			turn = 0
			s = 0
			while i <= j and i < n and (s <= bl):
				s += arr[i]
				i += 1
			al = s
			a += s
		else:
			turn = 1
			ans += 1
			s = 0
			while i <= j and j >= 0 and (s <= al):
				s += arr[j]
				j -= 1
			bl = s
			b += s
	print(ans, a, b)
for _ in range(iinp()):
	solve()


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)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = l[0]
	b = 0
	flag = True
	c_a = 0
	c_b = 0
	p_b = n - 1
	p_a = 1
	temp = l[0]
	counter = 1
	candy = 1
	if n == 1:
		print(1, l[0], 0)
	else:
		for j in range(n):
			if flag:
				if j % 2 == 0:
					while c_b <= temp:
						c_b += l[p_b]
						p_b -= 1
						candy += 1
						if candy >= n:
							flag = False
							if candy > n:
								c_b -= l[p_b + 1]
							break
					b += c_b
					temp = c_b
					c_b = 0
				else:
					while c_a <= temp:
						c_a += l[p_a]
						p_a += 1
						candy += 1
						if candy >= n:
							flag = False
							if candy > n:
								c_a -= l[p_a - 1]
							break
					a += c_a
					temp = c_a
					c_a = 0
				counter += 1
				if candy >= n:
					flag = False
					break
			else:
				break
		print(counter, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	alice = 0
	bob = 0
	palice = 0
	pbob = 0
	calice = 0
	cbob = 0
	palice += c.pop(0)
	alice += palice
	turn = 1
	alice_turn = 0
	while len(c) > 0:
		if alice_turn:
			if pbob >= calice:
				calice += c.pop(0)
				if len(c) == 0:
					alice += calice
					turn += 1
			else:
				palice = calice
				alice += palice
				calice = 0
				turn += 1
				alice_turn = 0
		elif palice >= cbob:
			cbob += c.pop(-1)
			if len(c) == 0:
				bob += cbob
				turn += 1
		else:
			pbob = cbob
			bob += pbob
			cbob = 0
			turn += 1
			alice_turn = 1
	print(turn, end=' ')
	print(alice, end=' ')
	print(bob)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	y = 0
	i = -1
	j = n
	c = 0
	p = 0
	q = 0
	if n == 1:
		print(1, a[0], 0)
		continue
	while 1:
		c += 1
		if c % 2 == 1:
			while x <= y:
				i += 1
				x += a[i]
				p += a[i]
				if i + 1 == j:
					break
			if i + 1 == j:
				break
			else:
				y = 0
		else:
			while y <= x:
				j -= 1
				y += a[j]
				q += a[j]
				if i == j - 1:
					break
			if i == j - 1:
				break
			else:
				x = 0
	print(c, p, q)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(_) for _ in input().split()]
	(ansA, ansB) = (a[0], 0)
	need = a[0]
	cnt = 1
	aa = deque(a[1:n])
	popCnt = 0
	isArice = False
	while len(aa) > 0:
		popCnt = 0
		while popCnt <= need:
			if isArice:
				num = aa.popleft()
				ansA += num
				popCnt += num
				if len(aa) <= 0:
					break
			else:
				num = aa.pop()
				ansB += num
				popCnt += num
				if len(aa) <= 0:
					break
		need = popCnt
		if isArice:
			isArice = False
		else:
			isArice = True
		cnt += 1
	print(cnt, ansA, ansB)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	q = deque(a)
	if len(a) == 1:
		print(1, a[0], 0)
		continue
	ca = a[0]
	cb = 0
	q.popleft()
	isalice = False
	prev = a[0]
	g = 1
	while q:
		g += 1
		if isalice:
			cs = 0
			while q and cs <= prev:
				rmv = q.popleft()
				cs += rmv
				ca += rmv
			isalice = False
			prev = cs
		else:
			cs = 0
			while q and cs <= prev:
				rmv = q.pop()
				cs += rmv
				cb += rmv
			isalice = True
			prev = cs
	print(g, ca, cb)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	cnt = 0
	al = 0
	bo = 0
	alice = 0
	bob = 0
	while len(a) > 0:
		alice = 0
		if a[0] > bob:
			alice = a.pop(0)
			cnt += 1
		else:
			while True:
				if alice > bob or len(a) == 0:
					break
				alice += a.pop(0)
			cnt += 1
		al += alice
		bob = 0
		if len(a) == 0:
			break
		if a[-1] > alice:
			bob = a.pop()
			cnt += 1
		else:
			while True:
				if bob > alice or len(a) == 0:
					break
				bob += a.pop()
			cnt += 1
		bo += bob
	print(cnt, al, bo)


class Player:

	def __init__(self) -> None:
		self.points = 0
		self.moves = 0
		self.pointer = 0
		self.lmv = 0
for _ in range(int(input())):
	n = int(input())
	candies = list(map(int, input().split()))
	alice = Player()
	bob = Player()
	lmv = 0
	player = alice
	while alice.pointer + bob.pointer < n:
		player.moves += 1
		while player.lmv <= lmv and alice.pointer + bob.pointer < n:
			player.lmv += candies[player.pointer if player == alice else -(player.pointer + 1)]
			player.pointer += 1
		player.points += player.lmv
		lmv = player.lmv
		player.lmv = 0
		player = bob if player == alice else alice
	print(alice.moves + bob.moves, alice.points, bob.points)


n = int(input())

def get_answer(arr):
	(r, a, b) = (0, 0, 0)
	(i, j) = (0, len(arr) - 1)
	s = 0
	while i <= j:
		t = 0
		while t <= s and i <= j:
			t += int(arr[i])
			a += int(arr[i])
			i += 1
		r += 1
		s = t
		if i == j + 1:
			print(r, a, b)
			return
		t = 0
		while t <= s and i <= j:
			t += int(arr[j])
			b += int(arr[j])
			j -= 1
		r += 1
		s = t
		if i == j + 1:
			print(r, a, b)
			return
for _ in range(n):
	v = input()
	arr = input().split()
	get_answer(arr)


from collections import defaultdict as dd, deque
t = int(input())
for _ in range(t):
	n = int(input())
	A = deque([int(x) for x in input().split()])
	a = 0
	b = 0
	l = 0
	moves = 0
	while A:
		cur = 0
		while A and cur <= l:
			a += A[0]
			cur += A[0]
			A.popleft()
		l = cur
		moves += 1
		if not A:
			break
		cur = 0
		while A and cur <= l:
			b += A[-1]
			cur += A[-1]
			A.pop()
		l = cur
		moves += 1
		if not A:
			break
	print(moves, a, b)


def parse():
	inputs = []
	nbCase = int(input())
	for i in range(nbCase):
		input()
		line = input()
		inputs.append(list(map(int, line.split())))
	return inputs

def solve():
	inputs = parse()
	for case in inputs:
		answer = game(case)
		print(answer[0], answer[1], answer[2])

def game(board):
	alice = 0
	bob = 0
	cpt_moves = 0
	last_move = 0
	player = 1
	while len(board) != 0:
		current_eat = 0
		while current_eat <= last_move:
			if player == 1:
				current_eat += board[0]
				board = board[1:]
			else:
				current_eat += board[-1]
				board = board[:-1]
			if len(board) == 0:
				break
		cpt_moves += 1
		last_move = current_eat
		if player == 1:
			alice += current_eat
			player = -1
		else:
			bob += current_eat
			player = 1
	return [cpt_moves, alice, bob]
solve()


def rs():
	return input().strip()

def ri():
	return int(input())

def ria():
	return list(map(int, input().split()))

def ia_to_s(a):
	return ' '.join([str(s) for s in a])

def solve(n, a):
	moves = 0
	cur_player = 0
	idx = [0, n - 1]
	vols = [0, 0]
	total = [0, 0]
	d = 1
	while idx[1] >= idx[0]:
		other_player = (cur_player + 1) % 2
		vols[cur_player] = 0
		while vols[cur_player] <= vols[other_player] and idx[1] >= idx[0]:
			vols[cur_player] += a[idx[cur_player]]
			idx[cur_player] += d
		total[cur_player] += vols[cur_player]
		moves += 1
		d = -d
		cur_player = other_player
	return [moves] + total

def main():
	for _ in range(ri()):
		n = ri()
		a = ria()
		print(ia_to_s(solve(n, a)))
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	alice = a[0]
	bob = 0
	l = 1
	r = n - 1
	moves = 1
	prev = a[0]
	while l <= r:
		cs = 0
		if moves % 2 == 0:
			while l <= r:
				cs += a[l]
				l += 1
				if cs > prev:
					break
			alice += cs
		if moves % 2 == 1:
			while l <= r:
				cs += a[r]
				r -= 1
				if cs > prev:
					break
			bob += cs
		prev = cs
		moves += 1
	print(moves, alice, bob)


def candyGameResult(nCandies, candies):
	(Alice_sCandiesSize, Bob_sCandiesSize) = (candies[0], 0)
	(pastCandiesSize, currCandiesSize) = (Alice_sCandiesSize, 0)
	nMoves = 1
	(iAlice, iBob) = (0, nCandies)
	while iAlice + 1 < iBob:
		nMoves += 1
		if Alice_sCandiesSize > Bob_sCandiesSize:
			while pastCandiesSize >= currCandiesSize and iAlice + 1 < iBob:
				iBob -= 1
				currCandiesSize += candies[iBob]
			Bob_sCandiesSize += currCandiesSize
		else:
			while pastCandiesSize >= currCandiesSize and iAlice + 1 < iBob:
				iAlice += 1
				currCandiesSize += candies[iAlice]
			Alice_sCandiesSize += currCandiesSize
		(pastCandiesSize, currCandiesSize) = (currCandiesSize, 0)
	return f'{nMoves} {Alice_sCandiesSize} {Bob_sCandiesSize}'

def testCase_1352d():
	nCandies = int(input())
	return (nCandies, list(map(int, input().split())))
nTestCases = int(input())
testCases = tuple((testCase_1352d() for testCase in range(nTestCases)))
tuple((print(candyGameResult(*testCase)) for testCase in testCases))


t = int(input())
for i in range(t):
	n = int(input())
	candies = list(map(int, input().split()))
	alice_pointer = 0
	bob_pointer = n - 1
	alice_current = 0
	bob_current = 0
	alice = 0
	bob = 0
	toggle = False
	number_of_moves = 0
	while alice_pointer <= bob_pointer:
		if toggle == False:
			alice_current += candies[alice_pointer]
			if alice_current > bob_current:
				alice += alice_current
				bob_current = 0
				toggle = True
				number_of_moves += 1
			alice_pointer += 1
		else:
			bob_current += candies[bob_pointer]
			if bob_current > alice_current:
				bob += bob_current
				alice_current = 0
				toggle = False
				number_of_moves += 1
			bob_pointer -= 1
	if toggle:
		bob += bob_current
	else:
		alice += alice_current
	if alice_current != 0 and bob_current != 0:
		number_of_moves += 1
	print(number_of_moves, alice, bob)


for s in [*open(0)][2::2]:
	a = [*map(int, s.split())]
	k = c = i = 0
	m = [0, 0]
	r = [0, 0]
	while a:
		c += m[k] < 1
		m[k] += a.pop(i)
		if m[k] > m[k ^ 1]:
			r[k] += m[k]
			k ^= 1
			m[k] = 0
			i = -i - 1
	r[k] += m[k]
	print(c, *r)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	flag = 0
	a = l[0]
	b = 0
	a_eat = l[0]
	b_eat = 0
	i = 0
	j = len(l)
	count = 1
	while j > i + 1:
		if a > b:
			j -= 1
			if flag == 0:
				b = 0
				count += 1
				flag = 1
			b += l[j]
			b_eat += l[j]
		elif b > a:
			i += 1
			if flag == 1:
				a = 0
				count += 1
				flag = 0
			a += l[i]
			a_eat += l[i]
		elif flag == 1:
			j -= 1
			b += l[j]
			b_eat += l[j]
		else:
			i += 1
			a += l[i]
			a_eat += l[i]
	print(count, a_eat, b_eat)
17


T = int(input())
for t in range(T):
	input()
	candies = [int(i) for i in input().split()]
	moves = 0
	turn = True
	(sum1, sum2) = (0, 0)
	currentsum = 0
	lastsum = 0
	while len(candies) != 0:
		if turn:
			s = candies.pop(0)
			sum1 += s
			currentsum += s
		else:
			s = candies.pop()
			sum2 += s
			currentsum += s
		if currentsum > lastsum:
			lastsum = currentsum
			currentsum = 0
			turn = not turn
			moves += 1
	if currentsum != 0:
		moves += 1
	print(moves, sum1, sum2)


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	a = list(read_ints())
	l = 1
	r = n - 1
	moves = 1
	alice = a[0]
	bob = 0
	last = a[0]
	while l <= r:
		s = 0
		if moves % 2 == 1:
			while s <= last and l <= r:
				s += a[r]
				bob += a[r]
				r -= 1
		else:
			while s <= last and l <= r:
				s += a[l]
				alice += a[l]
				l += 1
		moves += 1
		last = s
	print(moves, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	a = arr[0]
	b = 0
	(a1, b1) = (arr[0], 0)
	l = 0
	r = n
	m = 1
	ok = False
	while l + 1 < r and l + 1 <= n - 1 and (r - 1 >= 0):
		while b1 <= a1 and r - 1 >= 0 and (r - 1 > l):
			r -= 1
			b1 += arr[r]
			ok = True
		b += b1
		a1 = 0
		if ok:
			m += 1
			ok = False
		while a1 <= b1 and l + 1 <= n - 1 and (l + 1 < r):
			l += 1
			a1 += arr[l]
			ok = True
		if ok:
			m += 1
			ok = False
		a += a1
		b1 = 0
	print(m, a, b)


t = int(input())
while t:
	t = t - 1
	n = int(input())
	l = list(map(int, input().split()))
	(mov, a, b) = (0, 0, 0)
	(alice, bob) = (0, 0)
	(i, j) = (0, n - 1)
	turn = 1
	while j >= i:
		if turn == 1:
			while alice <= bob and j >= i:
				alice += l[i]
				a += l[i]
				i += 1
			mov += 1
			turn = 2
			bob = 0
		elif turn == 2:
			while bob <= alice and j >= i:
				bob += l[j]
				b += l[j]
				j -= 1
			mov += 1
			turn = 1
			alice = 0
	print(mov, a, b)


from collections import deque
t = int(input())
for i in range(t):
	n = int(input())
	dq = deque([int(i) for i in input().split()])
	alice_total = 0
	bob_total = 0
	bob_prev = 0
	alice_prev = 0
	turns = 0
	while len(dq) > 0:
		if turns % 2:
			bob_prev = 0
			while len(dq) > 0 and bob_prev <= alice_prev:
				bob_prev += dq.pop()
			bob_total += bob_prev
		else:
			alice_prev = 0
			while len(dq) > 0 and alice_prev <= bob_prev:
				alice_prev += dq.popleft()
			alice_total += alice_prev
		turns += 1
	print(turns, alice_total, bob_total)


import sys
import math

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	moves = 0
	asum = 0
	bsum = 0
	aind = 0
	bind = n
	sum1 = 0
	while aind < bind:
		sum2 = 0
		while aind < bind and sum2 <= sum1:
			sum2 += a[aind]
			aind += 1
		moves += 1
		asum += sum2
		sum1 = sum2
		sum2 = 0
		while aind < bind and sum2 <= sum1:
			sum2 += a[bind - 1]
			bind -= 1
		bsum += sum2
		if sum2 != 0:
			moves += 1
		sum1 = sum2
	print(moves, asum, bsum)


def solution(N, candies):
	index = [0, N - 1]
	tot = [0, 0]
	prev = [0, 0]
	moves = 0
	turn = False
	while index[0] <= index[1]:
		prev[turn] = 0
		while prev[turn] <= prev[not turn] and index[0] <= index[1]:
			prev[turn] += candies[index[turn]]
			index[turn] += 1
			if turn:
				index[turn] -= 2
		moves += 1
		tot[turn] += prev[turn]
		turn = not turn
	print(moves, tot[0], tot[1])
t = int(input())
for i in range(1, t + 1):
	N = int(input())
	candies = list(map(int, input().split(' ')))
	solution(N, candies)


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(r, a, b, prev) = (0, 0, 0, 0)
	(a1, b1) = (0, n - 1)
	while a1 <= b1:
		s = 0
		if a1 <= b1:
			while (a1 <= b1) & (s <= prev):
				s += l[a1]
				a1 += 1
			r += 1
			a += s
			prev = s
			s = 0
		if a1 <= b1:
			while (a1 <= b1) & (s <= prev):
				s += l[b1]
				b1 -= 1
			r += 1
			b += s
			prev = s
	print(r, a, b)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(alice_sweets, bob_sweet) = (0, 0)
	last_eaten = 0
	curr_eaten = 0
	(alice_ptr, bob_ptr) = (0, n - 1)
	moves = 1
	while alice_ptr <= bob_ptr:
		if moves & 1:
			if curr_eaten > last_eaten:
				moves += 1
				alice_sweets += curr_eaten
				last_eaten = curr_eaten
				curr_eaten = 0
			else:
				curr_eaten += arr[alice_ptr]
				alice_ptr += 1
		elif curr_eaten > last_eaten:
			moves += 1
			bob_sweet += curr_eaten
			last_eaten = curr_eaten
			curr_eaten = 0
		else:
			curr_eaten += arr[bob_ptr]
			bob_ptr -= 1
	if moves & 1:
		alice_sweets += curr_eaten
	else:
		bob_sweet += curr_eaten
	print(moves, alice_sweets, bob_sweet)


n = int(input())
for i in range(n):
	none = int(input())
	l = [int(i) for i in input().split()]
	al = 1
	bo = none - 1
	(a, b) = (l[0], 0)
	sch = 1
	z = True
	(a_cur, b_cur) = (a, 0)
	su = 1
	while True and none > 1:
		su += 1
		if sch:
			b_cur = 0
			while b_cur <= a_cur:
				b += l[bo]
				b_cur += l[bo]
				bo -= 1
				if bo < al:
					z = False
					break
			sch = 0
		else:
			a_cur = 0
			while a_cur <= b_cur:
				a += l[al]
				a_cur += l[al]
				al += 1
				if al > bo:
					z = False
					break
			sch = 1
		if not z:
			break
	print(su, a, b)


for i in range(int(input())):
	N = int(input())
	moves = 1
	lis = list(map(int, input().split()))
	i = 1
	j = N - 1
	a = lis[0]
	ai = lis[0]
	bi = 0
	b = 0
	while i <= j:
		if b < a:
			moves += 1
			while b <= a and i <= j:
				b += lis[j]
				j -= 1
			bi += b
			a = 0
			continue
		if a < b:
			moves += 1
			while a <= b and i <= j:
				a += lis[i]
				i += 1
			ai += a
			b = 0
	print(moves, ai, bi)


def candies(n, array):
	i = 0
	j = n - 1
	turns = 0
	prev = 0
	p = 'a'
	a_count = 0
	b_count = 0
	while i <= j:
		if p == 'a':
			c = 0
			while i <= j and c <= prev:
				c += array[i]
				i += 1
			prev = c
			p = 'b'
			a_count += c
		else:
			c = 0
			while i <= j and c <= prev:
				c += array[j]
				j -= 1
			prev = c
			p = 'a'
			b_count += c
		turns += 1
	return (turns, a_count, b_count)
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = candies(n, l)
	print(ans[0], ans[1], ans[2])


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	arr = list(map(int, input().split()))
	a = 0
	b = len(arr) - 1
	moves = 0
	alice = 0
	bob = 0
	last_a = 0
	last_b = 0
	while a <= b:
		moves = moves + 1
		last_a = 0
		while last_a <= last_b and a <= b:
			last_a = last_a + arr[a]
			a = a + 1
		alice = alice + last_a
		if a > b:
			break
		moves = moves + 1
		last_b = 0
		while last_b <= last_a and a <= b:
			last_b = last_b + arr[b]
			b = b - 1
		bob = bob + last_b
		if a > b:
			break
	print(moves, alice, bob)


for tt in range(int(input())):
	n = int(input())
	L = [int(i) for i in input().split()]
	(l, r) = (-1, n)
	(f1, f2) = (True, False)
	(s1, s2, s, q) = ([], [], 0, 0)
	while l < r - 1:
		if f1 == True:
			l += 1
			if len(s1) == 0:
				s1.append(L[l])
				(f1, f2) = (False, True)
			else:
				if s <= s2[len(s2) - 1]:
					s += L[l]
					q = 1
				if s > s2[len(s2) - 1]:
					s1.append(s)
					(s, q) = (0, 0)
					(f1, f2) = (False, True)
		elif f2 == True:
			r -= 1
			if s <= s1[len(s1) - 1]:
				s += L[r]
				q = -1
			if s > s1[len(s1) - 1]:
				s2.append(s)
				(s, q) = (0, 0)
				(f1, f2) = (True, False)
	if q == 1:
		s1.append(s)
	elif q == -1:
		s2.append(s)
	print(len(s1) + len(s2), sum(s1), sum(s2))


def notd(n, a):
	i = 1
	j = n - 1
	s = 1
	p1s = a[0]
	p1ts = a[0]
	p2s = 0
	p2ts = 0
	while i <= j:
		while i <= j and p2s <= p1s:
			p2s += a[j]
			p2ts += a[j]
			j -= 1
		s += 1
		if i > j:
			break
		p1s = 0
		while i <= j and p1s <= p2s:
			p1s += a[i]
			p1ts += a[i]
			i += 1
		s += 1
		p2s = 0
	print(s, p1ts, p2ts)
for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	notd(n, a)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	ali = 0
	bob = 0
	cali = 0
	cbob = 0
	ai = -1
	bi = len(a)
	it = 0
	f = 0
	while ai < bi:
		while cali <= cbob and ai < bi:
			ai += 1
			if ai < bi:
				f = 1
				cali += a[ai]
		ali += cali
		it += f
		f = 0
		if ai >= bi:
			break
		cbob = 0
		while cali >= cbob and ai < bi:
			bi -= 1
			if ai < bi:
				cbob += a[bi]
				f = 1
		bob += cbob
		cali = 0
		it += f
		f = 0
	print(it, ali, bob)


from sys import stdin
from collections import deque

def main():
	readline = stdin.readline
	t = int(readline())
	res = []
	for i in range(t):
		n = int(readline())
		a = list(map(int, readline().split()))
		d = deque(a)
		alice = 0
		bob = 0
		t_alice = 0
		t_bob = 0
		t_move = 0
		flag = False
		now = 0
		while len(d) > 0:
			if now == 0:
				if flag == False:
					t_move += 1
					flag = True
				m = d.popleft()
				alice += m
				if alice > bob:
					now = 1
					t_alice += alice
					bob = 0
				elif len(d) == 0:
					t_alice += alice
			else:
				if flag:
					t_move += 1
					flag = False
				m = d.pop()
				bob += m
				if bob > alice:
					now = 0
					t_bob += bob
					alice = 0
				elif len(d) == 0:
					t_bob += bob
		res.append([t_move, t_alice, t_bob])
	for i in range(t):
		print(*res[i])
main()


test = int(input())
while test != 0:
	n = int(input())
	a = list([int(x) for x in input().split()])
	i = 0
	j = n - 1
	flag = 0
	count = 0
	suma = 0
	sumb = 0
	summ = 0
	prev = 0
	if n == 1:
		print(1, a[0], 0)
	elif n == 2:
		print(2, a[0], a[1])
	else:
		while i <= j:
			if flag == 0:
				prev = 0
				while summ >= 0 and i <= j:
					summ -= a[i]
					suma += a[i]
					prev += a[i]
					i += 1
				summ = prev
				flag = 1
			else:
				prev = 0
				while summ >= 0 and i <= j:
					summ -= a[j]
					sumb += a[j]
					prev += a[j]
					j -= 1
				summ = prev
				flag = 0
			count += 1
		print(count, suma, sumb)
	test -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(s1, s2) = (0, 0)
	(s_1, s_2) = (0, 0)
	(L, R) = (0, n - 1)
	k = 0
	while True:
		s_1 = 0
		while R >= L and s_1 <= s_2:
			s1 += a[L]
			s_1 += a[L]
			L += 1
		k += 1
		if R < L:
			break
		s_2 = 0
		while R >= L and s_2 <= s_1:
			s_2 += a[R]
			s2 += a[R]
			R -= 1
		k += 1
		if R < L:
			break
	print(k, s1, s2)


def candy_game(n, a):
	sum1 = 0
	sum2 = 0
	p1 = a[0]
	moves = 1
	sum1 += p1
	del a[0]
	p2 = 0
	while len(a) > 0:
		while p2 <= p1 and len(a) > 0:
			p2 += a[-1]
			del a[-1]
		moves += 1
		sum2 += p2
		p1 = 0
		if len(a) > 0:
			while p1 <= p2 and len(a) > 0:
				p1 += a[0]
				del a[0]
			moves += 1
			sum1 += p1
			p2 = 0
	return (moves, sum1, sum2)
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(moves, s1, s2) = candy_game(n, a)
	print(moves, s1, s2)


from sys import stdin, stdout
from collections import deque
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()
rli = lambda : map(int, stdin.readline().split())

def main():
	T = int(rl())
	for _ in range(T):
		n = int(rl())
		A = deque(rli())
		moves = 0
		(TA, TB) = (0, 0)
		(PA, PB) = (0, 0)
		curr = 'A'
		i = 0
		while A:
			ate = 0
			if curr == 'A':
				while A and ate <= PB:
					ate += A.popleft()
				TA += ate
				moves += 1
				PA = ate
				curr = 'B'
			else:
				while A and ate <= PA:
					ate += A.pop()
				TB += ate
				moves += 1
				PB = ate
				curr = 'A'
		ans = [moves, TA, TB]
		print(' '.join((str(x) for x in ans)))
	stdout.close()
main()


t = int(input())
for t in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = b = c = x = y = 0
	i = 0
	j = n - 1
	if len(l) == 1:
		print(1, l[0], 0)
	else:
		while i < j:
			if c % 2 == 0:
				if y + l[i] > x:
					a += y + l[i]
					c += 1
					x = y + l[i]
					y = 0
					if i != 0:
						j -= 1
				else:
					y += l[i]
					i += 1
			elif y + l[j] > x:
				c += 1
				b += y + l[j]
				x = y + l[j]
				y = 0
				i += 1
			else:
				y += l[j]
				j -= 1
		if y > 0:
			if c % 2 == 0:
				a += y
			else:
				b += y
			c += 1
		print(c, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	last_move = [a[0]]
	a[0] = 0
	current_move = []
	a_sum = last_move[0]
	b_sum = 0
	counter = -1
	moves = 1
	while len(a) != 1:
		while sum(current_move) <= sum(last_move):
			if a == [0]:
				break
			current_move.append(a[counter])
			del a[counter]
		if counter == -1:
			b_sum += sum(current_move)
			last_move = current_move
			current_move = []
		else:
			a_sum += sum(current_move)
			last_move = current_move
			current_move = []
		counter *= -1
		moves += 1
	print(moves, a_sum, b_sum)


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	i = 0
	j = n - 1
	a = 0
	b = 0
	ans1 = 0
	ans2 = 0
	k = 0
	while i <= j:
		k += 1
		if x == 0:
			while i <= j:
				a += l[i]
				ans1 += l[i]
				if a > b:
					b = 0
					i += 1
					break
				i += 1
		else:
			while j >= i:
				b += l[j]
				ans2 += l[j]
				if b > a:
					a = 0
					j -= 1
					break
				j -= 1
		x ^= 1
	print(k, ans1, ans2)


from collections import deque
tcs = int(input())
for tc in range(tcs):
	n = int(input())
	a = deque(map(int, input().split()))
	alice = 0
	bob = 0
	turn = 0
	prev = 0
	tot = 0
	while a:
		if turn % 2 == 0:
			cur = a.popleft()
			tot += cur
		else:
			cur = a.pop()
			tot += cur
		if tot > prev:
			if turn % 2 == 0:
				alice += tot
			else:
				bob += tot
			turn += 1
			prev = tot
			tot = 0
	if tot != 0:
		if turn % 2 == 0:
			alice += tot
		else:
			bob += tot
		turn += 1
	print(turn, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	a = 0
	b = 0
	prev = 0
	ai = -1
	bi = n
	move = 0
	while 1:
		sm = 0
		while sm <= prev and ai + 1 < bi:
			sm += ls[ai + 1]
			ai += 1
		move += 1
		a += sm
		prev = sm
		if ai + 1 >= bi:
			break
		sm = 0
		while sm <= prev and ai + 1 < bi:
			sm += ls[bi - 1]
			bi -= 1
		move += 1
		b += sm
		prev = sm
		if ai + 1 >= bi:
			break
	print(move, a, b)


import random
import math
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(1, l[0], 0)
		continue
	i = 0
	j = n - 1
	count = 0
	(al, bob) = (0, 0)
	prev_al = 0
	prev_bob = 0
	cur_al = 0
	cur_bob = 0
	while i <= j:
		count += 1
		if count % 2 == 1:
			while cur_al <= prev_bob and i <= j:
				cur_al += l[i]
				i += 1
			al += cur_al
			prev_al = cur_al
			cur_al = 0
		else:
			while cur_bob <= prev_al and i <= j:
				cur_bob += l[j]
				j -= 1
			bob += cur_bob
			prev_bob = cur_bob
			cur_bob = 0
	print(count, al, bob)


t = int(input())
for i in range(0, t, 1):
	n = int(input())
	list1 = list(map(int, input().split(' ')))
	count = 1
	totalb = 0
	totala = list1[0]
	sum1 = list1[0]
	list1.pop(0)
	turn = 2
	l = len(list1)
	sum2 = 0
	while l > 0:
		if turn == 1:
			sum1 = 0
			count = count + 1
			while sum1 <= sum2:
				l = len(list1)
				if l == 0:
					break
				sum1 = sum1 + list1[0]
				list1.pop(0)
			totala = totala + sum1
			turn = 2
			if len(list1) == 0:
				break
		if turn == 2:
			sum2 = 0
			count = count + 1
			while sum2 <= sum1:
				l = len(list1)
				if l == 0:
					break
				sum2 = sum2 + list1[l - 1]
				list1.pop()
			totalb = totalb + sum2
			turn = 1
			if len(list1) == 0:
				break
	print(count, end=' ')
	print(totala, end=' ')
	print(totalb, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	move = 0
	total = sum(s)
	fst = -1
	lst = n
	eat = 0
	Alice = 0
	bob = 0
	for i in range(n):
		if i % 2 == 0:
			fst += 1
			x = s[fst]
			while total > eat and eat >= x and (fst + 1 < lst):
				fst += 1
				x += s[fst]
			eat = x
			Alice += x
			total -= x
		else:
			lst -= 1
			x = s[lst]
			while total > eat and eat >= x and (lst - 1 > fst):
				lst -= 1
				x += s[lst]
			eat = x
			bob += x
			total -= x
		if total <= eat:
			if total > 0:
				if i % 2 == 1:
					Alice += total
				else:
					bob += total
				i += 1
			move = i + 1
			break
	print(move, Alice, bob)


import sys
agGK = int(input())
for _ in range(agGK):
	n = int(input())
	a = [int(i) for i in input().split(' ', n - 1)]
	(suma, sumb) = (0, 0)
	(pa, pb) = (0, 0)
	(aa, bb) = (-1, n)
	(g, k) = (0, 0)
	while g != 2:
		if g == 0:
			suma += a[aa + 1]
			pa += a[aa + 1]
			if pa > pb:
				g = 1
				k += 1
				pb = 0
			aa += 1
			if g == 1 and aa + 1 >= bb:
				g = 2
		else:
			pb += a[bb - 1]
			sumb += a[bb - 1]
			if pb > pa:
				g = 0
				k += 1
				pa = 0
			bb -= 1
			if g == 0 and bb - 1 <= aa:
				g = 2
	(suma, sumb) = (0, 0)
	(pa, pb) = (0, 0)
	(aa, bb) = (-1, n)
	g = 0
	while g != 2:
		if g == 0:
			suma += a[aa + 1]
			pa += a[aa + 1]
			if pa > pb:
				g = 1
				pb = 0
			aa += 1
			if aa + 1 == bb:
				g = 2
		else:
			pb += a[bb - 1]
			sumb += a[bb - 1]
			if pb > pa:
				g = 0
				pa = 0
			bb -= 1
			if bb - 1 == aa:
				g = 2
	print(k, suma, sumb)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	(i, j) = (1, n - 1)
	(a, b) = (l[0], 0)
	(x, y, cnt, mv) = (l[0], 0, 1, 1)
	while i <= j:
		if mv:
			while j >= i and x >= y:
				y += l[j]
				j -= 1
			b += y
			cnt += 1
			x = mv = 0
		else:
			while i <= j and y >= x:
				x += l[i]
				i += 1
			a += x
			cnt += 1
			(y, mv) = (0, 1)
	print(cnt, a, b)


for _ in range(int(input())):
	n = int(input())
	a = input()
	candies = list(map(int, a.split()))
	sumAlice = 0
	sumBob = 0
	weightA = 0
	weightB = 0
	left = 0
	right = n - 1
	cnt = 0
	l = 0
	r = n - 1
	while l <= r:
		if cnt % 2 == 0:
			tempA = 0
			while l <= r and tempA <= sumBob:
				tempA = tempA + candies[l]
				l += 1
			weightA = weightA + tempA
			sumAlice = tempA
		else:
			tempB = 0
			while l <= r and tempB <= sumAlice:
				tempB = tempB + candies[r]
				r -= 1
			weightB = weightB + tempB
			sumBob = tempB
		cnt += 1
	print(cnt, weightA, weightB)


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)


from collections import deque

def alice_and_bob(arr):
	arr = deque(arr)
	alice = 0
	bob = 0
	moves = 0
	prev = 0
	while len(arr):
		eat = 0
		while True and len(arr):
			value = arr.popleft()
			eat += value
			alice += value
			if eat > prev:
				moves += 1
				prev = eat
				break
			elif len(arr) == 0:
				moves += 1
		eat = 0
		while True and len(arr):
			value = arr.pop()
			eat += value
			bob += value
			if eat > prev:
				moves += 1
				prev = eat
				break
			elif len(arr) == 0:
				moves += 1
	return [str(moves), str(alice), str(bob)]
n = int(input())
for i in range(n):
	line1 = int(input().strip())
	line2 = map(lambda x: int(x), input().strip().split())
	print(' '.join(alice_and_bob(line2)))


t = int(input())
while t:
	t -= 1
	n = int(input())
	lis = list(map(int, input().split()))
	(a, b) = (0, 0)
	i = 0
	j = n - 1
	moves = 0
	prevofalice = 0
	prevofbob = 0
	flag = 'a'
	while True:
		if flag == 'a':
			while i <= j and prevofalice <= prevofbob:
				prevofalice += lis[i]
				i += 1
			moves += 1
			a += prevofalice
			flag = 'b'
			prevofbob = 0
		elif flag == 'b':
			while j >= i and prevofbob <= prevofalice:
				prevofbob += lis[j]
				j -= 1
			moves += 1
			b += prevofbob
			flag = 'a'
			prevofalice = 0
		if i > j:
			break
	print(moves, a, b)


from sys import stdin
input = stdin.readline
for ti in range(int(input().strip())):
	n = int(input().strip())
	a = [int(x) for x in input().strip().split()]
	(i, j) = (0, len(a) - 1)
	c = 0
	(al, b) = (0, 0)
	(la, lb) = (0, 0)
	while i <= j:
		(ac, bc) = (1, 1)
		la = 0
		while la <= lb and i <= j:
			c += ac
			ac = 0
			al += a[i]
			la += a[i]
			i += 1
		lb = 0
		while la >= lb and i <= j:
			c += bc
			bc = 0
			b += a[j]
			lb += a[j]
			j -= 1
	print(c, al, b)


t = int(input())
l = []
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	l.append(s)
for j in l:
	a = 1
	c = 1
	b = len(j) - 1
	sa = j[0]
	sb = 0
	sa1 = j[0]
	sb1 = 0
	turn = -1
	while b >= a:
		if b == a:
			if turn == -1:
				sb1 += j[b]
			else:
				sa1 += j[b]
			c += 1
			break
		elif turn == -1:
			sb = 0
			for p in range(b, a - 1, -1):
				sb += j[p]
				sb1 += j[p]
				if sb > sa or p == a:
					b = p - 1
					turn = 1
					c += 1
					break
		else:
			sa = 0
			for q in range(a, b + 1):
				sa += j[q]
				sa1 += j[q]
				if sa > sb or q == b:
					a = q + 1
					turn = -1
					c += 1
					break
	print(c, sa1, sb1)


for _ in range(int(input())):
	_ = input()
	l = list(map(int, input().split()))
	round = 0
	prev = 0
	dir = 0
	res = [0, 0]
	while len(l) != 0:
		current = 0
		while len(l) != 0 and current <= prev:
			current += l[dir]
			del l[dir]
		res[round % 2] += current
		prev = current
		round += 1
		if dir == 0:
			dir = -1
		else:
			dir = 0
	print('{} {} {}'.format(round, res[0], res[1]))


from math import *
from bisect import bisect_left, bisect_right
from queue import Queue
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
fast_print = stdout.write
t = int(input())
for _ in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	a = [[ls[0]], []]
	i = [1, n - 1]
	flag = 1
	while i[0] <= i[1]:
		cur = 0
		while i[0] <= i[1] and cur <= a[1 - flag][-1]:
			cur += ls[i[flag]]
			i[flag] += (-1) ** flag
		a[flag].append(cur)
		flag = 1 - flag
	fast_print(str(len(a[0]) + len(a[1])) + ' ' + str(sum(a[0])) + ' ' + str(sum(a[1])) + '\n')


t = int(input())
import queue
for i in range(0, t):
	n = int(input())
	candy = input().split()
	alice = queue.Queue()
	bob = queue.LifoQueue()
	total_candy_size = 0
	for j in range(0, n):
		g = int(candy[j])
		alice.put(g)
		bob.put(g)
		total_candy_size += g
	move = 1
	candy_num = n
	last_turn = 0
	alice_size = 0
	bob_size = 0
	game_end = False
	while game_end == False:
		if move % 2 != 0:
			a = 0
			num_a = 0
			this_turn = 0
			while this_turn <= last_turn:
				this_turn += alice.get()
				num_a += 1
			if candy_num - num_a >= 0:
				alice_size += this_turn
				candy_num -= num_a
				last_turn = this_turn
			else:
				extra = total_candy_size - (alice_size + bob_size)
				alice_size += extra
				candy_num = 0
				game_end = True
		else:
			b = 0
			num_b = 0
			this_turn = 0
			while this_turn <= last_turn:
				this_turn += bob.get()
				num_b += 1
			if candy_num - num_b >= 0:
				bob_size += this_turn
				candy_num -= num_b
				last_turn = this_turn
			else:
				extra = total_candy_size - (alice_size + bob_size)
				bob_size += extra
				candy_num = 0
				game_end = True
		if candy_num == 0:
			game_end = True
		if game_end != True:
			move += 1
	print(move, alice_size, bob_size)


from sys import stdin, exit
from collections import deque
input = stdin.readline

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	n = ii()
	A = deque(liis())
	(a, b) = (0, 0)
	moves = 1
	(ap, bp) = (0, n - 2)
	is_alice = False
	quantity = 0
	a += A.popleft()
	last_move = a
	while len(A):
		if is_alice:
			conta = 0
			doces = 0
			for i in range(len(A)):
				conta += A.popleft()
				doces += 1
				if conta > last_move:
					break
			a += conta
		else:
			conta = 0
			doces = 0
			for i in range(bp, -1, -1):
				conta += A.pop()
				doces += 1
				if conta > last_move:
					break
			b += conta
		moves += 1
		last_move = conta
		bp -= doces
		is_alice = not is_alice
	print(moves, a, b)


from collections import Counter, defaultdict, deque
from operator import itemgetter
import math
import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	arr = deque((int(x) for x in input().split()))
	a = 0
	b = 0
	r = 0
	cur = 0
	par = 1
	while True:
		s = 0
		while s <= cur and len(arr):
			if par:
				c = arr.popleft()
			else:
				c = arr.pop()
			s += c
		if par:
			a += s
		else:
			b += s
		r += 1
		cur = s
		if len(arr) == 0:
			break
		par ^= 1
	print(r, a, b)
tt = int(input())
for test in range(tt):
	solve()


def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = list(map(int, input().split()))
		move = 1
		aliceCandies = A[0]
		bobCandies = 0
		del A[0]
		prevAlice = aliceCandies
		prevBob = 0
		while A != []:
			if move % 2 != 0:
				prevBob = 0
				for i in range(len(A)):
					if prevBob > prevAlice or len(A) == 0:
						break
					prevBob += A[-1]
					del A[-1]
				bobCandies += prevBob
			else:
				prevAlice = 0
				for i in range(len(A)):
					if prevAlice > prevBob or len(A) == 0:
						break
					prevAlice += A[0]
					del A[0]
				aliceCandies += prevAlice
			move += 1
		print(move, aliceCandies, bobCandies)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	move = 0
	alice = 0
	bob = 0
	sum1 = 0
	prev = 0
	while True:
		if len(c) == 0:
			break
		while sum1 <= prev:
			sum1 += c[0]
			alice += c[0]
			del c[0]
			if len(c) == 0:
				move += 1
				break
			if sum1 > prev:
				prev = sum1
				move += 1
				sum = 0
				break
		if len(c) == 0:
			break
		while sum <= prev:
			bob += c[-1]
			sum += c[-1]
			del c[-1]
			if len(c) == 0:
				move += 1
				break
			if sum > prev:
				prev = sum
				sum1 = 0
				move += 1
				break
	print(move, alice, bob)


for ix in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	a = 0
	b = 0
	y = 0
	nm = 0
	m = 0
	while True:
		x = 0
		while x <= y:
			x += c.pop(0)
			if c == []:
				nm = 1
				break
		a += x
		m += 1
		if nm:
			break
		y = 0
		while y <= x:
			y += c.pop(-1)
			if c == []:
				nm = 1
				break
		b += y
		m += 1
		if nm:
			break
	print(m, a, b)


n = int(input())
for j in range(n):
	x = input()
	L = list(map(int, input().split()))
	eat_a = L[0]
	t_eat_a = eat_a
	t_eat_b = 0
	i = 1
	L.pop(0)
	while L:
		eat_b = 0
		while eat_a >= 0 and L:
			eat_b = eat_b + L[-1]
			eat_a = eat_a - L[-1]
			L.pop(-1)
		i += 1
		eat_a = 0
		t_eat_b += eat_b
		if not L:
			break
		while eat_b >= 0 and L:
			eat_a = eat_a + L[0]
			eat_b = eat_b - L[0]
			L.pop(0)
		i += 1
		t_eat_a += eat_a
	if i == 0:
		i += 1
	print('{} {} {}'.format(i, t_eat_a, t_eat_b))


I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	l = I()
	(a, b, ans, temp, tem) = (0, 0, 0, 0, 0)
	i = 0
	j = n - 1
	while i <= j:
		ans == 1
		aa = bb = 0
		ans += 1
		while i <= j and aa <= tem:
			aa += l[i]
			i += 1
		if i <= j:
			ans += 1
		while i <= j and bb <= aa:
			bb += l[j]
			j -= 1
		a += aa
		b += bb
		(temp, tem) = (aa, bb)
	print(ans, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	alice = 0
	bob = 0
	ai = 0
	bi = n - 1
	alicepre = 0
	bobpre = 0
	count = 0
	while ai <= bi:
		aliceeaten = 'no'
		bobeaten = 'no'
		if alicepre <= bobpre:
			for i in range(ai, bi + 1):
				if aliceeaten == 'no':
					count += 1
					aliceeaten = 'yes'
				alicepre += a[i]
				alice += a[i]
				ai = i + 1
				if alicepre > bobpre:
					bobpre = 0
					break
		if bobpre <= alicepre:
			for i in range(bi, ai - 1, -1):
				if bobeaten == 'no':
					count += 1
					bobeaten = 'yes'
				bobpre += a[i]
				bob += a[i]
				bi = i - 1
				if bobpre > alicepre:
					alicepre = 0
					break
	print(count, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	l = 1
	r = n - 1
	m = 1
	preva = arr[0]
	prevb = 0
	suma = arr[0]
	sumb = 0
	while l <= r:
		m += 1
		if m % 2 == 0:
			nsum = 0
			while l <= r and nsum <= preva:
				nsum += arr[r]
				r -= 1
			sumb += nsum
			prevb = nsum
		else:
			nsum = 0
			while l <= r and nsum <= prevb:
				nsum += arr[l]
				l += 1
			suma += nsum
			preva = nsum
	print(m, end=' ')
	print(suma, end=' ')
	print(sumb)


t = int(input())
for _ in range(t):
	n = int(input())
	candies = [int(x) for x in input().split()]
	(nAlice, nBob) = (0, 0)
	l = 0
	r = len(candies)
	steps = 0
	cur = 0
	while True:
		last = cur
		cur = 0
		while cur <= last and l < r:
			cur += candies[l]
			l += 1
		nAlice += cur
		steps += 1
		if l == r:
			break
		last = cur
		cur = 0
		while cur <= last and l < r:
			cur += candies[r - 1]
			r -= 1
		nBob += cur
		steps += 1
		if l == r:
			break
	print(steps, nAlice, nBob)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(n,) = I()
	l = I()
	t = a = b = pa = pb = 0
	i = 0
	j = n - 1
	while i <= j:
		ca = 0
		while ca <= pb and i <= j:
			ca += l[i]
			i += 1
		t += 1
		a += ca
		pa = ca
		if i > j:
			break
		cb = 0
		while cb <= pa and i <= j:
			cb += l[j]
			j -= 1
		t += 1
		b += cb
		pb = cb
		if i > j:
			break
	print(t, a, b)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = deque()
	for i in input().split():
		a.append(int(i))
	turn = True
	alice = 0
	bob = 0
	palice = 0
	pbob = 0
	moves = 0
	while a:
		eat = 0
		if turn:
			while a and eat <= pbob:
				eat += a.popleft()
			alice += eat
			palice = eat
		else:
			while a and eat <= palice:
				eat += a.pop()
			bob += eat
			pbob = eat
		turn = not turn
		moves += 1
	print(moves, alice, bob)


from collections import deque
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	d = deque([int(x) for x in input().split()])
	a = d[0]
	b = 0
	f = True
	bj = d[0]
	sl = 1
	d.popleft()
	while d:
		tmp = 0
		if f:
			while tmp <= bj and d:
				b += d[-1]
				tmp += d[-1]
				d.pop()
		else:
			while tmp <= bj and d:
				a += d[0]
				tmp += d[0]
				d.popleft()
		sl += 1
		bj = tmp
		f = not f
	print(sl, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	moves = 0
	ab = [0, 0]
	i = 0
	j = n - 1
	target = 0
	turn = 0
	while n:
		temp = 0
		while temp <= target and n:
			temp += a[(i, j)[turn]]
			if turn:
				j -= 1
			else:
				i += 1
			n -= 1
		ab[turn] += temp
		target = temp
		turn ^= 1
		moves += 1
	print(moves, *ab)


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s1 = a[0]
	s2 = 0
	i1 = 0
	i2 = n
	prev_p = 1
	prev_s = s1
	moves = 1
	while i1 < i2 - 1:
		if prev_p == 1:
			temp_s = 0
			while temp_s <= prev_s and i1 < i2 - 1:
				i2 -= 1
				temp_s += a[i2]
			s2 += temp_s
			prev_s = temp_s
			prev_p = 2
			moves += 1
		else:
			temp_s = 0
			while temp_s <= prev_s and i1 < i2 - 1:
				i1 += 1
				temp_s += a[i1]
			s1 += temp_s
			prev_s = temp_s
			prev_p = 1
			moves += 1
	print(moves, s1, s2)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = deque(map(int, input().split()))
	o = [0, 0]
	t = 0
	l = 0
	tu = 0
	while len(a) > 0:
		c = 0
		while c <= l and len(a) > 0:
			if t == 0:
				c += a.popleft()
			else:
				c += a.pop()
		l = c
		o[t] += c
		t = (t + 1) % 2
		tu += 1
	print(tu, o[0], o[1])


T = int(input())
for _ in range(T):
	n = int(input())
	sizes = list(map(int, input().split()))
	alice_total = sizes[0]
	bob_total = 0
	alice = sizes[0]
	bob = 0
	alice_check = False
	right = n
	left = 0
	remaining = n - 1
	moves = 0
	while remaining > 0:
		moves += 1
		if alice_check:
			temp = 0
			for i in range(left + 1, right, 1):
				temp += sizes[i]
				if temp > bob:
					break
			alice = temp
			alice_total += temp
			alice_check = False
			left = i
			remaining = right - i - 1
		else:
			temp = 0
			for j in range(right - 1, left, -1):
				temp += sizes[j]
				if temp > alice:
					break
			bob = temp
			bob_total += temp
			alice_check = True
			right = j
			remaining = j - left - 1
	print(moves + 1, alice_total, bob_total)


T = int(input())
for i in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	fi = 0
	fc = 0
	bi = n - 1
	bc = 0
	c = 0
	(a, b) = (0, 0)
	ps = 0
	while c <= n - 1:
		s = 0
		while c <= n - 1 and s <= ps:
			s = s + l[fi]
			fi = fi + 1
			c = c + 1
		fc = fc + 1
		ps = s
		a = a + s
		s = 0
		if c <= n - 1:
			bc = bc + 1
		while c <= n - 1 and s <= ps:
			s = s + l[bi]
			bi = bi - 1
			c = c + 1
		ps = s
		b = b + s
	print(fc + bc, a, b)


def solve(n, arr):
	prev = 0
	steps = 0
	a = b = 0
	(l, r) = (0, n - 1)
	while l <= r:
		curr = 0
		while l <= r and curr <= prev:
			curr += arr[l]
			l += 1
		a += curr
		prev = curr
		steps += 1
		if l <= r:
			curr = 0
			while l <= r and curr <= prev:
				curr += arr[r]
				r -= 1
			b += curr
			prev = curr
			steps += 1
	return (steps, a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	(m, a, b) = solve(n, arr)
	print(m, a, b)


for _ in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	i = 0
	j = N - 1
	A = 0
	B = 0
	count = 0
	FLAG = 0
	prevA = 0
	prevB = 0
	if N == 1:
		print(1, L[0], 0)
		continue
	while i <= j:
		if FLAG == 0:
			count += 1
			x = 0
			FLAG = 1
			while i <= j and x <= prevB:
				x += L[i]
				i += 1
			A += x
			prevA = x
		else:
			count += 1
			x = 0
			FLAG = 0
			while i <= j and x <= prevA:
				x += L[j]
				j -= 1
			B += x
			prevB = x
	print(count, A, B)


a = int(input())
for i in range(a):
	n = int(input())
	z = list(map(int, input().split()))
	l = 1
	r = len(z) - 1
	x = z[0]
	y = 0
	num = 1
	choc = z[0]
	while l <= r:
		temp = 0
		if num % 2 == 1:
			while temp <= choc and l <= r:
				temp += z[r]
				y += z[r]
				r = r - 1
			if temp > choc:
				num += 1
				choc = temp
			else:
				num += 1
				break
		else:
			while temp <= choc and l <= r:
				temp += z[l]
				x += z[l]
				l += 1
			if temp > choc:
				num += 1
				choc = temp
			else:
				num += 1
				break
	print(num, x, y)


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	n = input()
	n = int(n)
	a = list(map(int, input().split()))
	i = 0
	j = n
	temp = a[0]
	flag = 0
	count = 1
	y = a[0]
	b = 0
	p = 0
	if n == 1:
		count = 1
		y = a[0]
		b = 0
	else:
		while j > i:
			if flag == 0:
				j -= 1
				p = a[j]
				if j > i:
					b += p
				x2 = b
				while p <= temp and j > i:
					j -= 1
					if j > i:
						p += a[j]
						b += a[j]
				if abs(j - i) == 1 and p > temp:
					count += 1
					break
				flag = 1
				temp = p
			else:
				i += 1
				p = a[i]
				if j > i:
					y += p
				x1 = y
				while p <= temp and j > i:
					i += 1
					if j > i:
						p += a[i]
						y += a[i]
				if abs(j - i) == 1 and p > temp:
					count += 1
					break
				flag = 0
				temp = p
			count += 1
	print(count, y, b)
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


from collections import deque

def calculate_moves(nums):
	(moves, atot, btot) = (0, 0, 0)
	q = deque(nums)
	(aprev, bprev) = (0, 0)
	while q:
		(asum, bsum) = (0, 0)
		(af, bf) = (False, False)
		while q and asum <= bprev:
			asum += q.popleft()
			af = True
		if af:
			atot += asum
			moves += 1
			aprev = asum
		while q and bsum <= aprev:
			bsum += q.pop()
			bf = True
		if bf:
			btot += bsum
			moves += 1
			bprev = bsum
	res = (moves, atot, btot)
	return res
t = int(input())
while t > 0:
	n = input()
	arr = input().split()
	arr = [int(c) for c in arr]
	op = calculate_moves(arr)
	print(*op)
	t -= 1


import sys
cases = int(sys.stdin.readline())
for _ in range(cases):
	length = int(sys.stdin.readline())
	candies = list(map(int, sys.stdin.readline().strip().split()))
	i = 0
	j = length
	a = last = candies[0]
	b = 0
	moves = 1
	a_turn = False
	while True:
		if a_turn:
			count = 0
			while i < j - 1 and count <= last:
				i += 1
				count += candies[i]
			a += count
			last = count
			a_turn = False
		else:
			count = 0
			while j > i + 1 and count <= last:
				j -= 1
				count += candies[j]
			b += count
			last = count
			a_turn = True
		if count != 0:
			moves += 1
		if i >= j - 1:
			break
	print(moves, a, b)


import sys
input = lambda : sys.stdin.readline().rstrip()
inp = sys.stdin.buffer.readline
from math import ceil

def I():
	return list(map(int, inp().split()))
for _ in range(I()[0]):
	(n,) = I()
	a = I()
	f = 0
	e = n - 1
	eaten = 0
	cur = 0
	ch = 0
	ans = [[0], [0]]
	moves = 0
	while f <= e:
		cur = 0
		moves += 1
		eaten = ans[ch ^ 1][-1]
		if ch == 0:
			while cur <= eaten and f <= e:
				cur += a[f]
				f += 1
			ans[ch].append(cur)
		else:
			while cur <= eaten and f <= e:
				cur += a[e]
				e -= 1
			ans[ch].append(cur)
		ch ^= 1
	print(moves, sum(ans[0]), sum(ans[1]))


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	a = 0
	b = 0
	l = 0
	r = n - 1
	cur = 0
	cra = 0
	crb = 0
	pra = 0
	prb = 0
	cnt = 0
	while l <= r:
		cnt += 1
		if cur % 2 == 0:
			while l <= r and prb >= cra:
				if s[l] != -1:
					cra += s[l]
					s[l] = -1
				l += 1
			a += cra
			pra = cra
			crb = 0
		else:
			while l <= r and pra >= crb:
				if s[r] != -1:
					crb += s[r]
					s[r] = -1
				r -= 1
			b += crb
			prb = crb
			cra = 0
		cur += 1
	print(cnt, a, b)


import collections
from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		n = int(input())
		l = [int(i) for i in input().split(' ')]
		d = collections.deque(l)
		a = 0
		b = 0
		preva = 0
		prevb = 0
		count = 0
		while len(d) > 0:
			curra = 0
			flag = False
			while curra <= prevb and len(d) > 0:
				curra += d.popleft()
				flag = True
			if flag:
				count += 1
			a += curra
			preva = curra
			currb = 0
			flag = False
			while currb <= preva and len(d) > 0:
				currb += d.pop()
				flag = True
			if flag:
				count += 1
			b += currb
			prevb = currb
		print(count, a, b)
main()


import math
import atexit
import io
import sys
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def array_to_string(a):
	s = ''
	for i in a:
		s += str(i) + ' '
	return s[0:len(s) - 1]

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	alice = a[0]
	bob = 0
	a.pop(0)
	chance = 1
	lastalice = alice
	lastbob = bob
	sum_till_last_bob = 0
	sum_till_last_alice = alice
	while len(a) > 0:
		chance += 1
		while chance % 2 == 0:
			try:
				bob += a[-1]
			except:
				break
			a.pop()
			if bob - sum_till_last_bob > lastalice:
				lastbob = bob - sum_till_last_bob
				sum_till_last_bob += lastbob
				break
		while chance % 2 != 0:
			try:
				alice += a[0]
			except:
				break
			a.pop(0)
			if alice - sum_till_last_alice > lastbob:
				lastalice = alice - sum_till_last_alice
				sum_till_last_alice += lastalice
				break
	print(chance, alice, bob)


from collections import deque
t = int(input())
for _ in range(t):
	N = int(input())
	A = list(map(int, input().split()))
	q = deque(A)
	cnt = 1
	candy = 0
	prev = 0
	(alice, bob) = (0, 0)
	while q:
		if cnt % 2 == 1:
			candy += q.popleft()
			if candy > prev:
				alice += candy
				cnt += 1
				prev = candy
				candy = 0
		else:
			candy += q.pop()
			if candy > prev:
				bob += candy
				cnt += 1
				prev = candy
				candy = 0
	if candy != 0:
		if cnt % 2 == 1:
			alice += candy
		else:
			bob += candy
	else:
		cnt -= 1
	print(cnt, alice, bob)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	first = 0
	last = n
	alice = a[0]
	bob = 0
	temp = a[0]
	temp2 = 0
	a[0] = 0
	cnt = 1
	while first + 1 < last:
		while temp2 <= temp and first + 1 < last:
			last -= 1
			temp2 += a[last]
			a[last] = 0
		cnt += 1
		bob += temp2
		temp = 0
		if first + 1 >= last:
			break
		while temp <= temp2 and first + 1 < last:
			first += 1
			temp += a[first]
			a[first] = 0
		alice += temp
		temp2 = 0
		cnt += 1
	print(cnt, alice, bob)
t = int(input())
while t:
	main()
	t -= 1


from collections import deque
for t in range(int(input())):
	n = int(input())
	an = list(map(int, input().split()))
	an = deque(an)
	a = b = i = num1 = num2 = turn = 0
	while an:
		if turn == 1:
			num1 = 0
			while an and num1 <= num2:
				num1 += an[-1]
				an.pop()
			b += num1
			num2 = num1
			turn = 0
		else:
			num1 = 0
			while an and num1 <= num2:
				num1 += an[0]
				an.popleft()
			a += num1
			num2 = num1
			turn = 1
		i += 1
	print(i, a, b)


n = int(input())
for i in range(2 * n):
	if i % 2 == 0:
		l = int(input())
	else:
		numbers = input().split()
		numbers = [int(x) for x in numbers]
		c = 1
		d = l - 1
		moves = 1
		counter = d
		alice = numbers[0]
		maks = numbers[0]
		bob = 0
		while counter > 0:
			if moves % 2 == 1:
				temp = 0
				for ind in range(d, 0, -1):
					counter -= 1
					temp += numbers[ind]
					if temp > maks or counter == 0:
						maks = temp
						d = ind - 1
						bob += temp
						moves += 1
						break
			if counter == 0:
				break
			if moves % 2 == 0:
				temp = 0
				for ind in range(c, l):
					counter -= 1
					temp += numbers[ind]
					if temp > maks or counter == 0:
						maks = temp
						c = ind + 1
						alice += temp
						moves += 1
						break
		print(moves, alice, bob)


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	l = 1
	r = n - 1
	(a, b) = (arr[0], 0)
	(na, nb) = (1, 0)
	move = 1
	pa = arr[0]
	while na + nb < n:
		if move % 2 == 1:
			cb = 0
			while cb <= pa:
				b += arr[r]
				cb += arr[r]
				r -= 1
				nb += 1
				if r < l:
					break
			move += 1
			pb = cb
		else:
			ca = 0
			while ca <= pb:
				a += arr[l]
				ca += arr[l]
				l += 1
				na += 1
				if l > r:
					break
			move += 1
			pa = ca
	print(move, a, b)


from collections import defaultdict as dc
from collections import Counter
from heapq import *
import math
from bisect import bisect_left, bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 9 + 7

def sinp():
	p = str(input())
	return p

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def check(p, i, j):
	z = i + (j - i) // 2
	if p[z] - p[i] == p[j] - p[z]:
		return j - i
	return 0

def solve(a, n):
	a = dq(a)
	c = 0
	p = 0
	q = 0
	p_a = 0
	q_b = 0
	turn = -1
	while len(a) > 0:
		if turn == -1:
			p_a = a.popleft()
			while a and p_a <= q_b:
				p_a += a.popleft()
			p = p + p_a
			turn = turn * -1
			c += 1
		else:
			q_b = a.pop()
			while a and q_b <= p_a:
				q_b += a.pop()
			q = q + q_b
			turn = turn * -1
			c += 1
	return (c, p, q)
for test in range(inp()):
	n = inp()
	a = line()
	l = solve(a, n)
	print(*l)


from collections import deque
t = int(input())
for case in range(t):
	n = int(input())
	a = deque([int(x) for x in input().split()])
	w = a.popleft()
	a_val = w
	b_val = 0
	a_move = False
	num_moves = 1
	while a:
		score = 0
		num_moves += 1
		if a_move:
			while a and score <= w:
				score += a.popleft()
			a_val += score
			w = score
		else:
			while a and score <= w:
				score += a.pop()
			b_val += score
			w = score
		a_move = not a_move
	print(num_moves, a_val, b_val)


for _ in range(int(input())):
	(turn, current) = (0, 0)
	(a, b) = (0, 0)
	n = int(input())
	arr = list(map(int, input().split()))
	for _ in range(n):
		turn += 1
		(total, p) = (0, 0)
		while total <= current and p < len(arr):
			total += arr[p]
			p += 1
		arr = arr[p:]
		current = total
		if turn % 2 == 1:
			a += total
		else:
			b += total
		arr = list(reversed(arr))
		if arr == []:
			break
	print(turn, a, b)


T = int(input())
while T > 0:
	N = int(input())
	d = [int(x) for x in input().split()]
	(l, r) = (1, N - 1)
	(a, b) = (d[0], 0)
	c = d[0] + 1
	t = 1
	while l <= r:
		if l <= r:
			s = 0
			while l <= r and s < c:
				s += d[r]
				b += d[r]
				r -= 1
			t += 1
			c = s + 1
		if l <= r:
			s = 0
			while l <= r and s < c:
				s += d[l]
				a += d[l]
				l += 1
			t += 1
			c = s + 1
	print(t, a, b)
	T -= 1


import sys, bisect, string, math, time, functools, random
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby

def Golf():
	(*a,) = map(int, open(0))

def I():
	return int(input())

def S_():
	return input()

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

def LS():
	return [i for i in input().split()]

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in range(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def bit_combination(k, n=2):
	rt = []
	for tb in range(n ** k):
		s = [tb // n ** bt % n for bt in range(k)]
		rt += [s]
	return rt

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
YN = ['YES', 'NO']
Yn = ['Yes', 'No']
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(1, 0), (-1, 0), (0, 1), (0, -1)]
EightNb = [(1, 0), (-1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('EWNS', FourNb))
l_alp = string.ascii_lowercase
input = lambda : sys.stdin.readline().rstrip()

class Tree:

	def __init__(self, inp_size=None, init=True):
		self.LCA_init_stat = False
		self.ETtable = []
		if init:
			self.stdin(inp_size)
		return

	def stdin(self, inp_size=None, index=1):
		if inp_size == None:
			self.size = int(input())
		else:
			self.size = inp_size
		(self.edges, _) = GI(self.size, self.size - 1, index=index)
		return

	def listin(self, ls, index=0):
		self.size = len(ls) + 1
		(self.edges, _) = GI(self.size, self.size - 1, ls, index=index)
		return

	def __str__(self):
		return str(self.edges)

	def dfs(self, x, func=lambda prv, nx, dist: prv + dist, root_v=0):
		q = deque()
		q.append(x)
		v = [-1] * self.size
		v[x] = root_v
		while q:
			c = q.pop()
			for (nb, d) in self.edges[c]:
				if v[nb] == -1:
					q.append(nb)
					v[nb] = func(v[c], nb, d)
		return v

	def EulerTour(self, x):
		q = deque()
		q.append(x)
		self.depth = [None] * self.size
		self.depth[x] = 0
		self.ETtable = []
		self.ETdepth = []
		self.ETin = [-1] * self.size
		self.ETout = [-1] * self.size
		cnt = 0
		while q:
			c = q.pop()
			if c < 0:
				ce = ~c
			else:
				ce = c
				for (nb, d) in self.edges[ce]:
					if self.depth[nb] == None:
						q.append(~ce)
						q.append(nb)
						self.depth[nb] = self.depth[ce] + 1
			self.ETtable.append(ce)
			self.ETdepth.append(self.depth[ce])
			if self.ETin[ce] == -1:
				self.ETin[ce] = cnt
			else:
				self.ETout[ce] = cnt
			cnt += 1
		return

	def LCA_init(self, root):
		self.EulerTour(root)
		self.st = SparseTable(self.ETdepth, init_func=min, init_idl=inf)
		self.LCA_init_stat = True
		return

	def LCA(self, root, x, y):
		if self.LCA_init_stat == False:
			self.LCA_init(root)
		(xin, xout) = (self.ETin[x], self.ETout[x])
		(yin, yout) = (self.ETin[y], self.ETout[y])
		a = min(xin, yin)
		b = max(xout, yout, xin, yin)
		id_of_min_dep_in_et = self.st.query_id(a, b + 1)
		return self.ETtable[id_of_min_dep_in_et]

class SparseTable:

	def __init__(self, ls, init_func=min, init_idl=float('inf')):
		self.func = init_func
		self.idl = init_idl
		self.size = len(ls)
		self.N0 = self.size.bit_length()
		self.table = [ls[:]]
		self.index = [list(range(self.size))]
		self.lg = [0] * (self.size + 1)
		for i in range(2, self.size + 1):
			self.lg[i] = self.lg[i >> 1] + 1
		for i in range(self.N0):
			tmp = [self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) for j in range(self.size)]
			tmp_id = [self.index[i][j] if self.table[i][j] == self.func(self.table[i][j], self.table[i][min(j + (1 << i), self.size - 1)]) else self.index[i][min(j + (1 << i), self.size - 1)] for j in range(self.size)]
			self.table += [tmp]
			self.index += [tmp_id]

	def query(self, l, r):
		r = min(self.size, r)
		N = self.lg[r - l]
		return self.func(self.table[N][l], self.table[N][r - (1 << N)])

	def query_id(self, l, r):
		N = self.lg[r - l]
		(a, b) = (self.index[N][l], self.index[N][r - (1 << N)])
		if self.table[0][a] == self.func(self.table[N][l], self.table[N][r - (1 << N)]):
			b = a
		return b

	def __str__(self):
		return str(self.table[0])

	def print(self):
		for i in self.table:
			print(*i)
show_flg = False
show_flg = True
ans = 0
T = I()
for _ in range(T):
	n = I()
	a = LI()
	ans = 0
	q = deque(a)
	x = q.popleft()
	ans = x
	t = 0
	c = 1
	while q:
		y = 0
		c += 1
		if t == 0:
			while q:
				y += q.pop()
				if y > x:
					break
		else:
			while q:
				y += q.popleft()
				if y > x:
					break
		ans += y * t
		x = y
		t = 1 - t
	print(c, ans, sum(a) - ans)


t = int(input())
for x in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	(alice, Alice, bob, Bob) = (0, 0, 0, 0)
	(i, j) = (0, n - 1)
	while i <= j:
		(f, f1) = (False, False)
		while i <= j:
			if alice <= bob:
				alice += l[i]
				i += 1
			else:
				break
			f = True
		if f:
			ans += 1
			bob = 0
		Alice += alice
		while i <= j:
			if bob <= alice:
				bob += l[j]
				j -= 1
			else:
				break
			f1 = True
		if f1:
			ans += 1
			alice = 0
		Bob += bob
	print(ans, Alice, Bob)


def driver():
	t = int(input())
	for i in range(t):
		solution()

def solution():
	n = int(input())
	a = [int(x) for x in input().split()]
	(ca, cb, p, c, m) = (0, 0, 0, 0, 0)
	while n != 0:
		m += 1
		c = 0
		flag = 0
		if m % 2 == 1:
			for i in range(n):
				ca += a[i]
				c += a[i]
				if p < c:
					break
			else:
				flag = 1
				a = []
				n = 0
			if flag == 0:
				a = a[i + 1:]
				n = n - i - 1
			p = c
		else:
			for i in range(n - 1, -1, -1):
				cb += a[i]
				c += a[i]
				if p < c:
					break
			else:
				flag = 1
				a = []
				n = 0
			if flag == 0:
				a = a[:i]
				n = i
			p = c
	print(m, ca, cb)
driver()


t = int(input())
x = []
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()]
	tec = 1
	l = len(a) - 1
	alice = a[0]
	bob = 0
	p = a[0]
	del a[0]
	q = 1
	for j in range(1, len(a) + 1):
		if len(a) == 0:
			break
		if tec == 1:
			q += 1
			d = 0
			while d < len(a) and sum(a[len(a) - d - 1:len(a)]) <= p:
				d += 1
			if d >= len(a) and sum(a[len(a) - d - 1:len(a)]) <= p:
				bob = bob + sum(a)
				p = sum(a)
				del a[0:len(a)]
				break
			else:
				bob = bob + sum(a[len(a) - d - 1:len(a)])
				p = sum(a[len(a) - d - 1:len(a)])
				del a[len(a) - d - 1:len(a)]
		if tec == -1:
			q += 1
			d = 0
			while d < len(a) and sum(a[0:d]) <= p:
				d += 1
			if d >= len(a) and sum(a[0:d]) <= p:
				alice = alice + sum(a)
				p = sum(a)
				del a[0:len(a)]
			else:
				alice = alice + sum(a[0:d])
				p = sum(a[0:d])
				del a[0:d]
		tec = tec * -1
	x.append([q, alice, bob])
for i in x:
	print(i[0], i[1], i[2])


from collections import deque
c = int(input())
for _ in range(c):
	n = int(input())
	l = list(map(int, input().split()))
	eat = deque(l)
	sa = sb = 0
	cnt = 0
	a = b = 0
	while len(eat) != 0:
		if cnt % 2 == 0:
			a = 0
			while a <= b:
				if len(eat) != 0:
					a += eat.popleft()
				else:
					break
			cnt += 1
			sa += a
		else:
			b = 0
			while a >= b:
				if len(eat) != 0:
					b += eat.pop()
				else:
					break
			sb += b
			cnt += 1
	print(cnt, sa, sb)


import sys, random
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

def main():
	inf = 10 ** 20
	t = int(input())
	for _ in range(1, t + 1):
		n = int(input())
		a = [int(x) for x in input().split()]
		(l, r) = (0, n - 1)
		(rd, ac, bc) = (0, 0, 0)
		(ab, bb) = (0, 0)
		while l <= r:
			now = 0
			if not rd & 1:
				while now <= bb and l <= r:
					now += a[l]
					l += 1
				ab = now
				ac += now
			else:
				while now <= ab and l <= r:
					now += a[r]
					r -= 1
				bb = now
				bc += now
			rd += 1
		print(rd, ac, bc)
main()


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	(alice, bob) = (0, n - 1)
	(aliceeat, bobeat) = (0, 0)
	(a, b) = (0, 0)
	cnt = 0
	while alice <= bob:
		a = 0
		while a <= b:
			a += arr[alice]
			aliceeat += arr[alice]
			alice += 1
			if alice > bob:
				break
		cnt += 1
		if alice > bob:
			break
		b = 0
		while b <= a:
			b += arr[bob]
			bobeat += arr[bob]
			bob -= 1
			if alice > bob:
				break
		cnt += 1
	print(cnt, aliceeat, bobeat)
t = int(input())
while t > 0:
	t -= 1
	solve()


from sys import stdin
import collections

def solve(tc):
	n = int(stdin.readline().strip())
	candies = list(map(int, stdin.readline().split()))
	(lo, hi) = (0, n - 1)
	moves = 0
	alice = 0
	bob = 0
	prev = 0
	while lo <= hi:
		cur = 0
		if moves % 2:
			while lo <= hi and cur <= prev:
				cur += candies[hi]
				hi -= 1
			bob += cur
		else:
			while lo <= hi and cur <= prev:
				cur += candies[lo]
				lo += 1
			alice += cur
		prev = cur
		moves += 1
	print(moves, alice, bob)
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


testcase = int(input())
while testcase > 0:
	n = int(input())
	a = list(map(int, input().split()))
	steps = 0
	(A, B) = (0, 0)
	(sum1, sum2) = (0, 0)
	(l, r) = (0, n - 1)
	while True:
		if steps % 2 != 0:
			while B <= A:
				if len(a):
					B += a.pop(-1)
				else:
					break
			A = 0
			sum2 += B
		else:
			while A <= B:
				if len(a):
					A += a.pop(0)
				else:
					break
			B = 0
			sum1 += A
		steps += 1
		if not len(a):
			break
	print(steps, sum1, sum2)
	testcase -= 1


for s in [*open(0)][2::2]:
	a = (*map(int, s.split()),)
	b = (a, a[::-1])
	k = c = 0
	i = [0, 0]
	m = [0, 0]
	r = [0, 0]
	while sum(i) < len(a):
		c += m[k] < 1
		m[k] += b[k][i[k]]
		i[k] += 1
		if m[k] > m[k ^ 1]:
			r[k] += m[k]
			k ^= 1
			m[k] = 0
	r[k] += m[k]
	print(c, *r)


t = int(input())
while t > 0:
	n = int(input())
	c = list(map(int, input().split()))
	i = 1
	j = n - 1
	a = c[0]
	b = 0
	ap = c[0]
	bp = 0
	chance = 1
	while i <= j:
		if i <= j:
			bp = 0
			while i <= j and bp <= ap:
				bp += c[j]
				b += c[j]
				j -= 1
			chance += 1
		if i <= j:
			ap = 0
			while i <= j and ap <= bp:
				ap += c[i]
				a += c[i]
				i += 1
			chance += 1
	print(str(chance) + ' ' + str(a) + ' ' + str(b))
	t -= 1


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	n = ni()
	a = nl()
	l = 0
	r = n - 1
	al = bo = 0
	cnt = 0
	ra = rb = 0
	while l <= r:
		cnt += 1
		ra = 0
		while l <= r and ra <= rb:
			al += a[l]
			ra += a[l]
			l += 1
		if l <= r:
			cnt += 1
			rb = 0
			while l <= r and rb <= ra:
				bo += a[r]
				rb += a[r]
				r -= 1
	print(cnt, al, bo)
	return
T = ni()
for _ in range(T):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	first = a[0]
	a = a[1:]
	bob = 0
	alice = first
	c = sum(a)
	d = sum(a)
	dr = 0
	al = 0
	bo = 0
	flag = 1
	mm = 1
	i = 0
	j = n - 2
	prev = first
	while i <= j:
		if flag == 1:
			bo = bo + a[j]
			j -= 1
			al = 0
			if bo > prev:
				mm += 1
				bob += bo
				prev = bo
				bo = 0
			else:
				continue
			flag = 2
		else:
			bo = 0
			al = al + a[i]
			i += 1
			if al > prev:
				mm += 1
				alice += al
				prev = al
				al = 0
			else:
				continue
			flag = 1
	bob = bob + bo
	alice = alice + al
	if bo > 0 or al > 0:
		mm += 1
	print(mm, alice, bob)


t = int(input())
for I in range(t):
	b = int(input())
	arr = [int(i) for i in input().split()]
	mov = 1
	a = 1
	b = len(arr) - 1
	(tot_a, tot_b) = (arr[0], 0)
	(prev_a, prev_b) = (arr[0], 0)
	while a <= b:
		if mov % 2:
			cur_b = 0
			while b >= a and cur_b <= prev_a:
				cur_b += arr[b]
				b -= 1
			tot_b += cur_b
			prev_b = cur_b
		else:
			cur_a = 0
			while a <= b and cur_a <= prev_b:
				cur_a += arr[a]
				a += 1
			tot_a += cur_a
			prev_a = cur_a
		mov += 1
	print(mov, tot_a, tot_b)


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	(ans, x, y) = (0, 0, 0)
	(l, r, f, tmp, num) = (0, n - 1, 0, 1, 0)
	while l <= r:
		if not f:
			if tmp <= a[l]:
				tmp = a[l] + 1
				x += a[l]
				l += 1
			else:
				cur = 0
				while l <= r and tmp > cur:
					cur += a[l]
					x += a[l]
					l += 1
				tmp = cur + 1
			f = 1
		else:
			if tmp <= a[r]:
				tmp = a[r] + 1
				y += a[r]
				r -= 1
			else:
				cur = 0
				while r >= l and tmp > cur:
					cur += a[r]
					y += a[r]
					r -= 1
				tmp = cur + 1
			f = 0
		num += 1
	print(num, x, y)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(c_alice, c_bob) = (0, 0)
	(i, j) = (0, n - 1)
	count = 0
	(alice_1, bob_1) = (0, 0)
	(alice_total, bob_total) = ([], [])
	while i <= j:
		alice_1 = 0
		while alice_1 <= bob_1 and i <= j:
			alice_1 += l[i]
			i += 1
			c_alice += 1
		alice_total.append(alice_1)
		if i <= j:
			count += 1
		bob_1 = 0
		while bob_1 <= alice_1 and j >= i:
			bob_1 += l[j]
			j -= 1
			c_bob += 1
		bob_total.append(bob_1)
		if j >= i:
			count += 1
	print(count + 1, sum(alice_total), sum(bob_total))


n = int(input())
for i in range(n):
	m = int(input())
	s = list(map(int, input().split()))
	(alice, bob) = (0, 0)
	(a, b) = (0, m - 1)
	k = 0
	prev = 0
	step = 1
	while a <= b:
		score = 0
		while score <= prev and a <= b:
			if step > 0:
				score += s[a]
				alice += s[a]
				a += 1
			else:
				score += s[b]
				bob += s[b]
				b -= 1
		step *= -1
		k += 1
		prev = score
	print(k, alice, bob)


t = int(input())
for c in range(t):
	n = int(input())
	candies = list(map(int, input().split()))
	i = -1
	j = n
	a = b = 0
	cura = curb = 0
	count = 0
	while i + 1 < j:
		cura = 0
		cond = False
		while True and i + 1 < j:
			cond = True
			i += 1
			cura += candies[i]
			if cura > curb:
				break
		if cond:
			count += 1
		a += cura
		curb = 0
		cond = False
		while True and i + 1 < j:
			cond = True
			j -= 1
			curb += candies[j]
			if curb > cura:
				break
		if cond:
			count += 1
		b += curb
	print(count, a, b)


t = int(input())
while t:
	n = int(input())
	(a, b, A, B, m) = (0, 0, 0, 0, 1)
	c = list(map(int, input().split()))
	while len(c):
		if m & 1:
			a = 0
			while a <= b and len(c):
				a = a + c[0]
				del c[0]
			A = A + a
		else:
			b = 0
			while b <= a and len(c):
				b = b + c[-1]
				del c[-1]
			B = B + b
		m = m + 1
	print(m - 1, A, B)
	t = t - 1


testy = int(input(''))
wyniki = []

def rozegraj(candies):
	cukierki = candies
	punkty = [0, 0]
	ostatni = 0
	ruch = 0
	wynik = []
	while len(cukierki) > 0:
		aktualny = 0
		while ostatni >= aktualny and len(cukierki) > 0:
			if ruch % 2 == 0:
				aktualny += cukierki.pop(0)
			else:
				aktualny += cukierki.pop(len(cukierki) - 1)
		ostatni = aktualny
		punkty[ruch % 2] += aktualny
		ruch += 1
	wynik.append(ruch)
	wynik.append(punkty[0])
	wynik.append(punkty[1])
	return wynik
for i in range(0, testy):
	trash = input('')
	wejscie = input('')
	candies = wejscie.split()
	candies = list(map(int, candies))
	wyniki.append(rozegraj(candies))
for wynik in wyniki:
	print('{} {} {}'.format(wynik[0], wynik[1], wynik[2]))


from collections import deque
for _ in range(int(input())):
	n = int(input())
	arr = deque(map(int, input().split()))
	(step, suma, sumb, sum1, sum2) = (1, arr[0], 0, arr[0], 0)
	arr.popleft()
	while len(arr) != 0:
		step += 1
		if step % 2 != 0:
			while suma <= sumb and len(arr) != 0:
				suma += arr[0]
				sum1 += arr[0]
				arr.popleft()
			sumb = 0
		else:
			while sumb <= suma and len(arr) != 0:
				sumb += arr[len(arr) - 1]
				sum2 += arr[len(arr) - 1]
				arr.pop()
			suma = 0
	print(step, ' ', sum1, ' ', sum2)


from collections import deque
from typing import Deque, Tuple

def solve(n: int, candy_list: Deque[int]) -> Tuple[int, int, int]:
	a_turn: bool = True
	turns: int = 1
	a_sum: int = candy_list.popleft()
	b_sum: int = 0
	prev_turn: int = a_sum
	while candy_list:
		turns += 1
		a_turn = not a_turn
		this_turn: int = 0
		while candy_list and this_turn <= prev_turn:
			if a_turn:
				this_turn += candy_list.popleft()
			else:
				this_turn += candy_list.pop()
		if a_turn:
			a_sum += this_turn
		else:
			b_sum += this_turn
		prev_turn = this_turn
	return (turns, a_sum, b_sum)
for _ in range(int(input())):
	print(*solve(int(input()), deque(map(int, input().split()))))


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)


def countScores(n, a):
	l = 0
	r = n - 1
	suml = sumr = 0
	cnt = ansl = ansr = 0
	while l <= r:
		if cnt % 2 == 0:
			nsuml = 0
			while l <= r and nsuml <= sumr:
				nsuml += int(a[l])
				l += 1
			ansl += nsuml
			suml = nsuml
		else:
			nsumr = 0
			while l <= r and nsumr <= suml:
				nsumr += int(a[r])
				r -= 1
			ansr += nsumr
			sumr = nsumr
		cnt += 1
	return str(cnt) + ' ' + str(ansl) + ' ' + str(ansr)
n = 0
candies = []
result = []
for _ in range(0, int(input())):
	n = int(input())
	candies = list(input().split())
	result.append(countScores(n, candies))
for r in result:
	print(r)


t = int(input())
for i in range(t):
	n = int(input())
	a1 = list(map(int, input().split()))
	a = 0
	b = 0
	s = 0
	c = 0
	l = 0
	m = n - 1
	f = 0
	while l <= m:
		d = 0
		if f == 0:
			while s >= d:
				d = d + a1[l]
				l = l + 1
				if l > m:
					break
			s = d
			a = a + d
			c = c + 1
			f = 1
		else:
			while s >= d:
				d = d + a1[m]
				m = m - 1
				if l > m:
					break
			s = d
			b = b + d
			c = c + 1
			f = 0
	print('{} {} {}'.format(c, a, b))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	start = 0
	end = len(a) - 1
	move = 0
	al = 0
	b = 0
	cv = 0
	if n == 1:
		print(n, end=' ')
		print(a[0], end=' ')
		print('0')
	else:
		while start <= end:
			if start == 0:
				move += 1
				al += a[start]
				cv = a[start]
				start += 1
			elif move % 2 != 0:
				pt = 0
				while pt <= cv and end >= start:
					pt += a[end]
					b += a[end]
					end -= 1
				move += 1
				cv = pt
			else:
				at = 0
				while at <= cv and end >= start:
					at += a[start]
					al += a[start]
					start += 1
				move += 1
				cv = at
			if end < start:
				break
		print(move, end=' ')
		print(al, end=' ')
		print(b, end=' ')
		print('')


for _ in range(int(input())):
	_ = input()
	(*nums,) = map(int, input().split())
	left_sum = 0
	right_sum = 0
	left = 0
	right = len(nums) - 1
	player = 0
	steps = 0
	left_last = 0
	right_last = 0
	while left <= right:
		if player == 0:
			left_last = 0
			while left <= right and left_last <= right_last:
				left_last += nums[left]
				left += 1
			left_sum += left_last
		else:
			right_last = 0
			while left <= right and right_last <= left_last:
				right_last += nums[right]
				right -= 1
			right_sum += right_last
		steps += 1
		player = 1 - player
	print(steps, left_sum, right_sum)


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		n = int(input())
		a = [int(x) for x in input().split()]
		(l, r) = (0, len(a) - 1)
		(pvr, cur) = (0, 0)
		(b, c, mv) = (0, 0, 0)
		while l <= r:
			if l <= r:
				mv += 1
			while l <= r and cur <= pvr:
				cur += a[l]
				l += 1
			b += cur
			(pvr, cur) = (cur, 0)
			if l <= r:
				mv += 1
			while l <= r and cur <= pvr:
				cur += a[r]
				r -= 1
			c += cur
			(pvr, cur) = (cur, 0)
		print(mv, b, c)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for we in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print('1', str(l[0]), '0')
	else:
		f = 1
		b = n - 1
		fs = l[0]
		tf = l[0]
		tb = 0
		count = 1
		while f <= b:
			temp = 0
			done = 0
			while temp <= fs and f <= b:
				temp += l[b]
				tb += l[b]
				b -= 1
				done = 1
			bs = temp
			if f > b:
				break
			count += 1
			temp = 0
			done = 0
			while temp <= bs and f <= b:
				temp += l[f]
				tf += l[f]
				f += 1
				done = 1
			if f > b:
				break
			count += 1
			fs = temp
		print(count + 1, tf, tb)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(1, l[0], 0)
	else:
		m = 1
		prev = l[0]
		a = l[0]
		l.pop(0)
		b = 0
		prevol = 0
		while len(l) != 0:
			curra = 0
			currb = 0
			while len(l) != 0:
				currb = currb + l[len(l) - 1]
				l.pop(len(l) - 1)
				prevol = prev
				if currb > prev:
					m = m + 1
					b = b + currb
					prev = currb
					break
			if len(l) == 0:
				if currb <= prevol:
					print(m + 1, a, b + currb)
				else:
					print(m, a, b)
				break
			i = 0
			while len(l) != 0:
				curra = curra + l[i]
				l.pop(i)
				prevol = prev
				if curra > prev:
					m = m + 1
					a = a + curra
					prev = curra
					break
			if len(l) == 0:
				if curra <= prevol:
					print(m + 1, a + curra, b)
				else:
					print(m, a, b)
				break


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	y = list(map(int, stdin.readline().split()))
	l = 0
	a = 0
	b = 0
	m = 0
	while len(y) > 0:
		c = 0
		if m % 2 != 0:
			while len(y) > 0:
				c += y[len(y) - 1]
				y.pop(len(y) - 1)
				if c > l or len(y) == 0:
					m += 1
					b += c
					l = c
					c = 0
					break
		else:
			while len(y) > 0:
				c += y[0]
				y.pop(0)
				if c > l or len(y) == 0:
					m += 1
					a += c
					l = c
					c = 0
					break
	print(m, a, b)


inp = input
li = list
iinp = lambda : int(inp())
ent = lambda : map(int, inp().split())
lient = lambda : [int(i) for i in inp().split()]
li0 = lambda x: [0 for i in range(x)]
livalor = lambda valor, x: [valor for i in range(x)]
stent = lambda : [i for i in inp()]
filldp = lambda valor, x, y: [[valor for i in range(y)] for i in range(x)]
t = iinp()
for _ in range(t):
	cantdulces = iinp()
	dulces = lient()
	if cantdulces == 1:
		print('%i %i %i' % (1, dulces[0], 0))
	else:
		alicia = dulces[0]
		bob = 0
		cont = 1
		puntero1 = 1
		puntero2 = cantdulces - 1
		turno = 2
		ultimo = alicia
		tmp = 0
		while puntero2 >= puntero1:
			if turno == 2:
				tmp += dulces[puntero2]
				if tmp >= ultimo + 1:
					turno = 1
					ultimo = tmp
					bob += tmp
					cont += 1
					tmp = 0
				puntero2 -= 1
			else:
				tmp += dulces[puntero1]
				if tmp >= ultimo + 1:
					turno = 2
					ultimo = tmp
					alicia += tmp
					cont += 1
					tmp = 0
				puntero1 += 1
		if tmp != 0:
			if turno == 2:
				bob += tmp
			else:
				alicia += tmp
			cont += 1
		print('%i %i %i' % (cont, alicia, bob))


def solve(n, d):
	alice = 0
	bob = n - 1
	aliceEaten = 0
	bobEaten = 0
	last = d[0] - 1
	moves = 0
	total = None
	while alice <= bob:
		if moves % 2 == 0:
			total = 0
			while total <= last and alice <= bob:
				total += d[alice]
				alice += 1
			aliceEaten += total
		else:
			total = 0
			while total <= last and alice <= bob:
				total += d[bob]
				bob -= 1
			bobEaten += total
		if total:
			last = total
		moves += 1
	print(moves, aliceEaten, bobEaten)

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		d = input()
		d = [int(i) for i in d.split()]
		solve(n, d)
main()


for _ in range(int(input())):
	n = int(input())
	c = [int(i) for i in input().split()]
	a = 0
	b = 0
	h = 1
	prev = 0
	col = 0
	while len(c) > 0:
		cur = 0
		col += 1
		if h == 1:
			while cur <= prev and len(c) > 0:
				cur += c[0]
				a += c[0]
				del c[0]
		else:
			while cur <= prev and len(c) > 0:
				cur += c[-1]
				b += c[-1]
				del c[-1]
		h = (h + 1) % 2
		prev = cur
	print(col, a, b)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	(countAlice, countBob, totalOperation) = (0, 0, 0)
	prev = 0
	while len(a) > 0:
		totalOperation += 1
		if totalOperation % 2 == 0:
			now = a.pop(len(a) - 1)
		else:
			now = a.pop(0)
		while now <= prev:
			if not len(a):
				break
			if totalOperation % 2 == 0:
				now += a.pop(len(a) - 1)
			else:
				now += a.pop(0)
		prev = now
		if totalOperation % 2 == 0:
			countAlice += prev
		else:
			countBob += prev
	print(totalOperation, countBob, countAlice)


for _ in range(int(input())):
	n = int(input())
	g = input()
	a = list(map(int, g.split()))
	hod = 1
	bob = 0
	alice = a.pop(0)
	k = alice
	while a:
		hod += 1
		eat = k
		k = 0
		if hod % 2 == 0:
			while eat >= 0 and a:
				se = a.pop(-1)
				eat -= se
				bob += se
				k += se
		else:
			while eat >= 0 and a:
				se = a.pop(0)
				eat -= se
				alice += se
				k += se
	print(hod, alice, bob)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

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

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	a = lis()
	d = deque([])
	for i in range(n):
		d.append(a[i])
	moves = 0
	asum = 0
	bsum = 0
	prev = 0
	while len(d) != 0:
		if moves % 2 == 0:
			curr = 0
			while curr <= prev and len(d) != 0:
				curr += d[0]
				d.popleft()
			asum += curr
			prev = curr
			moves += 1
		else:
			curr = 0
			while curr <= prev and len(d) != 0:
				curr += d[len(d) - 1]
				d.pop()
			bsum += curr
			prev = curr
			moves += 1
	print(moves, asum, bsum)
testcase(int(inp()))


import sys

def read_int():
	return int(sys.stdin.readline())

def read_ints():
	return list(map(int, sys.stdin.readline().split()))
t = read_int()
for j in range(t):
	n = read_int()
	c = read_ints()
	(a, b) = (0, 0)
	turn = 'a'
	prev_sum = 0
	hodov = 0
	while len(c) > 0:
		hodov += 1
		if sum(c) < prev_sum + 1:
			if turn == 'a':
				a += sum(c)
			else:
				b += sum(c)
			c = []
		else:
			cur_sum = 0
			while cur_sum <= prev_sum:
				cur_sum += c.pop(0)
			if turn == 'a':
				a += cur_sum
				turn = 'b'
			else:
				b += cur_sum
				turn = 'a'
			prev_sum = cur_sum
			c = c[::-1]
	print(hodov, a, b)


import math
import bisect
T = int(input())
for t in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	i = -1
	j = N
	a = 0
	b = 0
	c = 0
	prev = 0
	chance = 0
	while i < j:
		curr = 0
		fl = 1
		mv = 0
		while curr <= prev and i < j:
			if i == j - 1 and mv == 0:
				fl = 0
				i = j + 2
				break
			if chance == 0:
				i += 1
				curr += A[i]
				A[i] = 0
			if chance == 1:
				j -= 1
				curr += A[j]
				A[j] = 0
			mv += 1
		if chance == 0:
			chance = 1
			a += curr
		else:
			chance = 0
			b += curr
		prev = curr
		c += 1 * fl
	print(c, a, b)


n = int(input())
for i in range(n):
	k = int(input())
	a = list(map(int, input().split()))[:k]
	a_sum = 0
	bob_sum = 0
	a_number = -1
	bob_number = k
	a_last = 0
	bob_last = 0
	ans_count = 0
	while bob_number != a_number + 1:
		if ans_count % 2 == 0:
			a_last = 0
			while a_last <= bob_last and bob_number != a_number + 1:
				a_number = a_number + 1
				a_last = a_last + a[a_number]
			ans_count = ans_count + 1
			a_sum = a_sum + a_last
		else:
			bob_last = 0
			while bob_last <= a_last and bob_number != a_number + 1:
				bob_number = bob_number - 1
				bob_last = bob_last + a[bob_number]
			ans_count = ans_count + 1
			bob_sum = bob_sum + bob_last
	print(ans_count, a_sum, bob_sum)


for _ in range(int(input())):
	num = int(input())
	candies = [int(i) for i in input().split()]
	(alice, bob, turn, prev, moves) = (0, 0, 0, 0, 0)
	while candies:
		current_sum = 0
		if not turn:
			while current_sum <= prev:
				if not candies:
					break
				current_sum += candies[0]
				candies = candies[1:]
			prev = current_sum
			alice += prev
			turn = 1
		else:
			while current_sum <= prev:
				if not candies:
					break
				current_sum += candies[len(candies) - 1]
				candies = candies[:len(candies) - 1]
			prev = current_sum
			bob += prev
			turn = 0
		moves += 1
	print(moves, alice, bob)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	left = 0
	right = n - 1
	alice = 0
	bob = 0
	acur = 0
	bcur = a[0] - 1
	turn = 0
	while left <= right:
		if turn % 2 == 0:
			while acur <= bcur:
				acur += a[left]
				alice += a[left]
				left += 1
				if left == right + 1:
					break
			bcur = 0
		else:
			while bcur <= acur:
				bcur += a[right]
				bob += a[right]
				right -= 1
				if left == right + 1:
					break
			acur = 0
		turn += 1
	print(turn, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.append(0)
	left = 0
	right = n - 1
	flag = 'a'
	a = 0
	b = 0
	moves = 0
	while left <= right:
		if flag == 'a':
			flag = 'b'
			tem = 0
			while tem <= arr[right + 1] and left <= right:
				tem += arr[left]
				left += 1
			arr[left - 1] = tem
			a += tem
		else:
			flag = 'a'
			tem = 0
			while tem <= arr[left - 1] and left <= right:
				tem += arr[right]
				right -= 1
			arr[right + 1] = tem
			b += tem
		moves += 1
	print(moves, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	clist = [int(i) for i in input().split()]
	a = 0
	moves = 0
	b = 0
	par = 0
	old = 0
	while len(clist) > 0:
		if par % 2 == 0:
			oper = a
		else:
			oper = b
		cursum = 0
		while cursum <= old and len(clist) > 0:
			if par % 2 == 0:
				cursum += clist[0]
				clist = clist[1:]
			else:
				cursum += clist[-1]
				clist = clist[:-1]
		oper += cursum
		old = cursum
		if par % 2 == 0:
			a = oper
		else:
			b = oper
		moves += 1
		par += 1
	print(moves, a, b)


from collections import deque
t = int(input())

def solve(n, arr):
	q = deque(arr)
	alice = 0
	bob = 0
	now = 0
	prev = 0
	turn_alice = True
	moves = 1
	while q:
		if turn_alice and now <= prev:
			candy = q.popleft()
			alice += candy
			now += candy
		elif not turn_alice and now <= prev:
			candy = q.pop()
			bob += candy
			now += candy
		else:
			turn_alice = not turn_alice
			prev = now
			now = 0
			moves += 1
	print(f'{moves} {alice} {bob}')
while t:
	t -= 1
	n = int(input())
	k = list(map(int, input().split(' ')))
	solve(n, k)


t = int(input())
for _ in range(t):
	n = int(input())
	ai = list(map(int, input().split()))
	a = 0
	b = 0
	c = 0
	atemp = 0
	btemp = 0
	while len(ai) > 0:
		if c % 2 == 0:
			atemp = 0
			while atemp <= btemp:
				atemp = atemp + ai[0]
				ai.pop(0)
				if ai == []:
					break
			a = a + atemp
			c = c + 1
		else:
			btemp = 0
			while btemp <= atemp:
				btemp = btemp + ai[-1]
				ai.pop(-1)
				if ai == []:
					break
			b = b + btemp
			c = c + 1
	print(c, a, b)


t = input()
for i in range(int(t)):
	n = input()
	arr = list(map(int, input().split(' ')))
	cur_b = step = a = b = 0
	while len(arr) > 0:
		cur_a = 0
		if len(arr) > 0:
			while len(arr) > 0 and cur_a <= cur_b:
				cur_a += arr[0]
				del arr[0]
			a += cur_a
			step += 1
		cur_b = 0
		if len(arr) > 0:
			while len(arr) > 0 and cur_b <= cur_a:
				cur_b += arr[-1]
				del arr[-1]
			b += cur_b
			step += 1
	print(step, a, b)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	flag = 0
	alice = 0
	bob = 0
	previous = 0
	while True:
		if l == []:
			break
		if flag == 0:
			t = 0
			while t <= previous:
				j = l.pop(0)
				t += j
				if l == []:
					break
			previous = t
			alice += t
			c += 1
			flag = 1
		else:
			t = 0
			while t <= previous:
				j = l.pop()
				t += j
				if l == []:
					break
			previous = t
			bob += t
			c += 1
			flag = 0
	print(c, alice, bob)


import sys

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
from math import *
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	d = []
	c = 0
	i = 0
	k = n - 1
	j = 0
	f = 0
	ae = be = 0
	while i < n:
		p = 0
		if j % 2 == 0:
			if i == n or a[i] == -1:
				break
			while i < n and p <= c:
				if a[i] == -1:
					f = 1
					break
				p += a[i]
				a[i] = -1
				i += 1
			ae += p
			if i == n or f == 1:
				j += 1
				break
		else:
			if k < 0 or a[k] == -1:
				break
			while k >= 0 and p <= c:
				if a[k] == -1:
					f = 1
					break
				p += a[k]
				a[k] = -1
				k -= 1
			be += p
			if k == -1 or f == 1:
				j += 1
				break
		c = p
		j += 1
	print(j, ae, be)


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	sum1 = 0
	sum2 = 0
	sum1 = sum1 + a[0]
	e = a[0]
	f = 0
	a.pop(0)
	count += 1
	d = 1
	while len(a):
		if d == 1:
			f = 0
			while f <= e and len(a):
				sum2 += a[len(a) - 1]
				f = f + a[len(a) - 1]
				a.pop(len(a) - 1)
				d = 0
			count += 1
		else:
			e = 0
			while e <= f and len(a):
				sum1 += a[0]
				e = e + a[0]
				a.pop(0)
				d = 1
			count += 1
	print(count, sum1, sum2)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	c = [int(i) for i in input().split()]
	s_a = c[0]
	s_b = 0
	l = 1
	r = len(c) - 1
	step = 1
	a = c[0]
	b = 0
	k = 1
	while l <= r:
		if step == 1:
			if b <= a:
				b += c[r]
				r -= 1
			else:
				step = 0
				a = 0
				s_b += b
				k += 1
		elif a <= b:
			a += c[l]
			l += 1
		else:
			step = 1
			b = 0
			s_a += a
			k += 1
	if step == 1:
		s_b += b
		if b != 0:
			k += 1
	else:
		s_a += a
		if a != 0:
			k += 1
	print(k, s_a, s_b)


num_cases = int(input())
for case in range(num_cases):
	num_candies = int(input())
	candies = input().split()
	candies = [int(n) for n in candies]
	alice = candies[0]
	bob = 0
	max = candies[0]
	start = False
	tot = 0
	moves = 1
	eaten = 1
	alice_counter = 1
	bob_counter = 0
	while eaten < num_candies:
		if start:
			curr = candies[alice_counter]
			alice_counter += 1
			alice += curr
		else:
			curr = candies[-bob_counter - 1]
			bob_counter += 1
			bob += curr
		eaten += 1
		tot += curr
		if tot > max:
			start = not start
			max = tot
			tot = 0
			moves += 1
	if tot != 0:
		moves += 1
	print(moves, alice, bob)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(f, s, s1, c) = (0, 0, 0, 0)
	(l1, l2) = (0, 0)
	flag = 0
	while l != []:
		if s <= s1:
			while s <= s1 and l != [] or (s == 0 and l != []):
				x = l.pop(0)
				s = s + x
			if s <= s1:
				l1 = l1 + s
				flag = 1
				c += 1
				break
			l1 = l1 + s
			s1 = 0
			c += 1
		else:
			while s1 <= s and l != [] or (s1 == 0 and l != []):
				x = l.pop()
				s1 = s1 + x
			if s1 <= s:
				l2 = l2 + s1
				flag = 1
				c += 1
				break
			l2 = l2 + s1
			s = 0
			c += 1
		if flag == 1:
			break
	print(c, l1, l2)


def solve(num, candies):
	aliceIndex = -1
	bobIndex = num
	aliceEaten = 0
	bobEaten = 0
	aliceTurn = True
	biggerThanThis = 0
	move = 0
	temp = 0
	while aliceIndex < bobIndex:
		temp = 0
		if bobIndex - aliceIndex == 1:
			break
		if aliceTurn:
			while temp <= biggerThanThis and aliceIndex + 1 < bobIndex:
				aliceIndex += 1
				temp += candies[aliceIndex]
			biggerThanThis = temp
			aliceEaten += temp
			aliceTurn = False
		else:
			while temp <= biggerThanThis and bobIndex - 1 > aliceIndex:
				bobIndex -= 1
				temp += candies[bobIndex]
			biggerThanThis = temp
			bobEaten += temp
			aliceTurn = True
		move += 1
	print(move, aliceEaten, bobEaten)
	return
for x in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	solve(n, c)


def solve():
	n = int(input())
	li = list(map(int, input().split()))
	l = li.copy()
	a = 0
	b = 0
	c = 0
	prev_a = 0
	prev_b = 0
	f = 0
	d = 0
	i = 0
	j = n - 1
	while len(li):
		if f == 0:
			temp = 0
			while len(li) and temp <= prev_b:
				temp += l[i]
				li.pop(0)
				i += 1
			a += temp
			prev_a = temp
			f = 1
			d = 0
		elif d == 0:
			temp = 0
			while len(li) and temp <= prev_a:
				temp += l[j]
				li.pop(-1)
				j -= 1
			b += temp
			prev_b = temp
			f = 0
			d = 1
		c += 1
	print(c, a, b)
t = int(input())
for _ in range(t):
	solve()


T = int(input())
for _ in range(T):
	n = int(input())
	ar = list(map(int, input().split()))
	(a_c, a) = (0, 0)
	(b_c, b) = (0, 0)
	(r, l) = (n - 1, 0)
	(c, k) = (0, 0)
	while r - l >= 0:
		if c < 1:
			while a <= b and r - l >= 0:
				a += ar[l]
				l += 1
			b = 0
			c = 1
			a_c += a
		else:
			while b <= a and r - l >= 0:
				b += ar[r]
				r -= 1
			a = 0
			c = 0
			b_c += b
		k += 1
	print(k, a_c, b_c)


t = int(input())
for _ in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	prev = 0
	a = 0
	b = 0
	moves = 0
	left = 0
	right = n - 1
	while left <= right:
		moves += 1
		if moves % 2 == 1:
			current = 0
			while current <= prev:
				current += array[left]
				left += 1
				if left > right:
					break
			a += current
			prev = current
		else:
			current = 0
			while current <= prev:
				current += array[right]
				right -= 1
				if left > right:
					break
			b += current
			prev = current
	print(moves, a, b)


from typing import List

def aliceBobAndCandies(candies: int, sizes: List[int]) -> None:
	moves = 0
	min = sizes[0]
	aliceTurn = True
	alice_size = 0
	bob_size = 0
	while sum(sizes) > min:
		bite = 0
		i = 0
		if aliceTurn:
			while bite < min:
				bite += sizes[i]
				del sizes[i]
			alice_size += bite
			aliceTurn = False
		else:
			while bite < min:
				bite += sizes[len(sizes) - 1 - i]
				del sizes[len(sizes) - 1 - i]
			bob_size += bite
			aliceTurn = True
		min = bite + 1
		moves += 1
	if len(sizes) != 0:
		moves += 1
		if aliceTurn:
			alice_size += sum(sizes)
		else:
			bob_size += sum(sizes)
	print(moves, end=' ')
	print(alice_size, end=' ')
	print(bob_size, end=' ')
	print()
test_cases = int(input())
for i in range(test_cases):
	candies = int(input())
	sizes = input().split()
	sizes = list(map(int, sizes))
	aliceBobAndCandies(candies, sizes)


TC = int(input())

def eat(who, alice_max, bob_max, l):
	earn = 0
	if who == 0:
		while earn <= bob_max and len(l) > 0:
			earn += l.pop(0)
	else:
		while earn <= alice_max and len(l) > 0:
			earn += l.pop()
	return earn

def solution(l):
	current_max = [0, 0]
	score = [0, 0]
	earn = [0, 0]
	time = 0
	while len(l):
		earn[time % 2] = eat(time % 2, current_max[0], current_max[1], l)
		current_max[time % 2] = earn[time % 2]
		score[time % 2] += earn[time % 2]
		time += 1
	print(time, score[0], score[1])
	return
for _ in range(TC):
	N = int(input())
	l = list(map(int, input().split()))
	solution(l)


import sys
import math as mt

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def printwsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')

def printchk(*args):
	return print(*args, end='tst, ')
MOD = int(1000000000.0 + 7)
BABYMOD = 998244353
for _testcases_ in range(int(input())):
	n = int(input())
	li = get_array()
	moves = 1
	a = li[0]
	b = 0
	i = 1
	j = n - 1
	prev = a
	while True:
		this = 0
		if i > j:
			break
		while this <= prev:
			this += li[j]
			b += li[j]
			j -= 1
			if i > j:
				moves += 1
				break
		if i > j:
			break
		moves += 1
		prev = this
		this = 0
		if i > j:
			break
		while this <= prev:
			this += li[i]
			a += li[i]
			i += 1
			if i > j:
				moves += 1
				break
		if i > j:
			break
		moves += 1
		prev = this
	print(moves, a, b)


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for case in range(itg()):
	n = itg()
	arr = tuple(mpint())
	left = 0
	right = n - 1
	a = b = curr = prev = 0
	t = 1
	next_is_left = True
	while True:
		if next_is_left:
			a += arr[left]
			curr += arr[left]
			left += 1
			if not 0 <= left <= right:
				break
			if curr > prev:
				t += 1
				next_is_left = False
				prev = curr
				curr = 0
		else:
			b += arr[right]
			curr += arr[right]
			right -= 1
			if not 0 <= left <= right:
				break
			if curr > prev:
				t += 1
				next_is_left = True
				prev = curr
				curr = 0
	print(t, a, b)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	if len(ls) == 1:
		sa = ls[0]
		sb = 0
		cnt = 1
	else:
		l = 1
		r = len(ls)
		sa = ls[0]
		sb = 0
		a = ls[0]
		b = 0
		af = 0
		bf = 0
		af2 = 0
		bf2 = 0
		if l == r:
			sa += ls[l]
		cnt = 1
		while l < r:
			while a <= b and r != l:
				af = 1
				a += ls[l]
				sa += ls[l]
				l += 1
				if r == l:
					af2 = 1
					break
			if af == 1:
				af = 0
				cnt += 1
			if af2 == 1:
				break
			b = 0
			while b <= a and r != l:
				bf = 1
				b += ls[r - 1]
				sb += ls[r - 1]
				r -= 1
				if r == l:
					bf2 = 1
					break
			if bf == 1:
				bf = 0
				cnt += 1
			a = 0
			if bf2 == 1:
				break
	ans.append(cnt)
	ans.append(sa)
	ans.append(sb)
k = 0
while k < 3 * t:
	print(ans[k], end=' ')
	print(ans[k + 1], end=' ')
	print(ans[k + 2])
	k += 3


from collections import deque

def tc():
	n = int(input())
	cs = deque(map(int, input().split()))
	(a, b) = (0, 0)
	(pa, pb) = (a, b)
	turn = 1
	moves = 0
	while cs:
		if turn == 1 and pa <= pb:
			x = cs.popleft()
			pa += x
			a += x
			if pa > pb or not cs:
				pb = 0
				moves += 1
				turn *= -1
		elif turn == -1 and pb <= pa:
			x = cs.pop()
			pb += x
			b += x
			if pb > pa or not cs:
				pa = 0
				moves += 1
				turn *= -1
	return (moves, a, b)
t = int(input())
for _ in range(t):
	(moves, a, b) = tc()
	print(moves, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	al = list(map(int, input().split()))
	if n == 1:
		print(1, al[0], 0)
		continue
	nums = 0
	ass = 0
	bss = 0
	ap = 0
	bp = n - 1
	ma = True
	mb = False
	prevb = 0
	preva = 0
	turns = 0
	while ap <= bp:
		if ma == True:
			csa = 0
			while csa <= prevb and ap != bp + 1:
				csa += al[ap]
				ap += 1
			ass += csa
			ma = False
			mb = True
			preva = csa
		else:
			csb = 0
			while csb <= preva and bp != ap - 1:
				csb += al[bp]
				bp -= 1
			bss += csb
			mb = False
			ma = True
			prevb = csb
		turns += 1
	print(turns, ass, bss)


for _ in range(int(input())):
	n = int(input())
	candies = [int(x) for x in input().split()]
	(candya, candyb) = (candies[0], 0)
	move = 1
	(eatb, eata) = (0, candya)
	turn = False
	(i, j) = (1, n - 1)
	while i <= j:
		if turn == False:
			eatb = 0
			while j >= i and eatb <= eata:
				eatb += candies[j]
				j -= 1
			candyb += eatb
		else:
			eata = 0
			while j >= i and eata <= eatb:
				eata += candies[i]
				i += 1
			candya += eata
		move += 1
		turn = not turn
	print(move, candya, candyb)


t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = [int(i) for i in input().strip().split(' ')]
	a = 0
	b = 0
	m = 0
	l = -1
	u = n
	last = 0
	turn = 'l'
	while u - l >= 2:
		now = 0
		while now <= last and turn == 'l' and (u > l + 1):
			l += 1
			now += ar[l]
		if turn == 'l':
			m += 1
			a += now
			last = now
			turn = 'u'
			continue
		while now <= last and turn == 'u' and (u - 1 > l):
			u -= 1
			now += ar[u]
		if turn == 'u':
			m += 1
			b += now
			last = now
			turn = 'l'
	print(m, a, b)


def solve(n, ar):
	a = 0
	b = 0
	a_cnt = 0
	b_cnt = 0
	move = 0
	value = 0
	while len(ar) != 0:
		a = ar[0]
		ar.pop(0)
		move += 1
		while a <= value and len(ar) != 0:
			a += ar[0]
			ar.pop(0)
		value = a
		a_cnt += a
		if len(ar) == 0:
			break
		b = ar[-1]
		ar.pop()
		move += 1
		while b <= value and len(ar) != 0:
			b += ar[-1]
			ar.pop()
		value = b
		b_cnt += b
		if len(ar) == 0:
			break
	print(move, a_cnt, b_cnt)
	return
t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	solve(n, ar)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	f = 0
	val = 0
	moves = 0
	(alice, bob) = (0, 0)
	while True:
		if f == 0:
			cnt = 0
			while arr != []:
				if cnt + arr[0] > val:
					cnt += arr[0]
					arr.pop(0)
					break
				else:
					cnt += arr[0]
					arr.pop(0)
			moves += 1
			alice += cnt
			if cnt <= val or arr == []:
				break
			val = cnt
			f = f ^ 1
		else:
			cnt = 0
			while arr != []:
				if cnt + arr[-1] > val:
					cnt += arr[-1]
					arr.pop()
					break
				else:
					cnt += arr[-1]
					arr.pop()
			moves += 1
			bob += cnt
			if cnt <= val or arr == []:
				break
			val = cnt
			f = f ^ 1
	print(moves, alice, bob)


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	aliceTotal = 0
	bobTotal = 0
	alice = 0
	bob = 0
	toggle = 1
	moves = 0
	while i <= j:
		if toggle == 1:
			moves += 1
			alice = 0
			while alice <= bob and i <= j:
				alice += l[i]
				i += 1
			aliceTotal += alice
			toggle = 0
		elif toggle == 0:
			bob = 0
			moves += 1
			while bob <= alice and i <= j:
				bob += l[j]
				j -= 1
			bobTotal += bob
			toggle = 1
	ans = str(moves) + ' ' + str(aliceTotal) + ' ' + str(bobTotal)
	print(ans)


from math import *
mod = 10 ** 9 + 7

def _in():
	return [int(x) for x in input().split(' ')]

def main():
	n = int(input())
	arr = _in()
	(cnt, a, b, t) = (1, arr[0], 0, 1)
	(preva, prevb) = (arr[0], 0)
	(i, j) = (1, n - 1)
	while i <= j:
		s = 0
		if t == 0:
			while i <= j and prevb >= s:
				s = s + arr[i]
				i = i + 1
			(preva, a) = (s, a + s)
		else:
			while j >= i and preva >= s:
				s = s + arr[j]
				j = j - 1
			(prevb, b) = (s, b + s)
		t = t ^ 1
		cnt = cnt + 1
	print(cnt, a, b)
for _ in range(int(input())):
	main()


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	q = deque(arr[1:])
	(alice, bob) = ([arr[0]], [])
	(alicePrev, bobPrev) = (alice[-1], 0)
	turn = 0
	moves = 1
	while len(q):
		if turn:
			moves += 1
			alicePrev = 0
			turn ^= 1
			while len(q) and alicePrev <= bobPrev:
				alice.append(q.popleft())
				alicePrev += alice[-1]
		else:
			moves += 1
			bobPrev = 0
			turn ^= 1
			while len(q) and bobPrev <= alicePrev:
				bob.append(q.pop())
				bobPrev += bob[-1]
	print(moves, sum(alice), sum(bob))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(l, r) = (0, n - 1)
	(x, y, z) = (0, 0, 0)
	(u, v) = (0, 0)
	d = True
	while l <= r:
		if d:
			u += a[l]
			l += 1
		else:
			u += a[r]
			r -= 1
		if u > v:
			x += 1
			if d:
				y += u
			else:
				z += u
			(u, v) = (0, u)
			d = not d
	if u > 0:
		x += 1
		if d:
			y += u
		else:
			z += u
	print(x, y, z)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	move = 0
	alice = 0
	bob = n - 1
	asum = 0
	bsum = 0
	maxb = 0
	USE = [0] * n
	while alice < n and bob >= 0 and (USE[alice] == 0) or USE[bob] == 0:
		maxn = 0
		if move % 2 == 0:
			while maxn <= maxb and alice < n and (USE[alice] == 0):
				USE[alice] = 1
				asum += A[alice]
				maxn += A[alice]
				alice += 1
		else:
			while maxn <= maxb and bob >= 0 and (USE[bob] == 0):
				USE[bob] = 1
				bsum += A[bob]
				maxn += A[bob]
				bob -= 1
		maxb = maxn
		move += 1
	print(move, asum, bsum)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	left = 0
	right = n - 1
	s_alice = 0
	s_bob = 0
	alice = 0
	bob = 0
	steps = 0
	while left <= right:
		if steps % 2 == 0:
			s_alice = 0
			while s_bob >= s_alice and left <= right:
				s_alice += a[left]
				left += 1
			alice += s_alice
		else:
			s_bob = 0
			while s_alice >= s_bob and left <= right:
				s_bob += a[right]
				right -= 1
			bob += s_bob
		steps += 1
	print(steps, alice, bob)

def main():
	for _ in range(int(input())):
		solve()
main()


def fun(array):
	i = 1
	j = n - 1
	a = array[0]
	b = 0
	s = a
	num = 1
	while i <= j:
		temp = 0
		if temp <= s and j >= i:
			num += 1
		while temp <= s and j >= i:
			temp = temp + array[j]
			j = j - 1
		b = b + temp
		s = temp
		temp = 0
		if temp <= s and i <= j:
			num += 1
		while temp <= s and i <= j:
			temp = temp + array[i]
			i += 1
		a = a + temp
		s = temp
	print(num, a, b)
t = int(input())
while t:
	t = t - 1
	n = int(input())
	array = list(map(int, input().split()))
	fun(array)


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))


import os
import sys
from io import BytesIO, IOBase
from collections import deque

def solution(arr, n):
	arr = deque(arr)
	(alice, bob) = (0, 0)
	(cur_alice, cur_bob) = (0, 0)
	turn = True
	res = 0
	while arr:
		if turn:
			cur_alice = 0
			while arr and cur_alice <= cur_bob:
				this = arr.popleft()
				cur_alice += this
				alice += this
		else:
			cur_bob = 0
			while arr and cur_bob <= cur_alice:
				this = arr.pop()
				cur_bob += this
				bob += this
		turn = not turn
		res += 1
	write(res, alice, bob)

def main():
	for _ in range(r_int()):
		n = r_int()
		arr = r_array()
		solution(arr, n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	i = 0
	j = n - 1
	last = 0
	a = 0
	b = 0
	m = 0
	c = 0
	while i <= j:
		m += 1
		if c % 2 == 0:
			curr = 0
			while curr <= last and i <= j:
				curr += ar[i]
				i += 1
			last = curr
			a += curr
		else:
			curr = 0
			while curr <= last and i <= j:
				curr += ar[j]
				j -= 1
			last = curr
			b += curr
		c += 1
	print(m, a, b)


t = int(input())
for z in range(t):
	n = int(input())
	data = input().split()
	bob = []
	alice = []
	for y in range(n):
		bob.append(int(data[y]))
		alice.append(int(data[y]))
	i = 0
	j = 0
	alice.reverse()
	count = 0
	moves = 0
	stop = 0
	sum_alice = 0
	sum_bob = 0
	while i + j < n and stop == 0:
		a = 0
		while a <= count:
			a += alice.pop(-1)
			i += 1
			if i + j == n:
				stop = 1
				moves += 1
				break
		count = a
		sum_alice += a
		if stop == 1:
			break
		moves += 1
		b = 0
		while b <= count:
			b += bob.pop(-1)
			j += 1
			if i + j == n:
				stop = 1
				moves += 1
				break
		count = b
		sum_bob += b
		if stop == 1:
			break
		moves += 1
	print(moves, sum_alice, sum_bob)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	alice = li[0]
	a = li[0]
	li.pop(0)
	bob = 0
	b = 0
	m = 1
	while len(li) > 0:
		b = 0
		while b <= a and len(li) > 0:
			b += li.pop(-1)
		m = m + 1
		bob += b
		a = 0
		if len(li) > 0:
			m = m + 1
		while a <= b and len(li) > 0:
			a += li.pop(0)
		alice += a
	print(m, alice, bob)


t = int(input())
for kek in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	alice = a[0]
	bob = 0
	step = a[0]
	total_step = 1
	index_alice = 1
	index_bob = n - 1
	while index_alice <= index_bob:
		ommmm = 0
		if total_step % 2 == 1:
			while ommmm <= step and index_alice <= index_bob:
				ommmm += a[index_bob]
				index_bob -= 1
			bob += ommmm
			total_step += 1
			step = ommmm
		else:
			while ommmm <= step and index_alice <= index_bob:
				ommmm += a[index_alice]
				index_alice += 1
			alice += ommmm
			total_step += 1
			step = ommmm
	print(total_step, alice, bob)


for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	alice = 0
	bob = 0
	i = 0
	j = n - 1
	p = 0
	q = 0
	t = 0
	while i <= j:
		if t % 2 == 0:
			p = 0
			while i <= j and p <= q:
				p += A[i]
				i += 1
			alice += p
		else:
			q = 0
			while i <= j and q <= p:
				q += A[j]
				j -= 1
			bob += q
		t += 1
	print(t, alice, bob)


import collections
for _ in range(int(input())):
	a = int(input())
	arr = list(map(int, input().split()))
	de = collections.deque(arr)
	tempalice = de[0]
	tempbob = 0
	alice = de[0]
	bob = 0
	moves = 1
	de.popleft()
	while len(de) != 0:
		moves += 1
		if tempalice > tempbob:
			for i in range(len(de)):
				if tempalice + 1 > tempbob:
					tempbob += de[-1]
					bob += de[-1]
					de.pop()
			tempalice = 0
		else:
			for i in range(len(de)):
				if tempbob + 1 > tempalice:
					tempalice += de[0]
					alice += de[0]
					de.popleft()
			tempbob = 0
	print(moves, alice, bob)


t = int(input())
for i in range(t):
	n = int(input())
	ai = list(map(int, input().split()))
	i = 0
	j = n - 1
	num = 0
	num2 = 0
	num3 = 0
	num4 = 0
	turns = 0
	while i <= j:
		num3 = 0
		while num3 <= num4 and i <= j:
			num3 += ai[i]
			num += ai[i]
			i += 1
		turns += 1
		if i > j:
			break
		num4 = 0
		while num3 >= num4 and i <= j:
			num4 += ai[j]
			num2 += ai[j]
			j -= 1
		turns += 1
	print(turns, num, num2)


t = int(input())
for _ in range(t):
	n = int(input())
	c = [int(x) for x in input().split()]
	a = 0
	b = 0
	tempA = 0
	tempB = 0
	l = -1
	r = len(c) - 1
	moves = 0
	while l != r:
		tempA = 0
		while tempA <= tempB:
			if l == r:
				break
			l += 1
			tempA += c[l]
		moves += 1
		a += tempA
		if l == r:
			break
		tempB = 0
		while tempB <= tempA:
			if l == r:
				break
			tempB += c[r]
			r -= 1
		moves += 1
		b += tempB
	print(moves, a, b)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	totalalice = 0
	totalbob = 0
	currentmax = 0
	numberofmoves = 0
	while a != []:
		if numberofmoves % 2 == 0:
			s = 0
			i = 0
			while i < len(a):
				if s > currentmax:
					currentmax = s
					break
				else:
					s += a[i]
					totalalice += a[i]
					i += 1
			a = a[i:]
		else:
			s = 0
			i = len(a) - 1
			while i >= 0:
				if s > currentmax:
					currentmax = s
					break
				else:
					s += a[i]
					totalbob += a[i]
					i -= 1
			a = a[:i + 1]
		numberofmoves += 1
	print(numberofmoves, totalalice, totalbob)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	alicetot = a[0]
	bobtot = 0
	alicetmp = a[0]
	bobtmp = 0
	moves = 1
	a.remove(a[0])
	while True:
		if len(a) == 0:
			break
		else:
			i = 0
			if moves % 2 != 0:
				a = a[::-1]
				bobtmp = 0
				while alicetmp >= bobtmp:
					if len(a) == 0:
						break
					bobtmp += a[0]
					a.remove(a[0])
				bobtot += bobtmp
			else:
				a = a[::-1]
				alicetmp = 0
				while bobtmp >= alicetmp:
					if len(a) == 0:
						break
					alicetmp += a[0]
					a.remove(a[0])
				alicetot += alicetmp
		moves += 1
	print(moves, alicetot, bobtot)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import deque
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = deque(l)
	a = 0
	b = 0
	last = 0
	t = 0
	moves = 0
	while len(l) > 0:
		cur = 0
		if t % 2 == 0:
			while cur <= last:
				cur += l[0]
				l.popleft()
				if len(l) == 0:
					break
			a += cur
			last = cur
			moves += 1
		else:
			while cur <= last:
				cur += l[-1]
				l.pop()
				if len(l) == 0:
					break
			b += cur
			last = cur
			moves += 1
		t += 1
	print(moves, a, b)


def Hello(l):
	(a, b) = (0, 0)
	c = 0
	(i, j) = (0, len(l) - 1)
	k = 0
	while i <= j:
		p = 0
		if c % 2 != 0:
			while p <= k and i <= j:
				p += l[j]
				b += l[j]
				j -= 1
			k = p
		else:
			while p <= k and i <= j:
				p += l[i]
				a += l[i]
				i += 1
			k = p
		c += 1
	print(c, a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	Hello(list(map(int, input().split())))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ptra = 0
	ptrb = n - 1
	curr = 0
	size = n
	moves = 0
	a_sum = 0
	b_sum = 0
	while size != 0:
		if moves % 2 == 0:
			temp = ptra
			sum1 = 0
			while sum1 <= curr:
				if temp <= ptrb:
					sum1 += arr[temp]
					temp += 1
					size -= 1
				else:
					break
			ptra = temp
			curr = sum1
			a_sum += sum1
		elif moves % 2 == 1:
			temp1 = ptrb
			sum2 = 0
			while sum2 <= curr:
				if temp1 >= ptra:
					sum2 += arr[temp1]
					temp1 -= 1
					size -= 1
				else:
					break
			ptrb = temp1
			curr = sum2
			b_sum += sum2
		moves += 1
	print(moves, a_sum, b_sum)


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))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	moves = 0
	a = 0
	b = 0
	turn = 0
	prev = 0
	while len(l) > 0:
		curr = 0
		if moves % 2 == 0:
			while prev >= curr:
				curr += l.pop(0)
				if len(l) == 0:
					break
			a += curr
			prev = curr
		else:
			while prev >= curr:
				curr += l.pop()
				if len(l) == 0:
					break
			b += curr
			prev = curr
		moves += 1
	print(moves, a, b)


def check(arr):
	alice = 0
	bob = 0
	temp = 0
	i = 0
	while len(arr) != 0:
		if i % 2 != 0:
			var = 0
			for j in reversed(range(len(arr))):
				var += arr[j]
				if var > temp or j == 0:
					arr = arr[:j]
					break
			bob += var
			temp = var
		else:
			var = 0
			for j in range(len(arr)):
				var += arr[j]
				if var > temp or j == len(arr) - 1:
					arr = arr[j + 1:]
					break
			alice += var
			temp = var
		i = i + 1
	print(i, '', alice, '', bob)
t = int(input())
i = 0
while i < t:
	n = int(input())
	arr = list(map(int, input().split()))
	check(arr)
	i += 1


def eat(candies):
	(eaten, n) = ([0, 0], 0)
	(moves, turn) = (0, 0)
	(l, r) = (0, len(candies) - 1)
	while l <= r:
		s = 0
		if turn:
			while s <= n and l <= r:
				s += candies[r]
				r -= 1
		else:
			while s <= n and l <= r:
				s += candies[l]
				l += 1
		eaten[turn] += s
		n = s
		turn ^= 1
		moves += 1
	return (moves, eaten[0], eaten[1])

def solve():
	_ = input()
	candies = list(map(int, input().split()))
	print(*eat(candies))
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	li = [int(i) for i in input().split()]
	aa = []
	moves = 0
	a = li.pop(0)
	b = 0
	bb = []
	if len(li) == 0:
		print(1, a, sum(bb))
	else:
		while len(li) != 0:
			while a <= b and len(li) != 0:
				a = a + li.pop(0)
			moves += 1
			fl = 0
			aa.append(a)
			b = 0
			while b <= a and len(li) != 0:
				b = b + li.pop(-1)
				fl = 1
			a = 0
			bb.append(b)
			if fl == 1:
				moves += 1
		print(moves, sum(aa), sum(bb))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	alice = bob = 0
	turn = cura = curb = 0
	while 1:
		turn += 1
		if turn & 1:
			cura = 0
			while a and cura <= curb:
				cura += a[0]
				a.pop(0)
			if cura <= curb or not a:
				alice += cura
				break
		else:
			curb = 0
			while a and curb <= cura:
				curb += a[-1]
				a.pop()
			if curb <= cura or not a:
				bob += curb
				break
		if turn & 1:
			alice += cura
		else:
			bob += curb
	print(turn, alice, bob)


test_cases = int(input())
for _ in range(test_cases):
	candies_no = int(input())
	candies = list(map(int, input().split()))
	moves_no = 0
	total_a = 0
	total_b = 0
	index_a = 0
	index_b = len(candies) - 1
	current_a = 0
	current_b = 0
	while index_a <= index_b:
		if index_a == 0:
			current_a = candies[0]
			total_a += current_a
			index_a += 1
			moves_no += 1
		else:
			a_makes_move = False
			current_a = 0
			while True:
				if current_a > current_b or index_a > index_b:
					break
				current_a += candies[index_a]
				index_a += 1
				a_makes_move = True
			if a_makes_move:
				total_a += current_a
				moves_no += 1
		b_makes_move = False
		current_b = 0
		while True:
			if current_b > current_a or index_a > index_b:
				break
			current_b += candies[index_b]
			index_b -= 1
			b_makes_move = True
		if b_makes_move:
			total_b += current_b
			moves_no += 1
	print(moves_no, total_a, total_b)


t = int(input())
for i in range(t):
	n = int(input())
	can = [int(i) for i in input().split()]
	count = 0
	prev = 0
	tot = 0
	who = 0
	num = 0
	dum = -1
	countinc = False
	al = []
	bob = []
	for l in range(n):
		if countinc == False:
			count += 1
			countinc = True
		if who == 0:
			tot += can[num]
			al.append(can[num])
			num += 1
		else:
			tot += can[dum]
			bob.append(can[dum])
			dum -= 1
		if tot > prev:
			countinc = False
			prev = tot
			tot = 0
			if who == 0:
				who = 1
			else:
				who = 0
	print(str(count) + ' ' + str(sum(al)) + ' ' + str(sum(bob)))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	sa = sb = a = b = 0
	f = 0
	c = 0
	p1 = 0
	p2 = n - 1
	while True:
		a = 0
		fa = fb = 0
		for i in range(p1, n):
			if l[i] > 0:
				if a > b:
					break
				a += l[i]
				l[i] = -1
				fa = 1
			else:
				f = 1
				break
			p1 += 1
		if fa == 1:
			c += 1
		b = 0
		for j in range(p2, -1, -1):
			if l[j] > 0:
				if b > a:
					break
				b += l[j]
				l[j] = -1
				fb = 1
			else:
				f = 1
				break
			p2 -= 1
		if fb == 1:
			c += 1
		sa += a
		sb += b
		if f == 1:
			break
	print(c, sa, sb)


list_ans = []
for _ in range(int(input())):
	n = int(input())
	(a, b, x) = (0, 0, 0)
	(a1, b1) = (0, 0)
	list1 = list(map(int, input().split()))
	while list1:
		while a <= b and list1:
			a += list1.pop(0)
		else:
			if a > 0:
				x += 1
				a1 += a
				b = 0
		while b <= a and list1:
			b += list1.pop(-1)
		else:
			if b > 0:
				x += 1
				b1 += b
				a = 0
	list_ans.append(str(x) + ' ' + str(a1) + ' ' + str(b1))
for item in list_ans:
	print(item)


num = int(input())
for _ in range(num):
	n = int(input())
	l = [int(i) for i in input().split()]
	sumA = 0
	prevA = 0
	sumB = 0
	prevB = 0
	c = 0
	fA = False
	fB = False
	while l:
		try:
			c += 1
			while prevA <= prevB:
				t = l.pop(0)
				fA = True
				sumA += t
				prevA += t
			prevB = 0
			fA = False
		except IndexError:
			if fA == False:
				c -= 1
			break
		try:
			c += 1
			while prevB <= prevA:
				t = l.pop()
				fB = True
				sumB += t
				prevB += t
			prevA = 0
			fB = False
		except IndexError:
			if fB == False:
				c -= 1
			break
	print(c, sumA, sumB)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	mov = 0
	aans = 0
	bans = 0
	a = 0
	b = 0
	k = 0
	while len(l) != 0:
		i = 0
		j = len(l) - 1
		if k % 2 == 0:
			while a <= b:
				a = a + l[i]
				l.pop(i)
				if len(l) == 0:
					break
			b = 0
		else:
			while b <= a:
				b = b + l[j]
				l.pop(j)
				j = len(l) - 1
				if len(l) == 0:
					break
			a = 0
		mov = mov + 1
		k = k + 1
		aans = aans + a
		bans = bans + b
	print(mov, end=' ')
	print(aans, end=' ')
	print(bans)


from math import *

def solver():
	n = int(input())
	a = tuple(map(int, input().split()))
	lhs = 0
	rhs = n - 1
	(left, right) = (0, 0)
	turn = True
	prev = 0
	att = 0
	while lhs != rhs:
		if turn:
			cur = 0
			att += 1
			while cur <= prev:
				if lhs >= rhs:
					left += cur + a[lhs]
					print(att, left, right)
					return
				cur += a[lhs]
				lhs += 1
			left += cur
			prev = cur
		else:
			cur = 0
			att += 1
			while cur <= prev:
				if lhs >= rhs:
					right += cur + a[lhs]
					print(att, left, right)
					return
				cur += a[rhs]
				rhs -= 1
			right += cur
			prev = cur
		turn = not turn
	if turn:
		left += a[lhs]
	else:
		right += a[lhs]
	print(att + 1, left, right)
for _ in range(int(input())):
	solver()


def solve(arr):
	(l_index, r_index) = (0, len(arr))
	(alice, bob, needed) = ([], [], 1)
	while l_index < r_index:
		s = 0
		if len(alice) <= len(bob):
			while s < needed and l_index < r_index:
				s += arr[l_index]
				l_index += 1
			alice.append(s)
		else:
			while s < needed and l_index < r_index:
				r_index -= 1
				s += arr[r_index]
			bob.append(s)
		needed = s + 1
	return (len(alice) + len(bob), sum(alice), sum(bob))
cases = int(input())
for _ in range(cases):
	n = int(input())
	print(*solve(list(map(int, input().split()))))


from math import *
from collections import *
from itertools import *
from bisect import *

def io():
	return map(int, input().split())

def op():
	return list(map(int, input().split()))

def kl(con, x=0):
	if x == 0:
		print('Yes') if con else print('No')
	elif x == 1:
		print('yes') if con else print('no')
	elif x == 2:
		print('YES') if con else print('NO')
MOD = 1000000007
MAX = 2147483647
MIN = -2147483648
p = input
for _ in range(int(p())):
	n = int(p())
	q = op()
	l = deque(q)
	pre = 0
	(l1, l2) = (0, 0)
	x = -1
	fg = 0
	c = 0
	while l != deque([]):
		c += 1
		x = 0
		while x <= pre and l != deque([]):
			if fg == 0:
				x += l.popleft()
			else:
				x += l.pop()
		pre = x
		if fg == 0:
			l1 += x
		else:
			l2 += x
		fg ^= 1
	print(c, l1, l2)


import sys
from collections import defaultdict
import random
import math
t = int(input())
for _ in range(t):
	n = int(input())
	v = list(map(int, input().split()))
	a = 0
	b = 0
	c = 0
	ap = 0
	bp = 0
	i = 0
	j = n - 1
	while len(v):
		ac = 0
		bc = 0
		while ac <= bp and len(v):
			ac += v[0]
			v.remove(v[0])
		a += ac
		ap = ac
		c += 1
		if len(v) == 0:
			break
		while bc <= ap and len(v):
			bc += v[-1]
			v.pop()
		b += bc
		bp = bc
		c += 1
	print(c, a, b)


TC = int(input())
for i in range(TC):
	_ = int(input())
	candies = list(map(int, input().split()))
	move = 1
	a_target = candies.pop(0)
	b_target = 0
	sum_a = a_target
	sum_b = 0
	while candies:
		temp = 0
		if move % 2 == 0:
			while temp <= b_target and len(candies) != 0:
				temp += candies.pop(0)
			sum_a += temp
			a_target = temp
		else:
			while temp <= a_target and len(candies) != 0:
				temp += candies.pop()
			sum_b += temp
			b_target = temp
		move += 1
	print(move, sum_a, sum_b)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(1, a[0], 0)
	else:
		now = 0.4
		steps = 0
		lall = 0
		rall = 0
		l = 0
		r = n - 1
		while r - l >= 0:
			fr = False
			fl = False
			r_eat = 0
			l_eat = 0
			while r - l >= 0 and l_eat <= now:
				l_eat += a[l]
				l += 1
				fl = True
			if fl:
				steps += 1
				now = l_eat
				lall += l_eat
			while r - l >= 0 and r_eat <= now:
				r_eat += a[r]
				r -= 1
				fr = True
			if fr:
				steps += 1
				now = r_eat
				rall += r_eat
		print(steps, lall, rall)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	alice = 0
	bob = 0
	total_step = 0
	cur_a = 0
	cur_b = 0
	i = 1
	j_a = 0
	j_b = n - 1
	while j_a <= j_b:
		if i % 2:
			tot = a[j_a]
			j_a += 1
			while tot <= cur_b and j_a <= j_b:
				tot += a[j_a]
				j_a += 1
			alice += tot
			cur_a = tot
			total_step += 1
		if not i % 2:
			tot = a[j_b]
			j_b -= 1
			while tot <= cur_a and j_b >= j_a:
				tot += a[j_b]
				j_b -= 1
			bob += tot
			cur_b = tot
			total_step += 1
		i += 1
	print(f'{total_step} {alice} {bob}')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	alice = 0
	bob = 0
	counter = 0
	(a, b) = (0, 0)
	while len(arr) > 0:
		if counter % 2 != 0:
			b = 0
			while b <= a:
				try:
					num = arr.pop()
					bob += num
					b += num
				except IndexError:
					break
			counter += 1
		else:
			a = 0
			while a <= b:
				try:
					num = arr.pop(0)
					alice += num
					a += num
				except IndexError:
					break
			counter += 1
	print(counter, alice, bob)


t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	n = int(input())
	mas = [int(i) for i in input().split()]
	(l, r) = (0, n - 1)
	base = 0.5
	cur = 0
	res = 0
	a = 0
	b = 0
	while l <= r:
		while cur <= base:
			cur += mas[l]
			l += 1
			if l > r:
				break
		res += 1
		a += cur
		base = cur
		cur = 0
		if l <= r:
			while cur <= base:
				cur += mas[r]
				r -= 1
				if l > r:
					break
			res += 1
		b += cur
		base = cur
		cur = 0
	print(res, a, b)


import sys
sys.setrecursionlimit(2000)
t = int(input())

def alice(ls, ind, b_prev_eat, count, a_start=0, b_start=0):
	eat = 0
	for i in range(a_start, l):
		eat += ls[i]
		a_start += 1
		ind[i] = 1
		if ind[i + 1] != 0:
			return False
		if eat > b_prev_eat:
			break
	count[0] += 1
	return bob(ls, ind, eat, count, a_start, b_start)

def bob(ls, ind, a_prev_eat, count, a_start=0, b_start=0):
	eat = 0
	for i in range(b_start, l):
		eat += ls[-i - 1]
		ind[-i - 1] = 2
		b_start += 1
		if ind[-i - 2] != 0:
			return False
		if eat > a_prev_eat:
			break
	count[0] += 1
	return alice(ls, ind, eat, count, a_start, b_start)
for q in range(t):
	l = int(input())
	ls = list(map(int, input().split()))
	ind = [0] * l
	cond1 = True
	count = [0]
	while cond1:
		if l == 1:
			ind[0] = 1
			cond1 = False
		else:
			cond1 = alice(ls, ind, 0, count)
	a = 0
	b = 0
	for i in range(len(ind)):
		if ind[i] == 1:
			a += ls[i]
		else:
			b += ls[i]
	print(count[0] + 1, a, b)


n = int(input())
for i in range(n):
	k = int(input())
	candies = [int(x) for x in input().split()]
	moves = 0
	i = 0
	j = len(candies) - 1
	t_sum_i = 0
	t_sum_j = 0
	sum_j = 0
	while i <= j:
		if i <= j:
			moves += 1
			sum_i = 0
			while i <= j and sum_i <= sum_j:
				sum_i += candies[i]
				i += 1
			t_sum_i += sum_i
		if i <= j:
			moves += 1
			sum_j = 0
			while i <= j and sum_j <= sum_i:
				sum_j += candies[j]
				j -= 1
			t_sum_j += sum_j
	print(moves, t_sum_i, t_sum_j)


def solve(n, a):
	idx_alice = 0
	idx_bob = n - 1
	total_alice = 0
	last_alice = 0
	total_bob = 0
	last_bob = 0
	n_moves = 0
	while idx_alice <= idx_bob:
		if idx_alice <= idx_bob:
			n_moves += 1
			last_alice = 0
			while last_alice <= last_bob and idx_alice <= idx_bob:
				val = a[idx_alice]
				last_alice += val
				total_alice += val
				idx_alice += 1
		if idx_alice <= idx_bob:
			n_moves += 1
			last_bob = 0
			while last_bob <= last_alice and idx_alice <= idx_bob:
				val = a[idx_bob]
				last_bob += val
				total_bob += val
				idx_bob -= 1
	return (n_moves, total_alice, total_bob)

def main():
	T = int(input())
	for _ in range(T):
		n = int(input())
		a = list(map(int, input().split()))
		print(' '.join(map(str, solve(n, a))))
main()


def game(person, previous, index):
	eaten = 0
	while eaten <= previous and candies:
		pop = candies.pop(index)
		person += pop
		eaten += pop
	return (person, eaten)
for _ in range(int(input())):
	n = int(input())
	candies = list(map(int, input().split()))
	a = 0
	b = 0
	i = 0
	previous = 0
	while candies:
		i += 1
		if i % 2 != 0:
			(a, previous) = game(a, previous, 0)
		else:
			(b, previous) = game(b, previous, -1)
	print(f'{i} {a} {b}')


for t in range(int(input())):
	n = int(input())
	candies = [int(x) for x in input().split()]
	alice = []
	bob = []
	move = 0
	m = 0
	i = 0
	j = n - 1
	while i <= j:
		if move % 2 == 0:
			a = 0
			while i <= j and a <= m:
				a += candies[i]
				alice.append(candies[i])
				i += 1
			m = a
		else:
			a = 0
			while i <= j and a <= m:
				a += candies[j]
				bob.append(candies[j])
				j -= 1
			m = a
		move += 1
	print(move, sum(alice), sum(bob))


for _ in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	a = 0
	b = 0
	na = 0
	nb = 0
	nd = 0
	while len(lst) > 0:
		sum1 = 0
		if len(lst) != 0:
			nd += 1
		while sum1 <= b:
			try:
				sum1 = sum1 + lst[0]
				lst.remove(lst[0])
			except:
				break
		a = sum1
		sum1 = 0
		lst = lst[::-1]
		if len(lst) != 0:
			nd += 1
		while sum1 <= a:
			try:
				sum1 = sum1 + lst[0]
				lst.remove(lst[0])
			except:
				break
		lst = lst[::-1]
		b = sum1
		na = na + a
		nb = nb + b
	print(nd, na, nb)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(a, b) = (0, 0)
	i = 0
	j = n - 1
	left = 0
	right = 0
	count = 0
	while i <= j:
		if left == 0:
			while left <= right and i <= j:
				left += arr[i]
				i += 1
			a += left
			right = 0
		elif right == 0:
			while right <= left and i <= j:
				right += arr[j]
				j -= 1
			b += right
			left = 0
		count += 1
	print(count, a, b)


import random
import math
LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
yes = lambda : print('Yes')
no = lambda : print('No')
I = lambda : list(input())
J = lambda x: ''.join(x)
II = lambda : int(input())
SI = lambda : input()
t = II()
for q in range(t):
	n = II()
	a = LI()
	l = -1
	r = n
	s1 = 0
	s2 = 0
	count = 0
	temp = 0.1
	while l + 1 != r:
		ct = 0
		while ct <= temp and l + 1 != r:
			l += 1
			ct += a[l]
		s1 += ct
		count += 1
		temp = ct
		ct = 0
		if l + 1 == r:
			print(count, s1, s2)
			break
		while ct <= temp and l + 1 != r:
			r -= 1
			ct += a[r]
		count += 1
		temp = ct
		s2 += ct
		if l + 1 == r:
			print(count, s1, s2)
			break


num_cases = int(input())
for _ in range(num_cases):
	n_candies = int(input())
	candies = [int(x) for x in input().split(' ')]
	moves = 0
	left_size = 0
	right_size = 0
	prev = 0
	side = 0
	while len(candies) > 0:
		curr = 0
		while curr <= prev and len(candies) > 0:
			if side == 0:
				c = candies.pop(0)
				left_size += c
				curr += c
			else:
				c = candies.pop()
				right_size += c
				curr += c
		prev = curr
		side = 1 if side == 0 else 0
		moves += 1
	print('%d %d %d' % (moves, left_size, right_size))


for _ in range(int(input())):
	n = int(input())
	candy = list(map(int, input().split()))
	(stage, alice, bob) = (0, 0, 0)
	former = 0
	isAlice = True
	while len(candy) != 0:
		stage += 1
		if isAlice:
			isAlice = False
			isOver = True
			for i in range(len(candy)):
				mouth = sum(candy[:i + 1])
				if mouth > former:
					alice += mouth
					former = mouth
					candy = candy[i + 1:]
					isOver = False
					break
			if isOver:
				alice += sum(candy)
				break
		else:
			isAlice = True
			isOver = True
			for i in range(len(candy)):
				mouth = sum(candy[-i - 1:])
				if mouth > former:
					bob += mouth
					former = mouth
					candy = candy[:-i - 1]
					isOver = False
					break
			if isOver:
				bob += sum(candy)
				break
	print(stage, alice, bob)


b = int(input())
for _ in range(b):
	a = int(input())
	li = list(map(int, input().split()))
	move = amove = bmove = 0
	req = 0
	a = -1
	while li != []:
		(a, c) = (0, 0)
		while li != [] and a < req + 1:
			a += li.pop(0)
			c = 1
		move += c
		amove += a
		req = a
		(a, c) = (0, 0)
		while li != [] and a < req + 1:
			a += li.pop()
			c = 1
		move += c
		bmove += a
		req = a
	print(move, amove, bmove)


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	moves = last = a = b = 0
	start = 0
	end = N - 1
	aTurn = True
	eaten = 0
	while start <= end:
		if aTurn:
			eaten += A[start]
			a += A[start]
			start += 1
		else:
			eaten += A[end]
			b += A[end]
			end -= 1
		if eaten > last or start > end:
			moves += 1
			last = eaten
			eaten = 0
			aTurn = not aTurn
	print(moves, a, b)


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	count = 0
	sumlice = 0
	sumbob = 0
	anslice = 0
	ansbob = 0
	lft = 0
	rght = n - 1
	while lft <= rght:
		if count % 2 == 0:
			nsumlice = 0
			while lft <= rght and nsumlice <= sumbob:
				nsumlice += arr[lft]
				lft += 1
			anslice += nsumlice
			sumlice = nsumlice
		else:
			nsumbob = 0
			while lft <= rght and nsumbob <= sumlice:
				nsumbob += arr[rght]
				rght -= 1
			ansbob += nsumbob
			sumbob = nsumbob
		count += 1
	print(count, anslice, ansbob)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	d = deque(arr)
	last_sum = 0
	a = 0
	b = 0
	cnt = 0
	while d:
		flag = False
		work = 0
		while work <= last_sum and d:
			work += d.popleft()
			flag = True
		last_sum = work
		a += last_sum
		if flag:
			cnt += 1
		flag = False
		work = 0
		while work <= last_sum and d:
			work += d.pop()
			flag = True
		last_sum = work
		b += last_sum
		if flag:
			cnt += 1
	print(cnt, a, b)


TEST = int(input())
answers = []
for _ in range(TEST):
	num = int(input())
	arr = [int(x) for x in input().split()]
	alice_total = 0
	bob_total = 0
	alice_last = 0
	bob_last = 0
	turns = 0
	mmt = 0
	left = 0
	right = len(arr) - 1
	while left <= right:
		if mmt == 0:
			alice_last = 0
			mmt = 1
			while alice_last <= bob_last:
				alice_last += arr[left]
				left += 1
				if left > right:
					break
			alice_total += alice_last
		else:
			bob_last = 0
			mmt = 0
			while bob_last <= alice_last:
				bob_last += arr[right]
				right -= 1
				if left > right:
					break
			bob_total += bob_last
		turns += 1
	answers.append([turns, alice_total, bob_total])
for ans in answers:
	print(*ans)


t = int(input())
for i in range(t):
	n = int(input())
	lis = list(map(int, input().split()))
	end = False
	moves = 1
	a = lis[0]
	currA = lis[0]
	b = 0
	j = len(lis) - 1
	chance = 'Bob'
	currA = lis[0]
	currB = 0
	mark = 1
	while not end:
		if chance == 'Bob':
			if j < mark:
				break
			while currB <= currA and j >= mark:
				currB += lis[j]
				j -= 1
			(j, mark) = (mark, j)
			moves += 1
			chance = 'Alice'
			b += currB
			currA = 0
		else:
			if j > mark:
				break
			while currA <= currB and j <= mark:
				currA += lis[j]
				j += 1
			(j, mark) = (mark, j)
			a += currA
			moves += 1
			currB = 0
			chance = 'Bob'
	print(str(moves) + ' ' + str(a) + ' ' + str(b))


def s():
	n = int(input())
	candies = [int(x) for x in input().split(' ')]
	a_size = candies[0]
	a_total_size = candies[0]
	b_size = 0
	b_total_size = 0
	turns = 1
	del candies[0]
	while len(candies) > 0:
		b_size = 0
		if len(candies) > 0:
			while b_size <= a_size and len(candies) > 0:
				b_size += candies[-1]
				del candies[-1]
			turns += 1
			b_total_size += b_size
		a_size = 0
		if len(candies) > 0:
			while a_size <= b_size and len(candies) > 0:
				a_size += candies[0]
				del candies[0]
			turns += 1
			a_total_size += a_size
	print(turns, a_total_size, b_total_size)
t = int(input())
for i in range(t):
	s()


n = int(input())
ans = []
for i in range(n):
	l = int(input())
	a = list(map(int, input().split()))
	alice_index = 0
	bob_index = len(a) - 1
	alice_cnt = 0
	bob_cnt = 0
	bob_tmp = 0
	cnt = 0
	if len(a) == 1:
		ans.append([1, a[0], 0])
		continue
	while alice_index <= bob_index:
		alice_tmp = 0
		onceA = 0
		while alice_tmp <= bob_tmp and alice_index <= bob_index:
			if not onceA:
				cnt += 1
				onceA = 1
			alice_cnt += a[alice_index]
			alice_tmp += a[alice_index]
			alice_index += 1
		bob_tmp = 0
		onceB = 0
		while bob_tmp <= alice_tmp and alice_index <= bob_index:
			if not onceB:
				cnt += 1
				onceB = 1
			bob_cnt += a[bob_index]
			bob_tmp += a[bob_index]
			bob_index -= 1
	ans.append([cnt, alice_cnt, bob_cnt])
for i in range(n):
	print(*ans[i])


t = int(input())
for i in range(0, t):
	n = int(input())
	lista = [int(var) for var in input().split()]
	mov = 0
	alice = 0
	bob = 0
	previo = 0
	while len(lista) >= 1:
		mov += 1
		tam = 0
		if mov % 2 != 0:
			for y in range(0, len(lista)):
				tam += int(lista[0])
				lista.pop(0)
				if tam > previo:
					previo = tam
					alice += tam
					break
				if len(lista) == 0:
					alice += tam
					break
		else:
			for y in range(len(lista)):
				tam += int(lista[-1])
				lista.pop(-1)
				if tam > previo:
					previo = tam
					bob += tam
					break
				if len(lista) == 0:
					bob += tam
					break
	print(mov, alice, bob)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	move = maxx = a = b = int(0)
	beg = int(0)
	end = n - 1
	turn = int(0)
	flag = int(1)
	while flag == 1:
		cur = int(0)
		while cur <= maxx:
			if turn == 0:
				if beg >= n:
					flag = 0
					print('fuckkk ', flag, beg)
					break
				if l[beg] == -1:
					flag = 0
					break
				cur += l[beg]
				l[beg] = -1
				beg += 1
			else:
				if end < 0:
					flag = 0
					break
				if l[end] == -1:
					flag = 0
					break
				cur += l[end]
				l[end] = -1
				end -= 1
		if turn == 0:
			a += cur
			if cur > 0:
				move += 1
			maxx = cur
			turn = 1
		elif turn == 1:
			b += cur
			if cur > 0:
				move += 1
			maxx = cur
			turn = 0
	print(move, a, b)


import sys, bisect
from math import gcd
input = sys.stdin.readline

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())
t = inp()
for _ in range(t):
	n = inp()
	nums = inlt()
	move = 0
	a = 0
	b = 0
	left = 0
	right = n - 1
	turn = 1
	(aprev, bprev) = (0, 0)
	while True:
		if turn == 1:
			temp = 0
			for i in range(left, right + 1):
				temp += nums[i]
				if temp > bprev:
					break
			a += temp
			aprev = temp
			left = i + 1
		else:
			temp = 0
			for i in range(right, left - 1, -1):
				temp += nums[i]
				if temp > aprev:
					break
			b += temp
			bprev = temp
			right = i - 1
		move += 1
		turn = 1 if turn == 2 else 2
		if left > right:
			break
	print(move, a, b)


a = int(input())
for x in range(a):
	length = int(input())
	a = [int(x) for x in input().split()]
	moves = 1
	scores = [0, 0]
	value = 0
	current_sum = 0
	high_sum = 0
	while a:
		placeholder = a.pop(value)
		current_sum += placeholder
		scores[value] += placeholder
		if current_sum > high_sum:
			if a:
				moves += 1
			high_sum = current_sum
			current_sum = 0
			value = -value - 1
	print(moves, scores[0], scores[1])


from sys import stdin, stdout
import bisect

def main():
	for _ in range(int(stdin.readline())):
		n = int(input())
		arr = [int(k) for k in input().split()]
		alice = 0
		bob = 0
		alicecounter = 0
		bobcounter = 0
		i = -1
		j = n
		sm = 0
		temp = 0
		sm = 0
		moves = 0
		while 1:
			if i >= j:
				break
			while i < j:
				i += 1
				if i >= j:
					break
				alice += arr[i]
				temp += arr[i]
				if temp > sm:
					moves += 1
					sm = temp
					temp = 0
					break
			while j > i:
				j -= 1
				if j <= i:
					break
				bob += arr[j]
				temp += arr[j]
				if temp > sm:
					moves += 1
					sm = temp
					temp = 0
					break
		if temp > 0:
			moves += 1
		print(moves, alice, bob)
main()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	candies = list(map(int, input().split(' ')))
	p1 = 0
	p2 = n - 1
	flag = 1
	prev = 0
	sum_a = 0
	sum_b = 0
	moves = 0
	while p1 <= p2:
		moves += 1
		if flag == 1:
			temp = 0
			while temp <= prev and p1 <= p2:
				temp += candies[p1]
				p1 += 1
			prev = temp
			sum_a += prev
		else:
			temp = 0
			while temp <= prev and p1 <= p2:
				temp += candies[p2]
				p2 -= 1
			prev = temp
			sum_b += prev
		flag *= -1
	print(moves, sum_a, sum_b)


def solve():
	t = int(input())
	for i in range(t):
		n = int(input())
		m = [int(s) for s in input().split()]
		(a, b) = (m[0], 0)
		p_a = 1
		p_b = n - 1
		last_hod = a
		U = True
		h = 1
		k = 1
		while U:
			temp_hod = 0
			if h == 1:
				while temp_hod <= last_hod:
					if p_b < p_a:
						U = False
						b += temp_hod
						last_hod = temp_hod
						if temp_hod != 0:
							k += 1
						break
					temp_hod += m[p_b]
					p_b -= 1
				else:
					b += temp_hod
					last_hod = temp_hod
					k += 1
			else:
				while temp_hod <= last_hod:
					if p_a > p_b:
						U = False
						a += temp_hod
						last_hod = temp_hod
						if temp_hod != 0:
							k += 1
						break
					temp_hod += m[p_a]
					p_a += 1
				else:
					a += temp_hod
					last_hod = temp_hod
					k += 1
			h = h ^ 1
		print(k, a, b)
solve()


from collections import deque

def solve(a):
	alice = 0
	bob = 0
	bob_curr = 0
	moves = 0
	while len(a) > 0:
		alice_curr = 0
		while alice_curr <= bob_curr and len(a) > 0:
			alice_curr += a.popleft()
		alice += alice_curr
		moves += 1
		if len(a) == 0:
			break
		bob_curr = 0
		while bob_curr <= alice_curr and len(a) > 0:
			bob_curr += a.pop()
		bob += bob_curr
		moves += 1
	return (moves, alice, bob)
for i in range(int(input())):
	n = int(input())
	a = deque([int(x) for x in input().split()])
	print(' '.join(map(str, solve(a))))


def sumbcmgrtr(l, n):
	t = 0
	leng = 0
	for i in l:
		t += i
		leng += 1
		if t > n:
			break
	return (t, leng, l[leng:])
x = int(input())
for i in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	move = 0
	alice = a[0]
	a.pop(0)
	bob = 0
	s = alice
	while len(a) != 0:
		if move % 2 == 0:
			a.reverse()
			(s, leng, a) = sumbcmgrtr(a, s)
			move += 1
			bob += s
			a.reverse()
		else:
			(s, leng, a) = sumbcmgrtr(a, s)
			move += 1
			alice += s
	print(move + 1, alice, bob)


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	move = 2
	li2 = [li[0]]
	li3 = []
	li.pop(0)
	while len(li) > 0:
		(alice, bob) = (0, 0)
		if move % 2:
			while li3[-1] >= alice:
				if len(li) > 0:
					alice += li[0]
					li.pop(0)
				else:
					break
			li2.append(alice)
		else:
			while li2[-1] >= bob:
				if len(li) > 0:
					bob += li[-1]
					li.pop()
				else:
					break
			li3.append(bob)
		move += 1
	print(move - 1, sum(li2), sum(li3))


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	l = 1
	r = n - 1
	m = 1
	a = x[0]
	b = 0
	la = x[0]
	lb = 0
	k = 1
	while l <= r:
		m += 1
		if k:
			while lb <= la:
				if l > r:
					break
				lb += x[r]
				r -= 1
			b += lb
			la = k = 0
		else:
			while la <= lb:
				if l > r:
					break
				la += x[l]
				l += 1
			a += la
			lb = 0
			k = 1
	print(m, a, b)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	at = 0
	bt = 0
	ap = 0
	bp = 0
	ai = 0
	bi = n - 1
	anext = True
	nTurns = 0
	while True:
		nTurns += 1
		turntotal = 0
		if anext:
			while turntotal <= bp and ai <= bi:
				turntotal += a[ai]
				ai += 1
			at += turntotal
			ap = turntotal
		else:
			while turntotal <= ap and ai <= bi:
				turntotal += a[bi]
				bi -= 1
			bt += turntotal
			bp = turntotal
		if ai > bi:
			break
		anext = not anext
	print('{} {} {}'.format(nTurns, at, bt))


t = int(input())
for _ in range(t):
	Alice = []
	Bob = []
	Rounds = 0
	n = int(input())
	a = [int(x) for x in input().split()]
	aptr = 0
	bptr = n - 1
	AliceTurn = True
	while aptr <= bptr:
		if AliceTurn:
			if Rounds == 0:
				Alice.append(a[aptr])
				aptr += 1
				Rounds += 1
				AliceTurn = False
				continue
			curr = 0
			while aptr <= bptr and curr <= Bob[len(Bob) - 1]:
				curr += a[aptr]
				aptr += 1
			Alice.append(curr)
			Rounds += 1
			AliceTurn = False
		else:
			curr = 0
			while bptr >= aptr and curr <= Alice[len(Alice) - 1]:
				curr += a[bptr]
				bptr -= 1
			Bob.append(curr)
			Rounds += 1
			AliceTurn = True
	print(Rounds, sum(Alice), sum(Bob))


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	i = 0
	x = z = 0
	a = b = 0
	while True:
		if i % 2 == 0:
			if l != []:
				y = l.pop(0)
			else:
				break
			while y <= x:
				if l != []:
					y += l.pop(0)
				else:
					break
			x = y
			a += x
		else:
			if l != []:
				y = l.pop()
			else:
				break
			while y <= x:
				if l != []:
					y += l.pop()
				else:
					break
			x = y
			b += x
		i += 1
	print(i, a, b)


def main():
	n = int(input())
	for i in range(n):
		tamano = int(input())
		dulces = list(map(int, input().split()))
		if tamano == 1:
			print('1 ' + str(dulces[0]) + ' 0')
		else:
			A = 1
			B = tamano - 1
			sumaA = dulces[0]
			sumaB = 0
			antA = dulces[0]
			contador = 1
			while A <= B:
				antB = 0
				entro = 0
				while antB <= antA and A <= B:
					sumaB = sumaB + dulces[B]
					antB = antB + dulces[B]
					B -= 1
					entro = 1
				if entro == 1:
					contador += 1
				entro = 0
				antA = 0
				while antA <= antB and A <= B:
					sumaA = sumaA + dulces[A]
					antA = antA + dulces[A]
					A += 1
					entro = 1
				if entro == 1:
					contador += 1
			resultado = []
			resultado.append(contador)
			resultado.append(sumaA)
			resultado.append(sumaB)
			print(*resultado)
main()


from collections import deque
t = int(input())
for i in range(t):
	n = int(input())
	a = map(int, input().split())
	a = deque(a)
	flg = True
	alice = 0
	bob = 0
	ans = 0
	m = 0
	while a:
		tmp = 0
		if flg:
			while a and tmp <= m:
				c = a.popleft()
				tmp += c
				alice += c
		else:
			while a and tmp <= m:
				c = a.pop()
				tmp += c
				bob += c
		m = tmp
		ans += 1
		flg = not flg
	print(ans, alice, bob)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	arr = iia()
	a = b = moves = last = 0
	(p1, p2) = (0, n - 1)
	flip = False
	while p1 <= p2:
		if not flip:
			cur = 0
			while cur <= last:
				cur += arr[p1]
				a += arr[p1]
				p1 += 1
				if p1 > p2:
					break
			last = cur
			flip = True
		else:
			cur = 0
			while cur <= last:
				cur += arr[p2]
				b += arr[p2]
				p2 -= 1
				if p1 > p2:
					break
			last = cur
			flip = False
		moves += 1
	print(moves, a, b)


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	tot = 0
	a = 0
	b = 0
	turn = 0
	lst = 0
	ptr1 = 0
	ptr2 = len(s) - 1
	while ptr1 <= ptr2:
		tot += 1
		if turn == 0:
			curra = 0
			for i in range(ptr1, ptr2 + 1):
				curra += s[i]
				if curra > lst:
					ptr1 = i + 1
					lst = curra
					turn = 1
					break
			a += curra
			if turn == 0:
				ptr1 == ptr2
				break
		else:
			currb = 0
			for i in range(ptr2, ptr1 - 1, -1):
				currb += s[i]
				if currb > lst:
					ptr2 = i - 1
					lst = currb
					turn = 0
					break
			b += currb
			if turn == 1:
				ptr1 == ptr2
				break
	print(tot, a, b)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = sum(l)
	(i, j) = (0, n - 1)
	(s1, s2) = (0, 0)
	c = 0
	(t1, t2) = (0, 0)
	while i <= j and s1 + s2 != s:
		if c % 2 == 0:
			t1 = l[i]
			i += 1
			while i <= j and t1 <= t2:
				t1 += l[i]
				i += 1
			s1 += t1
		else:
			t2 = l[j]
			j -= 1
			while j >= i and t2 <= t1:
				t2 += l[j]
				j -= 1
			s2 += t2
		c += 1
	print(c, s1, s2)


t = int(input())
for tt in range(t):
	n = int(input())
	candies = list(map(int, input().split()))
	left = 1
	right = n - 1
	alice = candies[0]
	bob = 0
	moves = 1
	prev = candies[0]
	isAlice = False
	while left <= right:
		cur = 0
		if isAlice:
			while left <= right and cur <= prev:
				cur += candies[left]
				left += 1
			isAlice = False
			alice += cur
		else:
			while left <= right and cur <= prev:
				cur += candies[right]
				right -= 1
			isAlice = True
			bob += cur
		prev = cur
		moves += 1
	print(str(moves) + ' ' + str(alice) + ' ' + str(bob))


def solution(n, arr):
	(boolA, boolB) = (True, False)
	i = 0
	(currA, currB) = ([0], [0])
	(a, b) = (0, n - 1)
	while a <= b:
		if boolA:
			chA = 0
			while chA <= currB[-1] and a <= b:
				chA += arr[a]
				a += 1
			currA.append(chA)
			boolA = False
		else:
			chB = 0
			while chB <= currA[-1] and a <= b:
				chB += arr[b]
				b -= 1
			currB.append(chB)
			boolA = True
	return (len(currA) + len(currB) - 2, sum(currA), sum(currB))
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*solution(n, a))


from sys import stdin, stdout
import collections
t = int(input())

def solve(n, nums):
	(a, b) = (0, 0)
	(prevA, prevB) = (0, 0)
	rd = 0
	while len(nums) > 0:
		cur = 0
		if rd % 2 == 0:
			while cur <= prevB and len(nums) > 0:
				if len(nums) > 0:
					cur += nums[0]
					nums = nums[1:]
			a += cur
			prevA = cur
		else:
			while cur <= prevA and len(nums) > 0:
				if len(nums) > 0:
					cur += nums[-1]
					nums = nums[:-1]
			b += cur
			prevB = cur
		rd += 1
	print(rd, a, b)
for i in range(t):
	n = int(input())
	nums = list(map(int, stdin.readline().split()))
	solve(n, nums)


from collections import deque
T = int(input())
i = 0
while i < T:
	n = int(input())
	s = input().split()
	s = [int(x) for x in s]
	s = deque(s)
	a = s.popleft()
	b = 0
	q = a
	o = 1
	while len(s) > 0:
		e = 0
		while e <= q and len(s) > 0:
			e += s.pop()
		b += e
		o += 1
		q = 0
		if len(s) > 0:
			while q <= e and len(s) > 0:
				q += s.popleft()
			a += q
			o += 1
	print(o, a, b)
	i += 1


import sys
import math
from collections import defaultdict
mod = 1000000007
T = 1
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	(s1, s2) = (0, 0)
	(a, b) = (0, 0)
	k = 0
	while i <= j:
		if k & 1 == 0:
			s1 = 0
			while s1 <= s2:
				s1 += l[i]
				i += 1
				if i > j:
					break
			a += s1
		else:
			s2 = 0
			while s2 <= s1:
				s2 += l[j]
				j -= 1
				if j < i:
					break
			b += s2
		k += 1
	print(k, a, b)


N = int(input())
answers = []
for i in range(N):
	length = int(input())
	arr = list(map(int, input().split()))
	curr_turn = 0
	Aindex = 0
	Bindex = length - 1
	Asum = 0
	Bsum = 0
	Aturns = 0
	Bturns = 0
	ALturn = 0
	BLturn = 0
	if length == 1:
		answers.append([1, arr[0], 0])
		continue
	elif length == 2:
		answers.append([2, arr[0], arr[1]])
		continue
	while True:
		if Bindex == Aindex:
			if Asum + Bsum != sum(arr):
				if curr_turn:
					Bsum += arr[Bindex]
					Bturns += 1
				else:
					Asum += arr[Aindex]
					Aturns += 1
			break
		curr_sum = 0
		if Aindex == 0:
			Asum += arr[Aindex]
			Aindex += 1
			curr_turn = 1
			Aturns += 1
			ALturn = Asum
		elif curr_turn == 1:
			while curr_sum <= ALturn:
				if Bindex == Aindex:
					Bsum += arr[Bindex]
					break
				curr_sum += arr[Bindex]
				Bsum += arr[Bindex]
				Bindex -= 1
			Bturns += 1
			BLturn = curr_sum
			curr_turn = 0
		else:
			while curr_sum <= BLturn:
				if Aindex == Bindex:
					Asum += arr[Aindex]
					break
				curr_sum += arr[Aindex]
				Asum += arr[Aindex]
				Aindex += 1
			Aturns += 1
			ALturn = curr_sum
			curr_turn = 1
	answers.append([Aturns + Bturns, Asum, Bsum])
for i in answers:
	print(str(i[0]) + ' ' + str(i[1]) + ' ' + str(i[2]))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	a = arr.pop(0)
	b = 0
	ali = a
	bob = 0
	c = 1
	count = 1
	while arr:
		if c == 1:
			b = 0
			while b <= a and arr:
				b += arr.pop()
			if b > a:
				c = 0
				bob += b
				count += 1
			if arr == [] and b <= a:
				bob += b
				count += 1
		else:
			a = 0
			while b >= a and arr:
				a += arr.pop(0)
			if a > b:
				c = 1
				ali += a
				count += 1
			if arr == [] and a <= b:
				ali += a
				count += 1
	print(count, ali, bob)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = deque(map(int, input().split()))
	total_a = last_move = a.popleft()
	total_b = 0
	moves = 1
	while a:
		current = 0
		while a and current <= last_move:
			x = a.pop()
			total_b += x
			current += x
		moves += 1
		last_move = current
		if not a:
			break
		current = 0
		while a and current <= last_move:
			x = a.popleft()
			total_a += x
			current += x
		moves += 1
		last_move = current
	print(moves, total_a, total_b)


for _ in ' ' * int(input()):
	a = int(input())
	b = list(map(int, input().split()))
	i = 1
	j = a - 1
	(m1, m2, m3) = (1, 0, 0)
	(s, s1) = (b[0], 0)
	k = 1
	(t1, t2) = (b[0], 0)
	while i <= j:
		m1 += 1
		if k & 1:
			while i <= j and s >= s1:
				s1 += b[j]
				j -= 1
			t2 += s1
			s = 0
		else:
			while i <= j and s1 >= s:
				s += b[i]
				i += 1
			t1 += s
			s1 = 0
		k += 1
	print(m1, t1, t2)


from collections import deque
T = int(input())
for t in range(T):
	n = int(input())
	candies = list(map(int, input().split()))
	(left, right) = (0, n - 1)
	q = deque(candies)
	(curr_a, curr_b, total_a, total_b, turn, no_moves) = (0, 0, 0, 0, 0, 0)
	while q:
		if turn == 0:
			while q and curr_a <= curr_b:
				curr_a += q.popleft()
			total_a += curr_a
			no_moves += 1
			curr_b = 0
			turn = 1
		else:
			while q and curr_b <= curr_a:
				curr_b += q.pop()
			total_b += curr_b
			no_moves += 1
			curr_a = 0
			turn = 0
	print(no_moves, total_a, total_b, sep=' ')


from sys import stdin, exit
for _ in range(int(stdin.readline())):
	stdin.readline()
	l = list(map(int, stdin.readline().split()))
	n = 1
	ab = [l[0], 0]
	l = l[1:]
	pmax = ab[0]
	t = 0
	left = len(l)
	while left > 0:
		l.reverse()
		t -= 1
		t *= t
		n += 1
		i = 0
		now = 0
		while now <= pmax:
			now += l[i]
			i += 1
			if i == left:
				break
		ab[t] += now
		l = l[i:]
		left = len(l)
		pmax = now
	print(n, ab[0], ab[1])
exit()


t = int(input())
out = ''
while t > 0:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	alice = bob = 0
	prev_a = prev_b = 0
	i = 0
	j = n - 1
	fw = True
	rounds = 0
	while i <= j:
		curr = 0
		if fw:
			while i <= j and curr <= prev_b:
				curr += a[i]
				i += 1
			alice += curr
			prev_a = curr
		else:
			while i <= j and curr <= prev_a:
				curr += a[j]
				j -= 1
			bob += curr
			prev_b = curr
		rounds += 1
		fw = not fw
	out += f'{rounds} {alice} {bob}\n'
print(out)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	a = b = 0
	la = lb = 0
	last = 0
	c = 0
	while True:
		if len(arr) <= 0:
			break
		if last:
			t = arr.pop()
			if not lb:
				lb = t
				c += 1
			else:
				lb += t
			b += t
			if lb > la:
				last = 0
				la = 0
		else:
			t = arr.pop(0)
			if not la:
				la = t
				c += 1
			else:
				la += t
			a += t
			if la > lb:
				last = 1
				lb = 0
	print(c, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	m = 0
	last = 0
	flag = True
	a = 0
	b = 0
	while flag:
		m += 1
		if m % 2:
			for i in range(1, len(arr) + 1):
				if i == len(arr):
					flag = False
					a += sum(arr)
					break
				if sum(arr[:i]) > last:
					last = sum(arr[:i])
					a += sum(arr[:i])
					arr = arr[i:]
					break
		else:
			for i in range(len(arr) - 1, -1, -1):
				if i == 0:
					flag = False
					b += sum(arr)
					break
				if sum(arr[i:]) > last:
					last = sum(arr[i:])
					b += sum(arr[i:])
					arr = arr[:i]
					break
	print(m, a, b)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(alice, bob) = (0, 0)
	turn = 0
	before = 0
	now = 0
	a = deque(a)
	while len(a) > 0:
		if turn % 2 == 0:
			turn += 1
			while now <= before and len(a) > 0:
				now += a.popleft()
			alice += now
			before = now
			now = 0
		else:
			turn += 1
			while now <= before and len(a) > 0:
				now += a.pop()
			bob += now
			before = now
			now = 0
	print(turn, alice, bob)


MOD = 1000000007

def solve(a, n):
	(total_alice, inc_alice) = (a[0], a[0])
	(total_bob, inc_bob) = (0, 0)
	i = 1
	a.pop(0)
	while len(a) != 0:
		inc_bob = 0
		while inc_bob <= inc_alice:
			if len(a) == 0:
				break
			inc_bob += a.pop()
		total_bob += inc_bob
		i += 1
		if len(a) == 0:
			break
		inc_alice = 0
		while inc_alice <= inc_bob:
			if len(a) == 0:
				break
			inc_alice += a[0]
			a.pop(0)
		total_alice += inc_alice
		i += 1
	print(i, total_alice, total_bob)
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	solve(a, n)


import collections, heapq, itertools, math
groupby = itertools.groupby
rs = lambda : input()
ri = lambda : int(input())
rm = lambda : map(int, input().split())
rai = lambda : [int(x) for x in input().split()]

def solve(n, a):
	move = 0
	sum_a = 0
	sum_b = 0
	prev_a = 0
	prev_b = 0
	turn = 0
	l = 0
	r = n - 1
	while l <= r:
		if turn == 0:
			while prev_a <= prev_b and turn == 0 and (l <= r):
				sum_a += a[l]
				prev_a += a[l]
				l += 1
			prev_b = 0
			turn = 1
		else:
			while prev_b <= prev_a and turn == 1 and (l <= r):
				sum_b += a[r]
				prev_b += a[r]
				r -= 1
			prev_a = 0
			turn = 0
		move += 1
	return (move, sum_a, sum_b)
for t in range(ri()):
	n = ri()
	a = rai()
	print('{} {} {}'.format(*solve(n, a)))


def solve(size, array):
	(head, tail, moves) = (0, size - 1, 1)
	(Alice, Bob, flag) = ([0, 0], [0, 0], 1)
	while head <= tail:
		if flag:
			if Alice[1] <= Bob[1]:
				Alice[1] += array[head]
				head += 1
			else:
				moves += 1
				flag = 0
				Alice[0] += Alice[1]
				Bob[1] = 0
		elif Bob[1] <= Alice[1]:
			Bob[1] += array[tail]
			tail -= 1
		else:
			moves += 1
			flag = 1
			Bob[0] += Bob[1]
			Alice[1] = 0
	if flag:
		Bob[1] = 0
	else:
		Alice[1] = 0
	Bob[0] += Bob[1]
	Alice[0] += Alice[1]
	print(moves, Alice[0], Bob[0])
for _ in range(int(input())):
	solve(int(input()), list(map(int, input().split())))


import sys
import collections
input = sys.stdin.readline
t = int(input())
for ti in range(1, t + 1):
	n = int(input())
	candies = list(map(int, input().split()))
	q = collections.deque(candies)
	aa = q.popleft()
	(sum_a, sum_b) = (aa, 0)
	(pre_a, pre_b) = (aa, 0)
	moves = 1
	while q:
		a = b = 0
		while q and b <= pre_a:
			cur_b = q.pop()
			b += cur_b
		moves += 1
		sum_b += b
		pre_b = b
		if not q:
			break
		while q and a <= pre_b:
			cur_a = q.popleft()
			a += cur_a
		moves += 1
		sum_a += a
		pre_a = a
	print(moves, sum_a, sum_b)


t = int(input())
for _ in range(t):
	n = int(input())
	items = list(map(int, input().split()))
	pre = 0
	d = 'l'
	a = 0
	b = 0
	count = 0
	while len(items) != 0:
		if d == 'l':
			cur = 0
			while pre >= cur and len(items) > 0:
				cur += items[0]
				del items[0]
			d = 'r'
			pre = cur
			a += cur
			if cur > 0:
				count += 1
		if d == 'r':
			cur = 0
			while pre >= cur and len(items) > 0:
				cur += items[-1]
				del items[-1]
			d = 'l'
			pre = cur
			b += cur
			if cur > 0:
				count += 1
	print(count, a, b)


import math
from collections import Counter

def solve():
	n = int(input())
	l1 = list(map(int, input().split()))
	if n == 1:
		print(1, l1[-1], 0)
		return
	sum1 = 0
	sum2 = 0
	c = 0
	flag = 0
	while len(l1) != 0:
		if flag == 0:
			c = c + 1
			v1 = l1.pop(0)
			sum1 += v1
			a1 = v1
			flag2 = 1
			flag1 = 0
			flag = 1
		if flag1 == 1:
			if len(l1) == 0:
				break
			c = c + 1
			a1 = 0
			s = sum(l1)
			if s > b1:
				for i in range(len(l1)):
					a1 += l1.pop(0)
					if a1 > b1:
						break
				sum1 += a1
				flag1 = 0
				flag2 = 1
			else:
				sum1 += s
				break
		if flag2 == 1:
			if len(l1) == 0:
				break
			c = c + 1
			b1 = 0
			s = sum(l1)
			if s > a1:
				for i in range(len(l1) - 1, -1, -1):
					b1 += l1.pop()
					if a1 < b1:
						break
				sum2 += b1
				flag1 = 1
				flag2 = 0
			else:
				sum2 += s
				break
	print(c, sum1, sum2)
for _ in range(int(input())):
	solve()


T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	l = -1
	r = n
	if n == 1:
		print(1, A[0], 0)
	else:
		step_counter = 0
		prev_A = 0
		prev_B = 0
		cur_A = 0
		cur_B = 0
		total_A = 0
		total_B = 0
		eaten = 0
		while eaten < n:
			if step_counter % 2 == 0:
				while cur_A <= prev_B and l + 1 < r:
					cur_A += A[l + 1]
					l += 1
					eaten += 1
				total_A += cur_A
				prev_A = cur_A
				cur_A = 0
			else:
				while cur_B <= prev_A and l < r - 1:
					cur_B += A[r - 1]
					r -= 1
					eaten += 1
				total_B += cur_B
				prev_B = cur_B
				cur_B = 0
			step_counter += 1
		print(step_counter, total_A, total_B)


import sys
import math

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

def idata():
	return [int(x) for x in ii().split()]

def solve_of_problem():
	n = int(ii())
	a = idata()
	(al, bob, now, last, flag) = (0, 0, 0, 0, 1)
	(l, r, hod) = (0, n - 1, 0)
	for i in range(n):
		if flag:
			now += a[l]
			al += a[l]
			l += 1
		else:
			now += a[r]
			bob += a[r]
			r -= 1
		if now > last:
			hod += 1
			(last, now, flag) = (now, 0, (1 + flag) % 2)
	if now != 0:
		hod += 1
	print(hod, al, bob)
	return
for ______ in range(int(ii())):
	solve_of_problem()


for _ in range(int(input())):
	n = int(input())
	INPUT = list(map(int, input().split()))
	ANS = 2
	ALICE = [INPUT[0]]
	BOB = []
	INPUT.pop(0)
	while len(INPUT) > 0:
		(alice, bob) = (0, 0)
		if ANS % 2:
			while BOB[-1] >= alice:
				if len(INPUT) > 0:
					alice += INPUT[0]
					INPUT.pop(0)
				else:
					break
			ALICE.append(alice)
		else:
			while ALICE[-1] >= bob:
				if len(INPUT) > 0:
					bob += INPUT[-1]
					INPUT.pop()
				else:
					break
			BOB.append(bob)
		ANS += 1
	print(ANS - 1, sum(ALICE), sum(BOB))


import math
t = int(input())

def fn():
	n = int(input())
	x = list(map(int, input().split()))
	l = 0
	r = n - 1
	curr = 0
	tot = 0
	p = 0
	q = 0
	while 1:
		ate = 0
		tot += 1
		while ate <= curr:
			ate += x[l]
			p += x[l]
			l += 1
			if l == r + 1:
				print(tot, p, q)
				return
		curr = ate
		ate = 0
		tot += 1
		while ate <= curr:
			ate += x[r]
			q += x[r]
			r -= 1
			if l == r + 1:
				print(tot, p, q)
				return
		curr = ate
while t:
	t -= 1
	fn()


from __future__ import division, print_function
import os, 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 ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
import math
import bisect
abc = 'abcdefghijklmnopqrstuvwxyz'

def find(a, x):
	l = 0
	r = len(a) - 1
	while l < r:
		mid = (l + r) // 2
		if a[mid] == x:
			return True
		elif a[mid] > x:
			r = mid - 1
		elif a[mid] < x:
			l = mid + 1
	return False

def main():
	for _ in range(ii()):
		n = ii()
		a = li()
		ans = 0
		h = [0] * 2
		d = 0
		x = 0
		while len(a):
			ans += 1
			i = c = 0
			while len(a) and c <= d:
				c += a[0]
				a = a[1:]
			a.reverse()
			h[x] += c
			x ^= 1
			d = c
		print(ans, h[0], h[1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	alice = [l[0]]
	alice_sum = l.pop(0)
	bob = []
	bob_sum = 0
	prev_alice = alice_sum
	prev_bob = 0
	cnt = 1
	while len(l):
		s = 0
		cnt += 1
		while s <= prev_alice and len(l):
			temp = l.pop(-1)
			s += temp
			bob.append(temp)
		bob_sum += s
		prev_bob = s
		if len(l):
			cnt += 1
		else:
			break
		s = 0
		while s <= prev_bob and len(l):
			temp = l.pop(0)
			s += temp
			alice.append(temp)
		alice_sum += s
		prev_alice = s
	print(cnt, sum(alice), sum(bob))
for _ in range(int(input())):
	solve()


def solve(arr):
	i = -1
	j = len(arr)
	(a, b) = (0, 0)
	(preva, prevb) = (0, 0)
	move = 0
	while i < j:
		(suma, sumb) = (0, 0)
		i += 1
		while i < j:
			if suma == 0:
				move += 1
			suma += arr[i]
			if suma > prevb:
				break
			i += 1
		a += suma
		preva = suma
		j -= 1
		while i < j:
			if sumb == 0:
				move += 1
			sumb += arr[j]
			if sumb > preva:
				break
			j -= 1
		b += sumb
		prevb = sumb
	print(move, a, b)
T = int(input())
for ti in range(1, T + 1):
	size = int(input())
	arr = list(map(int, input().split(' ')))
	solve(arr)


for T in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	last = 0
	A = 0
	B = 0
	X = 0
	l = 0
	r = n - 1
	while l <= r:
		if X % 2:
			cb = 0
			while r >= l and cb <= last:
				cb += a[r]
				r -= 1
			B += cb
			last = cb
		else:
			ca = 0
			while l <= r and ca <= last:
				ca += a[l]
				l += 1
			A += ca
			last = ca
		X += 1
	print(X, A, B)


from collections import *
from bisect import *
from math import *
import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	s = 0
	n = int(input())
	a = list(map(int, input().split()))
	ali = 0
	bob = 0
	tot = 0
	ap = 0
	aa = 0
	bb = 0
	bp = len(a) - 1
	cc = 0
	while ap <= bp:
		if cc % 2 == 0:
			while ali <= bob and ap <= bp:
				ali += a[ap]
				aa += a[ap]
				ap += 1
			tot += 1
			cc += 1
			bob = 0
		else:
			while bob <= ali and ap <= bp:
				bob += a[bp]
				bb += a[bp]
				bp -= 1
			tot += 1
			cc += 1
			ali = 0
	print(tot, aa, bb)


t = int(input())
for _ in range(t):
	l = int(input())
	arr = [int(a) for a in input().split(' ')]
	i = 0
	j = l - 1
	(a, b, ansa, ansb, m) = (0, 0, 0, 0, 0)
	flag = 'a'
	while i <= j:
		if flag == 'a':
			temp = arr.pop(0)
			a += temp
			if a > b or i == j:
				m += 1
				ansa += a
				b = 0
				flag = 'b'
			i += 1
		else:
			temp = arr.pop()
			b += temp
			if b > a or i == j:
				m += 1
				ansb += b
				a = 0
				flag = 'a'
			j -= 1
	print(m, ansa, ansb)


t = int(input())
for i in range(t):
	n = input()
	li = input().split()
	for i in range(len(li)):
		li[i] = int(li[i])
	a = 0
	b = 0
	cnt = 0
	moves = 0
	curr_a = 0
	curr_b = 0
	while li != []:
		if cnt % 2 == 0:
			moves += 1
			while curr_a <= curr_b:
				if len(li) == 0:
					break
				a += li[0]
				curr_a += li[0]
				cnt = 1
				li.pop(0)
			curr_b = 0
		else:
			moves += 1
			while curr_b <= curr_a:
				if len(li) == 0:
					break
				b += li[len(li) - 1]
				curr_b += li[len(li) - 1]
				cnt = 0
				li.pop(len(li) - 1)
			curr_a = 0
	print(moves, a, b)


for j in range(int(input())):
	n = int(input())
	a = []
	ac = bc = at = bt = count = 0
	h = input().split()
	for i in range(n):
		a.append(int(h[i]))
	while a != []:
		while at <= bt and a != []:
			at += a[0]
			del a[0]
		ac += at
		bt = 0
		count += 1
		if a == []:
			break
		while bt <= at and a != []:
			bt += a[-1]
			del a[-1]
		bc += bt
		at = 0
		count += 1
	print(count, ac, bc)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	summ = 0
	for j in l:
		summ += j
	(s, d) = (1, len(l) - 1)
	(a, b) = (l[0], 0)
	(count, previous) = (1, l[0])
	while a + b < summ:
		if count % 2 != 0:
			eat = 0
			while eat <= previous and d >= s:
				eat += l[d]
				d -= 1
			b += eat
			previous = eat
			count += 1
		else:
			eat = 0
			while eat <= previous and s <= d:
				eat += l[s]
				s += 1
			a += eat
			previous = eat
			count += 1
	print(count)
	print(a)
	print(b)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def solve(n, A):
	if n == 1:
		return (1, A[0], 0)
	cnt = 0
	(a, b) = (0, 0)
	(a_idx, b_idx) = (0, n - 1)
	(a_prev, b_prev) = (0, 0)
	flag = True
	while a_idx <= b_idx:
		tmp = 0
		if flag:
			while tmp <= b_prev and a_idx <= b_idx:
				a += A[a_idx]
				tmp += A[a_idx]
				a_idx += 1
			a_prev = tmp
			flag = False
		else:
			while tmp <= a_prev and a_idx <= b_idx:
				b += A[b_idx]
				tmp += A[b_idx]
				b_idx -= 1
			b_prev = tmp
			flag = True
		cnt += 1
	return (cnt, a, b)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		A = tuple(map(int, input().split()))
		Ans = solve(n, A)
		sys.stdout.write(' '.join(map(str, Ans)) + '\n')
main()


t = int(input())
while t > 0:
	t -= 1
	N = int(input())
	A = list(map(int, input().split()))
	X = A[0]
	a = A[0]
	Y = 0
	(i, j, move) = (0, N, 1)
	while i < j - 1:
		j -= 1
		cnt = A[j]
		while cnt <= a and i < j - 1:
			j -= 1
			cnt += A[j]
		move += 1
		if i < j - 1:
			move += 1
		b = cnt
		Y += cnt
		cnt = 0
		while cnt <= b and i < j - 1:
			i += 1
			cnt += A[i]
		X += cnt
		a = cnt
	print(move, X, Y)


tc = int(input())
for zzz in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	sa = 0
	sb = 0
	brr = [False] * n
	i = 0
	j = n - 1
	total = 0
	preva = 0
	prevb = 0
	moves = 0
	while total < n:
		cura = 0
		curb = 0
		azzz = bzzz = False
		while cura <= prevb and brr[i] == False:
			azzz = True
			cura += arr[i]
			sa += arr[i]
			brr[i] = True
			i += 1
			total += 1
		preva = cura
		if azzz:
			moves += 1
		while curb <= preva and brr[j] == False:
			bzzz = True
			curb += arr[j]
			sb += arr[j]
			brr[j] = True
			j -= 1
			total += 1
		if bzzz:
			moves += 1
		prevb = curb
	print(moves, sa, sb)


t = int(input())
for _ in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	lastBob = 0
	lastAlice = 0
	totalBob = 0
	totalAlice = 0
	turn = 0
	while len(nums) > 0:
		if turn % 2 == 0:
			mustEat = lastBob + 1
			aliceSum = 0
			i = 0
			while i < len(nums) and aliceSum + nums[i] < mustEat:
				aliceSum += nums[i]
				i += 1
			if i < len(nums):
				aliceSum += nums[i]
			if aliceSum < mustEat:
				totalAlice += aliceSum
				nums = []
			elif i + 1 >= n:
				nums = []
				totalAlice += aliceSum
			else:
				nums = nums[i + 1:]
				totalAlice += aliceSum
			lastAlice = aliceSum
		else:
			temp = list(reversed(nums))
			mustEat = lastAlice + 1
			bobSum = 0
			i = 0
			while i < len(temp) and bobSum + temp[i] < mustEat:
				bobSum += temp[i]
				i += 1
			if i < len(temp):
				bobSum += temp[i]
			if bobSum < mustEat:
				totalBob += bobSum
				temp = []
			elif i + 1 >= n:
				temp = []
				totalBob += bobSum
			else:
				temp = temp[i + 1:]
				totalBob += bobSum
			lastBob = bobSum
			nums = list(reversed(temp))
		turn += 1
	print(turn, totalAlice, totalBob)


for p in range(0, int(input())):
	p = int(input())
	c = list(map(int, input().split(' ')))
	mov = 0
	b = 0
	a = 0
	com = 0
	tot = 0
	for i in range(0, p):
		tot += c[i]
	nuev = 0
	while tot >= com and len(c) != 0:
		mov += 1
		nuev = 0
		while nuev <= com and len(c) != 0:
			if mov % 2 == 1:
				a += c[0]
				nuev += c[0]
				tot -= c[0]
				c.pop(0)
			else:
				b += c[len(c) - 1]
				nuev += c[len(c) - 1]
				tot -= c[len(c) - 1]
				c.pop(len(c) - 1)
		com = nuev
	if len(c) != 0:
		mov += 1
		if mov % 2 == 1:
			a += tot
		else:
			b += tot
	print(str(mov) + ' ' + str(a) + ' ' + str(b))


for i in range(int(input())):
	a = int(input())
	l = list(map(int, input().split()))
	r = 0
	(m, n, p, q) = (0, a - 1, 0, 0)
	(x, y) = (0, 0)
	while 1:
		for j in range(m, n + 1):
			x += l[j]
			if x > y:
				p += x
				r += 1
				break
		if x <= y:
			if x != 0:
				r += 1
			p += x
			break
		m = j + 1
		y = 0
		for k in range(n, m - 1, -1):
			y += l[k]
			if y > x:
				q += y
				r += 1
				break
		if y <= x:
			if y != 0:
				r += 1
			q += y
			break
		n = k - 1
		x = 0
	print(r, p, q)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 1
	j = n - 1
	x = a[0]
	y = 0
	p = a[0]
	q = 0
	count = 1
	fg = 0
	while i <= j:
		if fg == 0:
			q = a[j]
			while q <= p and j > i:
				j = j - 1
				q += a[j]
			j = j - 1
			y += q
			fg = 1
			count += 1
		elif fg == 1:
			p = a[i]
			while p <= q and i < j:
				i += 1
				p += a[i]
			i += 1
			x += p
			fg = 0
			count += 1
	print(count, x, y)


for _ in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	(x, y) = (-1, n)
	i = s1 = s2 = px = py = cx = cy = 0
	while x < y - 1:
		if not i & 1:
			x += 1
			cx += data[x]
			s1 += data[x]
			if cx > py:
				i += 1
				px = cx
				cx = 0
			if cx != 0 and (not x < y - 1):
				i += 1
		else:
			y -= 1
			cy += data[y]
			s2 += data[y]
			if cy > px:
				i += 1
				py = cy
				cy = 0
			if cy != 0 and (not x < y - 1):
				i += 1
	print(i, s1, s2)


def f():
	T = int(input())
	for _ in range(T):
		_ = input()
		nums = [int(c) for c in input().split()]
		solve(nums)

def solve(nums):
	n = len(nums)
	(i, j) = (-1, n)
	(a, b) = (0, 0)
	cur_max_size = 0
	is_left = True
	cnt = 0
	while i + 1 < j:
		if is_left:
			size = 0
			while i + 1 < j and size <= cur_max_size:
				size += nums[i + 1]
				i += 1
			a += size
			cur_max_size = size
			is_left = False
			cnt += 1
		else:
			size = 0
			while i < j - 1 and size <= cur_max_size:
				size += nums[j - 1]
				j -= 1
			b += size
			cur_max_size = size
			is_left = True
			cnt += 1
	print(cnt, a, b)
f()


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	konfeti = deque(map(int, input().split()))
	b = 0
	i = 1
	alisa = konfeti.popleft()
	a = alisa
	while konfeti:
		bob = 0
		while konfeti and bob <= alisa:
			bob += konfeti.pop()
		if bob > 0:
			i += 1
		b += bob
		alisa = 0
		while konfeti and alisa <= bob:
			alisa += konfeti.popleft()
		if alisa > 0:
			i += 1
		a += alisa
	print(i, a, b)


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	pta = 0
	ptb = n - 1
	cur = 0
	moves = 0
	prv_a = 0
	prv_b = 0
	aa = 0
	bb = 0
	while pta <= ptb:
		if cur == 0:
			tm1 = 0
			while pta <= ptb and tm1 <= prv_b:
				tm1 += a[pta]
				pta += 1
			prv_a = tm1
			aa += tm1
			moves += 1
			cur = 1
		else:
			tm1 = 0
			while pta <= ptb and tm1 <= prv_a:
				tm1 += a[ptb]
				ptb -= 1
			prv_b = tm1
			bb += tm1
			moves += 1
			cur = 0
	print(moves, end=' ')
	print(aa, end=' ')
	print(bb)


score = 0

def onemove1(a, m):
	global score
	sum = 0
	while sum <= score:
		sum += m[0]
		a.append(m.pop(0))
		if len(m) == 0:
			break
	score = sum
	return ''

def onemove2(m):
	global score
	sum = 0
	while sum <= score:
		sum += m[len(m) - 1]
		m.pop()
		if len(m) == 0:
			break
	score = sum
	return ''

def main():
	n = int(input())
	m = [int(s) for s in input().split()]
	a = []
	global score
	count = 0
	sum1 = sum(m)
	while len(m) != 0:
		onemove1(a, m)
		count += 1
		if len(m) == 0:
			break
		onemove2(m)
		count += 1
	score = 0
	print(count, sum(a), sum1 - sum(a))
	return ''
t = int(input())
for i in range(t):
	print(main())


from collections import deque

def solve():
	n = int(input())
	li = [int(x) for x in input().split()]
	summ = sum(li)
	q = deque(li)
	prev = 0
	(a, b) = (0, 0)
	(alice, bob) = (True, False)
	(mov, total) = (0, 0)
	while q and total != summ:
		hppn = True
		if alice == True and hppn == True:
			mov += 1
			curr = 0
			while q and curr <= prev:
				curr += q.popleft()
			a += curr
			prev = curr
			alice = False
			bob = True
			hppn = False
		elif bob == True and hppn == True:
			mov += 1
			curr = 0
			while q and curr <= prev:
				curr += q.pop()
			b += curr
			prev = curr
			bob = False
			alice = True
			hppn = False
		total = a + b
	print(mov, a, b)
t = int(input())
for i in range(t):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	b = 0
	c = 0
	t = 0
	x = True
	hody = 0
	while l <= r:
		s = 0
		hody += 1
		if x:
			while s <= t and l <= r:
				b += a[l]
				s += a[l]
				l += 1
			t = s
		else:
			while s <= t and l <= r:
				c += a[r]
				s += a[r]
				r -= 1
			t = s
		x = not x
	print(hody, b, c)


from collections import deque

def solve(time):
	_ = int(input())
	a = deque([int(x) for x in input().split(' ')])
	count = 1
	alice = 0
	bob = 0
	switch = 1
	previous = a.popleft()
	alice += previous
	num = 0
	while a:
		if switch == 1:
			num += a.pop()
			if num > previous:
				bob += num
				previous = num
				num = 0
				switch = 0
				count += 1
		elif switch == 0:
			num += a.popleft()
			if num > previous:
				alice += num
				previous = num
				num = 0
				switch = 1
				count += 1
	if num != 0:
		count += 1
		if switch == 1:
			bob += num
		else:
			alice += num
	print(count, alice, bob)
nums = int(input())
for _ in range(1, nums + 1):
	solve(_)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = deque(map(int, input().split()))
	(prev, m, x, y) = (0, 0, 0, 0)
	while a:
		(xi, yi) = (0, 0)
		while a and xi <= prev:
			xi += a.popleft()
		while a and yi <= xi:
			yi += a.pop()
		if xi > 0:
			m += 1
		if yi > 0:
			m += 1
		x += xi
		y += yi
		prev = yi
	print(m, x, y)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = 1
	i = 1
	j = n - 1
	sum_alice = l[0]
	sum_bob = 0
	Sum_a = l[0]
	Sum_b = 0
	while i <= j:
		f = 0
		while Sum_b <= Sum_a and i <= j:
			Sum_b += l[j]
			j = j - 1
			f = 1
		sum_bob += Sum_b
		if f == 1:
			c += 1
		Sum_a = 0
		f = 0
		while Sum_a <= Sum_b and i <= j:
			Sum_a += l[i]
			i += 1
			f = 1
		sum_alice += Sum_a
		if f == 1:
			c += 1
		Sum_b = 0
	print(c, sum_alice, sum_bob)


for _ in range(int(input())):
	n = map(int, input().split())
	l = list(map(int, input().split()))
	(a, b, c, m) = (0, 0, 0, 0)
	while l != []:
		s = 0
		while s <= m:
			s += l[0]
			a += l[0]
			del l[0]
			if l == []:
				break
		c += 1
		if l == []:
			break
		m = s
		s = 0
		while s <= m:
			s += l[-1]
			b += l[-1]
			del l[-1]
			if l == []:
				break
		c += 1
		if l == []:
			break
		m = s
	print(c, a, b)


T = int(input())
for i in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	Alice_Power = 0
	Alice = 0
	Bob = 0
	Alice_count = 0
	Positive = 0
	Bob_Power = 0
	Bob_count = 0
	chance = 0
	Alice_moves = 0
	Bob_moves = 0
	L = []
	for i in range(len(A)):
		if i == 0:
			Bob_Power = 0
			Alice_Power += A[Alice_count]
			Alice += A[Alice_count]
			Alice_count += 1
			Alice_moves += 1
			chance = 1
		elif Alice_Power < Bob_Power:
			Alice += A[Alice_count]
			Alice_Power += A[Alice_count]
			Alice_count += 1
			Alice_moves += 1
			chance = 1
			if Alice_Power > Bob_Power:
				Bob_Power = 0
		elif Alice_Power > Bob_Power:
			Bob += A[len(A) - Bob_count - 1]
			Bob_Power += A[len(A) - Bob_count - 1]
			Bob_count += 1
			Bob_moves += 1
			chance = 0
			if Bob_Power > Alice_Power:
				Alice_Power = 0
		elif Alice_Power == Bob_Power and chance == 0:
			Bob += A[len(A) - Bob_count - 1]
			Bob_Power += A[len(A) - Bob_count - 1]
			Bob_count += 1
			Bob_moves += 1
			chance = 0
			if Bob_Power > Alice_Power:
				Alice_Power = 0
		elif Alice_Power == Bob_Power and chance == 1:
			Alice += A[Alice_count]
			Alice_Power += A[Alice_count]
			Alice_count += 1
			Alice_moves += 1
			chance = 1
			if Alice_Power > Bob_Power:
				Bob_Power = 0
		L.append(chance)
	Moves = 1
	for i in range(len(L) - 1):
		if L[i] != L[i + 1]:
			Moves += 1
	print(Moves, Alice, Bob)


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	s1 = 0
	s2 = 0
	m = 0
	a = 0
	b = 0
	t = True
	start = 0
	end = n - 1
	while start <= end:
		if t:
			s1 += x[start]
			start += 1
		else:
			s2 += x[end]
			end -= 1
		if s1 > s2 and t:
			a += s1
			s2 = 0
			t = False
			m += 1
		elif s2 > s1 and (not t):
			b += s2
			s1 = 0
			t = True
			m += 1
	if s1 and t:
		a += s1
		m += 1
	elif s2 and (not t):
		b += s2
		m += 1
	print(m, end=' ')
	print(a, end=' ')
	print(b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	alice = 1
	bob = n - 1
	prev = arr[0]
	turn = 2
	a = arr[0]
	b = 0
	while alice < n and bob > 0 and (alice <= bob):
		if turn % 2 == 0:
			candie = 0
			while bob > 0 and candie <= prev and (alice <= bob):
				candie = candie + arr[bob]
				bob = bob - 1
			b = b + candie
			turn = turn + 1
			prev = candie
		else:
			candie = 0
			while alice < n and candie <= prev and (alice <= bob):
				candie = candie + arr[alice]
				alice = alice + 1
			a = a + candie
			turn = turn + 1
			prev = candie
	print(turn - 1, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	alice = 0
	bob = 0
	move = 0
	a = 0
	b = n - 1
	bobtemp = 0
	alicetemp = 0
	flag = 0
	while b >= a:
		flag = 0
		while alicetemp <= bobtemp and b >= a:
			alicetemp += l[a]
			a += 1
			flag = 1
		alice += alicetemp
		if flag == 1:
			move += 1
		bobtemp = 0
		flag = 0
		while bobtemp <= alicetemp and b >= a:
			bobtemp += l[b]
			b -= 1
			flag = 1
		bob += bobtemp
		if flag == 1:
			move += 1
		alicetemp = 0
	print(move, alice, bob)


t = int(input())
for j in range(t):
	n = int(input())
	g = list(map(int, input().split()))
	a = g[0]
	b = 0
	l = 1
	r = n - 1
	i = 1
	c = a
	e = 1
	while l <= r and l < n and (r >= 0):
		if i % 2 == 0:
			k2 = 0
			while k2 <= c and l <= r:
				k2 += g[l]
				a += g[l]
				l += 1
			c = k2
			e += 1
			i += 1
		else:
			k2 = 0
			while k2 <= c and l <= r:
				k2 += g[r]
				b += g[r]
				r -= 1
			c = k2
			e += 1
			i += 1
	print(e, a, b)


def solve(a):
	n = len(a)
	lef = 1
	rig = n - 1
	prea = [a[0]]
	preb = []
	while lef <= rig:
		sumb = 0
		while rig >= lef and sumb <= prea[-1]:
			sumb += a[rig]
			rig -= 1
		if sumb > 0:
			preb.append(sumb)
		if sumb <= prea[-1]:
			break
		suma = 0
		while lef <= rig and suma <= preb[-1]:
			suma += a[lef]
			lef += 1
		if suma > 0:
			prea.append(suma)
		if suma <= preb[-1]:
			break
	print(len(prea) + len(preb), sum(prea), sum(preb))
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	solve(a)


def func(A):
	i = -1
	j = len(A)
	flag = 0
	prev_flag = -1
	summ1 = 0
	summ2 = 0
	summ11 = 0
	summ22 = 0
	count = 0
	while i < j:
		if flag != prev_flag:
			count += 1
		prev_flag = flag
		if flag == 0:
			i += 1
			summ1 += A[i]
			summ11 += A[i]
			if summ11 > summ22:
				flag = 1
				summ22 = 0
		else:
			j -= 1
			summ2 += A[j]
			summ22 += A[j]
			if summ22 > summ11:
				flag = 0
				summ11 = 0
		if i + 1 == j:
			break
	return (count, summ1, summ2)
x = int(input())
a = []
for _ in range(x):
	l = input()
	a.append(list(map(int, input().split())))
for i in a:
	(a, b, c) = func(i)
	print(' '.join(list(map(str, [a, b, c]))))


test_cases = int(input())
for _ in range(test_cases):
	input()
	arr = list(map(int, input().split(' ')))
	(alice, bob, moves) = (0, 0, 0)
	bob_this_move = 0
	while True:
		alice_this_move = 0
		while arr and alice_this_move <= bob_this_move:
			alice_this_move += arr[0]
			del arr[0]
		moves += 1
		alice += alice_this_move
		if not arr:
			break
		bob_this_move = 0
		while arr and bob_this_move <= alice_this_move:
			bob_this_move += arr[-1]
			del arr[-1]
		moves += 1
		bob += bob_this_move
		if not arr:
			break
	print(moves, alice, bob)


def main():
	for _ in range(int(input())):
		_ = input()
		entrada = list(map(int, input().split()))
		A = 0
		B = 0
		SumA = 0
		SumB = 0
		turnos = 1
		A = entrada[0]
		SumA = A
		entrada.pop(0)
		while len(entrada) != 0:
			turnos += 1
			if turnos % 2 == False:
				B = 0
				while B <= A:
					if len(entrada) == 0:
						break
					B += entrada[-1]
					entrada.pop(-1)
				SumB += B
			else:
				A = 0
				while A <= B:
					if len(entrada) == 0:
						break
					A += entrada[0]
					entrada.pop(0)
				SumA += A
		print(turnos, SumA, SumB)
main()


t = int(input())
for i in range(t):
	n = int(input())
	con = list(map(int, input().split()))
	left = -1
	right = n
	al = 0
	bob = 0
	pre = 0
	(ls, rs, c) = (0, 0, 0)
	while left != right - 1:
		(ls, rs) = (0, 0)
		while ls <= pre and left < right - 1:
			left += 1
			ls += con[left]
		pre = ls
		if ls:
			c += 1
		al += ls
		while rs <= pre and left < right - 1:
			right -= 1
			rs += con[right]
		pre = rs
		if rs:
			c += 1
		bob += rs
	print(c, al, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	alice = bob = move = 0
	last_alice = last_bob = 0
	size = a
	while len(size) > 0:
		index_alice = 0
		index_bob = -1
		length = len(size)
		last_alice = 0
		alice_move = bob_move = 0
		while last_alice <= last_bob and index_alice < length:
			last_alice += size[index_alice]
			index_alice += 1
			alice_move = 1
		size = size[index_alice:]
		length = len(size)
		last_bob = 0
		while last_bob <= last_alice and index_bob >= -length:
			last_bob += size[index_bob]
			index_bob -= 1
			bob_move = 1
		size = size[:[index_bob + 1, -1][index_bob == -1]]
		alice += last_alice
		bob += last_bob
		move += alice_move + bob_move
	print(move, alice, bob)


import sys
try:
	sys.stdin = open('Input.txt', 'r')
	sys.stdout = open('Output.txt', 'w')
except:
	pass
for testCases in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	left = 0
	right = n - 1
	turns = 0
	acan = 0
	atot = 0
	btot = 0
	bcan = 0
	while left <= right:
		while left <= right and acan <= bcan:
			acan += l[left]
			left += 1
		atot += acan
		bcan = 0
		turns += 1
		if left > right:
			print(turns, atot, btot)
			break
		while left <= right and bcan <= acan:
			bcan += l[right]
			right -= 1
		acan = 0
		btot += bcan
		turns += 1
		if left > right:
			print(turns, atot, btot)
			break


for _ in range(int(input())):
	n = int(input())
	au = list(map(int, input().split()))
	count = 0
	(a, b) = (0, 0)
	(i, j) = (0, n - 1)
	k = 0
	(prea, preb) = (0, 0)
	while n > 0:
		if k % 2 == 0:
			u = 0
			while u <= preb:
				u += au[i]
				i += 1
				n -= 1
				if n == 0:
					break
			a += u
			prea = u
			count += 1
		else:
			u = 0
			while u <= prea:
				u += au[j]
				j -= 1
				n -= 1
				if n == 0:
					break
			b += u
			preb = u
			count += 1
		k += 1
	print(count, a, b)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def binary_search(lb, ub, val, cnt):
	mid = (lb + ub) // 2
	if val < mid:
		ub = mid - 1
		binary_search(lb, ub, val, cnt - 1)
	elif val > mid:
		lb = mid + 1
		binary_search(lb, ub, val, cnt - 1)
	else:
		print(cnt)

def abs(x):
	return x if x >= 0 else -x

def process(li, cnt):
	flag = 0
	sa = 0
	sb = 0
	(sumb, suma) = (0, 0)
	while True:
		for i in range(len(li)):
			if i == len(li) - 1:
				suma = sum(li)
				sa += suma
				cnt += 1
				flag = 1
				del li[:]
				break
			if sum(li[:i + 1]) > sumb:
				suma = sum(li[:i + 1])
				sa += suma
				del li[:i + 1]
				cnt += 1
				break
		for i in range(len(li) - 1, -1, -1):
			if i == 0:
				sumb = sum(li)
				sb += sumb
				cnt += 1
				flag = 1
				del li[:]
				break
			if sum(li[i:]) > suma:
				sumb = sum(li[i:])
				sb += sumb
				del li[i:]
				cnt += 1
				break
		if len(li) == 0:
			break
	print(cnt, sa, sb)
	return
for t in range(int(input())):
	n = int(input())
	candies = list(map(int, input().split()))
	process(candies, 0)


for i in range(int(input())):
	n = int(input())
	l1 = [int(j) for j in input().split()][:n]
	a = l1[0]
	p1 = a
	b = 0
	p2 = 0
	c = 1
	l = 1
	h = n - 1
	t = 0
	d = 1
	while l <= h:
		if t == 0:
			while p2 <= p1:
				p2 = p2 + l1[h]
				h = h - 1
				if h < l:
					break
			b += p2
			t = 1
			p1 = p2
			p2 = 0
			c = c + 1
		else:
			while p2 <= p1:
				p2 += l1[l]
				l = l + 1
				if l > h:
					break
			a += p2
			t = 0
			p1 = p2
			p2 = 0
			c = c + 1
	print(c, a, b)


from bisect import bisect_left
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(total, sum_alice, sum_bob) = (0, 0, 0)
	su = [0, 0, 0]

	def f(i, j, alice, bob, turn):
		su[0] += 1
		if i > j:
			return
		s = 0
		if turn:
			while s <= bob and i <= j:
				s += l[i]
				i += 1
			su[1] += s
		else:
			while s <= alice and j >= i:
				s += l[j]
				j -= 1
			su[2] += s
		return f(i, j, s, s, not turn)
	f(0, n - 1, 0, 0, True)
	print(su[0] - 1, su[1], su[2])


tc = int(input())
for osu in range(tc):
	n = int(input())
	li = list(map(int, input().split()))
	(aturn, l, r, a, cura, b, curb, mov) = (True, 0, n - 1, 0, 0, 0, 0, 0)
	while l <= r:
		if aturn == True:
			cura = 0
			mov += 1
			while l <= r and cura <= curb:
				cura += li[l]
				l += 1
			a += cura
			aturn = False
		else:
			curb = 0
			mov += 1
			while l <= r and curb <= cura:
				curb += li[r]
				r -= 1
			b += curb
			aturn = True
	print(mov, a, b, sep=' ')


noOfTest = int(input())
li = []
for i in range(0, noOfTest):
	no = int(input())
	list_of_input = list(map(int, input().split()))
	if len(list_of_input) != no:
		print('Wrong no of inputs')
		break
	li.append(list_of_input)
for i in li:
	check = 0
	count = 0
	alt = 0
	bot = 0
	a = i
	while a != []:
		count += 1
		total = 0
		if count % 2 == 1:
			if count == 1:
				total = a[0]
				alt = alt + a[0]
				a.pop(0)
			else:
				while total <= check and a != []:
					total += a[0]
					alt = alt + a[0]
					a.pop(0)
		else:
			while total <= check and a != []:
				total += a[len(a) - 1]
				bot = bot + a[len(a) - 1]
				a.pop(len(a) - 1)
		check = total
	print(count, alt, bot)


I = input
for _ in range(int(I())):
	n = int(I())
	a = list(map(int, I().split(' ')))
	i = 0
	j = n - 1
	c = 0
	si = 0
	sj = 0
	tt = 0
	sii = 0
	sjj = 0
	c1 = 0
	while True:
		if i > j:
			break
		sii = 0
		while i <= j:
			c1 += 1
			si += a[i]
			sii += a[i]
			if sii > sjj:
				c += 1
				i += 1
				break
			elif i == j:
				c += 1
			i += 1
		if i > j:
			if c1 != n:
				c += 1
			break
		sjj = 0
		while j >= i:
			c1 += 1
			sj += a[j]
			sjj += a[j]
			if sjj > sii:
				c += 1
				j -= 1
				break
			elif i == j:
				c += 1
			j -= 1
	print(c, si, sj)


n = int(input())
for i in range(n):
	alice = 0
	bob = 0
	al = 0
	bo = 0
	a = int(input())
	x = list(map(int, input().split()))
	abc = 0
	while len(x) != 0:
		if abc % 2 == 0:
			while al <= bo and len(x) != 0:
				al += x[0]
				alice += x[0]
				x.pop(0)
			bo = 0
			abc += 1
		else:
			while bo <= al and len(x) != 0:
				bo += x[len(x) - 1]
				bob += x[len(x) - 1]
				x.pop()
			al = 0
			abc += 1
	print(abc, alice, bob)


from collections import defaultdict
import sys
input = sys.stdin.readline
inf = 100000000000000000
mod = 998244353
for CASES in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	left = 0
	right = 0
	l = 0
	r = n - 1
	turn = 0
	tot = 0
	ans_left = 0
	ans_right = 0
	while l <= r:
		tot += 1
		if turn == 0:
			tmp = 0
			while tmp <= right and l <= r:
				tmp += A[l]
				l += 1
			left = tmp
			ans_left += tmp
		elif turn == 1:
			tmp = 0
			while tmp <= left and l <= r:
				tmp += A[r]
				r -= 1
			right = tmp
			ans_right += tmp
		if turn == 1:
			turn = 0
		else:
			turn = 1
	print(tot, ans_left, ans_right)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = 1
	a = 0
	b = 0
	a += l[0]
	i = 1
	j = n - 1
	flag = True
	last = l[0]
	while i <= j:
		cur = 0
		if flag:
			while i <= j and cur <= last:
				cur += l[j]
				j -= 1
			b += cur
			last = cur
			x += 1
			flag = False
		else:
			while i <= j and cur <= last:
				cur += l[i]
				i += 1
			a += cur
			last = cur
			x += 1
			flag = True
	print(x, a, b)


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

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

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def dfs(v, visited, st, new):
	new.append(st)
	visited[st] = 1
	for i in v[st]:
		if visited[i] == 0:
			dfs(v, visited, i, new)

def s(a):
	g = 0
	for i in range(len(a)):
		g += a[i]
	return g

def solve():
	n = int(inp())
	a = lis()
	moves = 0
	asum = 0
	bsum = 0
	prev = 0
	while len(a) != 0:
		sum = 0
		f = 0
		if moves % 2 == 0:
			for i in range(0, len(a)):
				if i == len(a) - 1 and sum <= prev:
					f = 1
				if sum <= prev:
					sum += a[i]
				else:
					a = a[i:]
					break
			if f == 1:
				a = []
			prev = sum
			asum += sum
			moves += 1
		else:
			a = a[::-1]
			for i in range(0, len(a)):
				if i == len(a) - 1 and sum <= prev:
					f = 1
				if sum <= prev:
					sum += a[i]
				else:
					a = a[i:]
					break
			if f == 1:
				a = []
			a = a[::-1]
			prev = sum
			bsum += sum
			moves += 1
	print(moves, asum, bsum)
testcase(int(inp()))


for i in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	cnt = 1
	(alice, bob) = (a[0], 0)
	(preva, prevb) = (a[0], 0)
	a.pop(0)
	while a:
		if preva > prevb:
			while a and preva >= prevb:
				prevb += a[-1]
				bob += a[-1]
				a.pop(-1)
			preva = 0
		else:
			while a and prevb >= preva:
				preva += a[0]
				alice += a[0]
				a.pop(0)
			prevb = 0
		cnt += 1
	print(cnt, alice, bob)


def iinput():
	return [int(i) for i in input().split()]
t = int(input())
for _ in range(t):
	n = int(input())
	candies = iinput()
	turns = 0
	cur_lim = 0
	a = 0
	a_flag = True
	b = 0
	while True:
		cur = 0
		if a_flag:
			for i in range(len(candies)):
				cur += candies[i]
				a += candies[i]
				if cur > cur_lim:
					cur_lim = cur
					candies = candies[i + 1:]
					break
			else:
				candies = []
		else:
			for i in range(len(candies) - 1, -1, -1):
				cur += candies[i]
				b += candies[i]
				if cur > cur_lim:
					cur_lim = cur
					candies = candies[:i]
					break
			else:
				candies = []
		a_flag = not a_flag
		turns += 1
		if not candies:
			break
	print(turns, a, b)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	al = l[0]
	l.pop(0)
	cn = 0
	cnn = 0
	mv = 1
	bo = 0
	ta = al
	tb = 0
	while len(l) > 0:
		bo = 0
		cn = 0
		cnn = 0
		while bo <= al:
			if len(l) != 0:
				bo += l[len(l) - 1]
				l.pop(len(l) - 1)
				cn = 1
			else:
				break
		if cn == 1:
			mv += 1
		tb += bo
		al = 0
		while al <= bo:
			if len(l) != 0:
				al += l[0]
				l.pop(0)
				cnn = 1
			else:
				break
		if cnn == 1:
			mv += 1
		ta += al
	print(mv, ta, tb)


from collections import deque
T = int(input())
for _ in range(T):
	N = int(input())
	n_moves = 0
	moves = input().split()
	moves = deque([int(move) for move in moves])
	total_a = total_b = 0
	curr_b = 0
	alice_turn = True
	while moves:
		if alice_turn:
			curr_a = moves.popleft()
			while curr_a <= curr_b and moves:
				curr_a += moves.popleft()
			total_a += curr_a
		else:
			curr_b = moves.pop()
			while curr_b <= curr_a and moves:
				curr_b += moves.pop()
			total_b += curr_b
		alice_turn = not alice_turn
		n_moves += 1
	print(n_moves, total_a, total_b)


def candies(n, a):
	ca = 0
	cb = 0
	moves = 0
	s = 0
	l = 0
	last = 0
	current = 0
	while l != n:
		s += a[current]
		if current == 0:
			ca += a[current]
			l += 1
			if s > last:
				moves += 1
				last = s
				s = 0
				current = -1
				del a[0]
			else:
				del a[0]
				if l == n:
					moves += 1
		elif current == -1:
			cb += a[current]
			l += 1
			if s > last:
				moves += 1
				current = 0
				last = s
				s = 0
				a.pop()
			else:
				a.pop()
				if l == n:
					moves += 1
	print(moves, ca, cb)
	return
t = int(input())
a = []
for i in range(t):
	b = int(input())
	c = list(map(int, input().split(' ')))
	a.append([b, c])
for x in a:
	candies(*x)


def solve(n, a):
	players = [[0], [0]]
	current = 0
	alice = 0
	la = 0
	bob = 0
	lb = 0
	alice_turn = True
	ac = -1
	bc = n
	moves = 0
	while ac + 1 < bc:
		t = 0
		if alice_turn:
			while t <= lb and ac + 1 < bc:
				ac += 1
				t += a[ac]
			la = t
			moves += 1
			alice += t
		else:
			while t <= la and ac < bc - 1:
				bc -= 1
				t += a[bc]
			lb = t
			moves += 1
			bob += t
		alice_turn = not alice_turn
	print('{} {} {}'.format(moves, alice, bob))
T = int(input())
for case in range(T):
	solve(int(input()), [int(x) for x in input().split()])


t = int(input())
for i in range(t):
	n = int(input())
	candy = input().split()
	candy = [int(x) for x in candy]
	sum_a = candy[0]
	eat = candy[0]
	candy.pop(0)
	sum_b = 0
	eaten = 0
	j = 1
	while len(candy) != 0:
		j += 1
		eaten = 0
		if j % 2 != 0:
			for i in range(len(candy) - 1, -1, -1):
				eaten += candy[i]
				sum_a += candy[i]
				candy.pop(i)
				if eaten > eat:
					candy = candy[::-1]
					eat = eaten
					break
		else:
			for i in range(len(candy) - 1, -1, -1):
				eaten += candy[i]
				sum_b += candy[i]
				candy.pop(i)
				if eaten > eat:
					candy = candy[::-1]
					eat = eaten
					break
	print(j, sum_a, sum_b, sep=' ')


from __future__ import division, print_function
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 main():
	for tin in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		if n == 1:
			print(1, a[0], 0)
		elif n == 2:
			print(2, a[0], a[1])
		else:
			i = 1
			j = n - 1
			alice = a[i - 1]
			bob = 0
			chance = 0
			s = 1
			x = a[0]
			while i <= j:
				s += 1
				if chance == 1:
					summ = 0
					while i <= j:
						summ += a[i]
						i += 1
						if summ > x:
							break
					alice += summ
					x = summ
				else:
					summ = 0
					while i <= j:
						summ += a[j]
						j -= 1
						if summ > x:
							break
					bob += summ
					x = summ
				chance ^= 1
			print(s, alice, bob)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for q in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	j = n - 1
	ans1 = a[0]
	curr_p = 1
	curr = a[0]
	inc = 0
	ans2 = 0
	moves = 1
	i = 1
	while i <= j:
		if curr_p == 1:
			if inc <= curr:
				inc += a[j]
				j -= 1
			else:
				moves += 1
				curr = inc
				ans2 += inc
				inc = 0
				curr_p = 0
		elif inc <= curr:
			inc += a[i]
			i += 1
		else:
			moves += 1
			curr = inc
			ans1 += inc
			inc = 0
			curr_p = 1
	if inc != 0:
		if curr_p == 1:
			ans2 += inc
			moves += 1
		else:
			ans1 += inc
			moves += 1
	print(moves, ans1, ans2)


tc = int(input())
while tc > 0:
	n = int(input())
	a = list(map(int, input().split()))
	alice = a[0]
	next_alice = a[0]
	bob = 0
	next_bob = 0
	cnt = 1
	i = 0
	j = len(a) - 1
	alice_turn = False
	while i < j:
		if alice_turn:
			next_alice += a[i]
			alice += a[i]
			if next_alice > next_bob:
				next_bob = 0
				alice_turn = False
				j -= 1
				cnt += 1
			else:
				i += 1
		else:
			next_bob += a[j]
			bob += a[j]
			if next_bob > next_alice:
				next_alice = 0
				alice_turn = True
				i += 1
				cnt += 1
			else:
				j -= 1
	if next_bob > 0 and (not alice_turn) or (next_alice > 0 and alice_turn):
		cnt += 1
	print(f'{cnt} {alice} {bob}')
	tc -= 1


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	turn = 0
	previous = 0
	alice = 0
	bob = 0
	moves = 0
	while i <= j:
		size = 0
		if turn == 0:
			while i <= j and size <= previous:
				size += a[i]
				i += 1
			previous = size
			alice += previous
			turn = 1
			moves += 1
		else:
			while i <= j and size <= previous:
				size += a[j]
				j -= 1
			previous = size
			bob += previous
			turn = 0
			moves += 1
	print(moves, alice, bob)


times = int(input())
for i in range(times):
	length = int(input())
	array = input().split()
	num = [int(x) for x in array]
	alice = 0
	bob = 0
	moves = 0
	a = 0
	b = 0
	flag = 0
	while len(num) > 0:
		flag = 0
		alice = 0
		while alice <= bob and len(num) > 0:
			alice = alice + num[0]
			num.pop(0)
			flag = 1
		if flag == 1:
			moves += 1
		flag = 0
		bob = 0
		while bob <= alice and len(num) > 0:
			bob = bob + num[-1]
			num.pop(-1)
			flag = 1
		if flag == 1:
			moves += 1
		a += alice
		b += bob
	print(moves, a, b)


t = int(input())

def fun(n, a):
	al = 0
	bo = 0
	al += a[0]
	del a[0]
	n -= 1
	tu = 1
	mo = 1
	ap = 0
	bp = 0
	ap += al
	while n:
		k1 = al
		k2 = bo
		if tu == 1:
			while ap >= 0 and n:
				bo += a[-1]
				ap -= a[-1]
				del a[-1]
				n -= 1
			mo += 1
			bp = bo - k2
		else:
			while bp >= 0 and n:
				n -= 1
				al += a[0]
				bp -= a[0]
				del a[0]
			mo += 1
			ap = al - k1
		tu += 1
		tu = tu % 2
	print(mo, al, bo)
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	fun(n, a)


t = int(input())
for y in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(a, b, ct, pa, pb) = (0, 0, 0, 0, 0)
	(i, j) = (0, n - 1)
	while i <= j:
		(ca, cb) = (0, 0)
		ct += 1
		while i <= j and ca <= pb:
			ca += l[i]
			i += 1
		if i <= j:
			ct += 1
		while i <= j and cb <= ca:
			cb += l[j]
			j -= 1
		a += ca
		b += cb
		(pa, pb) = (ca, cb)
	print(ct, a, b)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	c = [int(i) for i in input().split()]
	pa = -1
	pb = n
	moves = 0
	lasta = 0
	lastb = 0
	alice = 0
	bob = 0
	turn = 0
	while pa + 1 < pb:
		if turn == 0:
			eat = 0
			while eat <= lastb and pa < pb - 1:
				pa += 1
				eat += c[pa]
			alice += eat
			lasta = eat
		else:
			eat = 0
			while eat <= lasta and pa < pb - 1:
				pb -= 1
				eat += c[pb]
			bob += eat
			lastb = eat
		moves += 1
		turn = 1 - turn
	print(moves, alice, sum(c) - alice)


from collections import deque
for T in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	arr = deque()
	for i in range(n):
		arr.append(d[i])
	ans1 = 0
	ans2 = 0
	moves = 0
	temp = 0
	while arr:
		c0 = 0
		c1 = 0
		if arr:
			moves += 1
			while c0 <= temp:
				if arr:
					a = arr.popleft()
					c0 += a
				else:
					break
		ans1 += c0
		temp = c0
		if arr:
			moves += 1
			while c1 <= temp:
				if arr:
					b = arr.pop()
					c1 += b
				else:
					break
		temp = c1
		ans2 += c1
	print(moves, ans1, ans2)


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	player = 1
	asum = l[0]
	last = l[0]
	bsum = 0
	count = 0
	del l[0]
	while len(l) != 0:
		if player == 0:
			curr = 0
			while curr <= last and len(l) != 0:
				curr = curr + l[0]
				del l[0]
			asum += curr
			count += 1
			last = curr
			player = 1
		else:
			curr = 0
			while curr <= last and len(l) != 0:
				curr = curr + l[-1]
				del l[-1]
			bsum += curr
			count += 1
			last = curr
			player = 0
	print(count + 1, asum, bsum)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(i, j) = (1, n - 1)
	f = 1
	x = a[0]
	y = 0
	m = 0
	(c1, c2) = (a[0], 0)
	while i <= j:
		if f:
			y = 0
			while i <= j and y <= x:
				y += a[j]
				j -= 1
			m += 1
			f ^= 1
			c2 += y
		else:
			x = 0
			while i <= j and y >= x:
				x += a[i]
				i += 1
			m += 1
			f ^= 1
			c1 += x
	print(m + 1, c1, c2)


T = int(input())
while T:
	n = int(input())
	A = list(map(int, input().split()))
	i = 1
	j = n - 1
	a = A[0]
	b = 0
	ap = A[0]
	bp = 0
	f = 1
	c = 1
	while i <= j:
		c = c + 1
		if f == 1:
			bp = 0
			while bp <= ap and j >= i:
				bp = bp + A[j]
				j = j - 1
				f = 0
			b = b + bp
		else:
			ap = 0
			while ap <= bp and j >= i:
				ap = ap + A[i]
				i = i + 1
				f = 1
			a = a + ap
	print(c, a, b)
	T = T - 1


import sys
input = lambda : sys.stdin.readline().rstrip()

def pin(type=int):
	return map(type, input().split())

def tupin(t=int):
	return tuple(pin(t))
from collections import deque

def solve():
	n = int(input())
	dq = deque(pin())
	turn = 0
	fn = [dq.popleft, dq.pop]
	current = 0
	maxsize = 0
	ab = [0] * 2
	for i in range(1000):
		current = 0
		while current <= maxsize:
			t = fn[turn % 2]()
			ab[turn % 2] += t
			current += t
			if len(dq) == 0:
				print(turn + 1, *ab)
				return
		maxsize = current
		turn += 1

def resolve():
	q = int(input())
	for j in range(q):
		solve()
	print()
resolve()


def run():
	N = int(input())
	data = list(map(int, input().split()))
	turn = 0
	n_turn = 0
	ans = [0, 0]
	idx_l = 0
	idx_r = len(data)
	curr = 0
	prev_l = 0
	prev_r = 0
	while idx_l < idx_r:
		curr = 0
		if turn == 0:
			prev = prev_r
			idx = idx_l
			diff = 1
			diff_l = 1
			diff_r = 0
		else:
			prev = prev_l
			idx = idx_r - 1
			diff = -1
			diff_l = 0
			diff_r = -1
		while idx_l < idx_r and curr <= prev:
			curr += data[idx]
			ans[turn] += data[idx]
			idx += diff
			idx_l += diff_l
			idx_r += diff_r
		if turn == 0:
			prev_l = curr
		else:
			prev_r = curr
		turn = 1 - turn
		n_turn += 1
	print(n_turn, ans[0], ans[1])
T = int(input())
for i in range(T):
	run()


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	i = 0
	j = n - 1
	alcur = 0
	bobcur = 0
	sumal = 0
	sumbob = 0
	steps = 0
	while 1:
		if i > j:
			break
		alcur = 0
		steps += 1
		while alcur <= bobcur:
			if i > j:
				break
			alcur += A[i]
			i += 1
		sumal += alcur
		if i > j:
			break
		steps += 1
		bobcur = 0
		while bobcur <= alcur:
			if i > j:
				break
			bobcur += A[j]
			j -= 1
		sumbob += bobcur
		if i > j:
			break
	print(steps, sumal, sumbob)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	a = li()
	i = 0
	j = n - 1
	(c, d) = (0, 0)
	p = 1
	(x, y) = (0, 0)
	ans = 0
	while True:
		if p:
			p = 0
			k = 0
			while i < n and a[i] != 0 and (k <= d):
				k += a[i]
				a[i] = 0
				i += 1
			if i == n or a[i] == 0:
				ans += 1
				x += k
				break
			else:
				c = k
				x += k
		else:
			p = 1
			k = 0
			while j >= 0 and a[j] != 0 and (k <= c):
				k += a[j]
				a[j] = 0
				j -= 1
			if a[j] == 0:
				y += k
				ans += 1
				break
			else:
				d = k
				y += k
		ans += 1
	print(ans, x, y)
for _ in range(int(input())):
	case()


for testcase in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	turns = alice = bob = last = 0
	while i <= j:
		turns += 1
		eat = 0
		if turns & 1:
			while i <= j:
				eat += arr[i]
				i += 1
				if eat > last:
					break
			alice += eat
		else:
			while i <= j:
				eat += arr[j]
				j -= 1
				if eat > last:
					break
			bob += eat
		last = eat
	print(turns, alice, bob)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	n = 0
	l = list(map(int, input().split()))
	a = 0
	b = 0
	a1 = 0
	b1 = 0
	while len(l) > 0:
		a1 = 0
		n += 1
		while a1 <= b1 and len(l) > 0:
			a1 += l[0]
			l.pop(0)
		a += a1
		if len(l) == 0:
			break
		b1 = 0
		n += 1
		while b1 <= a1 and len(l) > 0:
			b1 += l[-1]
			l.pop(-1)
		b += b1
	print(n, a, b)


for _ in range(int(input())):
	n = int(input())
	candies = [int(__) for __ in input().split()]
	a_current = 0
	b_current = 0
	a_total = 0
	b_total = 0
	moves = 0
	while len(candies) > 0:
		while a_current <= b_current and len(candies) > 0:
			a_current += candies.pop(0)
		a_total += a_current
		b_current = 0
		if a_current > 0:
			moves += 1
		while b_current <= a_current and len(candies) > 0:
			b_current += candies.pop(-1)
		b_total += b_current
		a_current = 0
		if b_current > 0:
			moves += 1
	print(moves, a_total, b_total)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	prev = 0
	t = 0
	al = 0
	b = 0
	while n > 0:
		if prev != 0:
			turn = t % 2
			s = 0
			if turn == 0:
				while s <= prev:
					if n == 0:
						break
					num = a.pop(0)
					al += num
					s += num
					n -= 1
			elif turn == 1:
				while s <= prev:
					if n == 0:
						break
					num = a.pop(-1)
					b += num
					s += num
					n -= 1
			prev = s
		else:
			al += a.pop(0)
			n -= 1
			prev = al
		t += 1
	print(t, al, b)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	prefSum = [arr[0]]
	for i in range(1, n):
		prefSum.append(prefSum[i - 1] + arr[i])
	a = arr[0]
	b = 0
	ind = 1
	lInd = n - 1
	step = True
	last = arr[0]
	was = 1
	while lInd >= ind:
		s = 0
		if step:
			for i in range(lInd, ind - 1, -1):
				s += arr[i]
				if s > last:
					lInd = i - 1
					break
			else:
				lInd = ind - 1
			b += s
		else:
			for i in range(ind, lInd + 1):
				s += arr[i]
				if s > last:
					ind = i + 1
					break
			else:
				ind = lInd + 1
			a += s
		last = s
		step = not step
		was += 1
	print(was, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	sumL = 0
	sumR = 0
	fl = 0
	A = 0
	B = 0
	cnt = 0
	while l <= r:
		if fl == 0 and sumL <= sumR:
			sumL += a[l]
			l += 1
		elif fl == 0 and sumL > sumR:
			fl = 1
			B += sumR
			sumR = 0
			cnt += 1
		elif fl == 1 and sumR <= sumL:
			sumR += a[r]
			r -= 1
		else:
			fl = 0
			A += sumL
			sumL = 0
			cnt += 1
	A += sumL
	B += sumR
	cnt += 1
	print(cnt, A, B)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	move = 0
	alice = 0
	bob = 0
	eat = 0
	flag = True
	while len(a) != 0:
		if flag:
			ate = 0
			while eat >= ate and len(a) != 0:
				ate += a.pop(0)
			alice += ate
			eat = ate
			flag = False
		else:
			ate = 0
			while eat >= ate and len(a) != 0:
				ate += a.pop()
			bob += ate
			eat = ate
			flag = True
		move += 1
	print(move, alice, bob)


import itertools
t = int(input())
for i in range(t):
	n = int(input())
	L = list(map(int, input().split()))
	R = list(reversed(L))
	L_ac = [0] + list(itertools.accumulate(L))
	R_ac = [0] + list(itertools.accumulate(R))
	cnt = 0
	r = 0
	l = 0
	jdg = 0
	alice = 0
	bob = 0
	Max = L_ac[-1]
	while alice + bob < Max:
		if cnt % 2 == 0:
			for i in range(n + 1):
				if L_ac[l + i] - L_ac[l] >= Max - bob - alice:
					cnt += 1
					l = l + i
					alice = L_ac[l]
					break
				elif L_ac[l + i] - L_ac[l] > jdg:
					jdg = L_ac[l + i] - L_ac[l]
					cnt += 1
					l = l + i
					alice = L_ac[l]
					break
		else:
			for i in range(n + 1):
				if R_ac[r + i] - R_ac[r] >= Max - bob - alice:
					cnt += 1
					r = r + i
					bob = R_ac[r]
					break
				elif R_ac[r + i] - R_ac[r] > jdg:
					jdg = R_ac[r + i] - R_ac[r]
					cnt += 1
					r = r + i
					bob = R_ac[r]
					break
	print(cnt, alice, bob)


def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	totA = lst[0]
	totB = 0
	pA = lst[0]
	pB = 0
	l = 0
	r = n
	mv = 1
	dA = []
	dB = []
	while l < r:
		if mv % 2 == 1:
			sm = 0
			while sm <= pA and l < r:
				r -= 1
				if r <= l:
					break
				sm += lst[r]
				dA.append(r)
			mv += sm != 0
			totB += sm
			pB = sm
		else:
			sm = 0
			while sm <= pB and l < r:
				l += 1
				if l >= r:
					break
				sm += lst[l]
				dB.append(l)
			mv += sm != 0
			totA += sm
			pA = sm
	print(mv, totA, totB)
	return
t = 1
t = int(input())
while t > 0:
	t -= 1
	solve()


j = int(input())
for i in range(j):
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	cnt = 0
	l = 0
	r = n - 1
	suml = 0
	sumr = 0
	ansl = 0
	ansr = 0
	while l <= r:
		if cnt % 2 == 0:
			nsuml = 0
			while l <= r and nsuml <= sumr:
				nsuml += a[l]
				l += 1
			ansl += nsuml
			suml = nsuml
			cnt += 1
		else:
			nsumr = 0
			while l <= r and nsumr <= suml:
				nsumr += a[r]
				r -= 1
			ansr += nsumr
			sumr = nsumr
			cnt += 1
	print(cnt, ansl, ansr)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = int(input())
for __ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(nm, a, b) = (1, 0, 0)
	cnt = 0
	(i, j) = (1, n - 1)
	a = l[0]
	cnt = 1
	pre = l[0]
	nex = 0
	ch = 0
	while cnt < n:
		if ch % 2 == 0:
			while j >= i and nex <= pre:
				nex += l[j]
				b += l[j]
				j -= 1
				cnt += 1
			pre = nex
			nex = 0
			nm += 1
		else:
			while i <= j and nex <= pre:
				nex += l[i]
				a += l[i]
				i += 1
				cnt += 1
			pre = nex
			nex = 0
			nm += 1
		ch += 1
	print(nm, a, b)


import math

def fact(a, b):
	ans = 1
	for i in range(a, b + 1):
		ans *= i
	return str(ans) - 1

def comb(n, c):
	return fact(n) // (fact(n - c) * c)
for _ in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	if n == 1:
		print(1, nums[0], 0)
	else:
		lst = 1
		a = 0
		b = 0
		tmp = 0
		p1 = 0
		p2 = n - 1
		ok = True
		m = 0
		while ok:
			while tmp < lst:
				a += nums[p1]
				tmp += nums[p1]
				p1 += 1
				if p1 == p2 + 1:
					ok = False
					m += 1
					break
			if not ok:
				break
			m += 1
			lst = int(tmp) + 1
			tmp = 0
			while tmp < lst:
				b += nums[p2]
				tmp += nums[p2]
				p2 -= 1
				if p1 - 1 == p2:
					ok = False
					m += 1
					break
			if not ok:
				break
			m += 1
			lst = int(tmp) + 1
			tmp = 0
		print(m, a, b)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	alice = 0
	bob = 0
	i = 0
	j = n - 1
	prev = 0
	turn = False
	cnt = 0
	while i <= j:
		cnt += 1
		cur = 0
		if not turn:
			while cur <= prev and i <= j:
				cur += a[i]
				i += 1
			alice += cur
		else:
			while cur <= prev and i <= j:
				cur += a[j]
				j -= 1
			bob += cur
		turn = not turn
		prev = cur
	print(cnt, alice, bob)
	t -= 1


t = int(input())
for _ in range(t):
	input()
	a = list(map(int, input().split()))
	alice = 0
	bob = len(a) - 1
	ta = 0
	tb = 0
	le = 0
	st = 0
	flog = False
	while alice <= bob:
		if st % 2 == 0:
			t = 0
			while t <= le:
				ta += a[alice]
				t += a[alice]
				alice += 1
				if alice > bob:
					break
			le = t
		else:
			t = 0
			while t <= le:
				tb += a[bob]
				t += a[bob]
				bob -= 1
				if alice > bob:
					break
			le = t
		st += 1
	print(str(st) + ' ' + str(ta) + ' ' + str(tb))


from collections import deque
for _ in range(int(input())):
	n = int(input())
	candy = deque(map(int, input().split()))
	moves = 1
	a = candy.popleft()
	b = 0
	current = a
	while candy:
		temp = 0
		while candy and temp <= current:
			last = candy.pop()
			temp += last
			b += last
		if temp > 0:
			moves += 1
		current = temp
		temp = 0
		while candy and temp <= current:
			first = candy.popleft()
			temp += first
			a += first
		if temp > 0:
			moves += 1
		current = temp
	print(moves, a, b)


from collections import deque
t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = deque(a)
	(alice, bob) = (0, 0)
	total_alice = 0
	total_bob = 0
	p = 0
	move = 0
	while a:
		if p == 0:
			alice += a.popleft()
			if alice > bob:
				move += 1
				p = 1
				total_alice += alice
				bob = 0
		else:
			bob += a.pop()
			if bob > alice:
				move += 1
				p = 0
				total_bob += bob
				alice = 0
	if p == 0 and alice:
		move += 1
		total_alice += alice
		alice = 0
	if p == 1 and bob:
		move += 1
		total_bob += bob
	print(move, total_alice, total_bob)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	i = 1
	j = n - 1
	al = a[0]
	b = 0
	ap = a[0]
	bp = 0
	c = 1
	while i <= j:
		bp = 0
		while i <= j and bp <= ap:
			bp += a[j]
			j -= 1
		c += 1
		b = b + bp
		if i > j:
			break
		ap = 0
		while i <= j and ap <= bp:
			ap += a[i]
			i += 1
		al = al + ap
		c += 1
	print(c, al, b)


from collections import deque
t = int(input())
for x in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	d = deque()
	for x in A:
		d.append(x)
	turn = 0
	count = 0
	previous_a = 0
	previous_b = 0
	sum_a = 0
	sum_b = 0
	while True:
		alice = 0
		bob = 0
		if turn == 0:
			if len(d) > 0:
				while alice <= previous_b:
					if len(d) > 0:
						alice += d.popleft()
					else:
						break
				sum_a += alice
				previous_a = alice
				if alice == 0:
					break
				count += 1
				turn = 1
			else:
				break
		if turn == 1:
			if len(d) > 0:
				while bob <= previous_a:
					if len(d) > 0:
						bob += d.pop()
					else:
						break
				sum_b += bob
				previous_b = bob
				if bob == 0:
					break
				count += 1
				turn = 0
			else:
				break
	print(count, sum_a, sum_b)


import copy
import collections
t = int(input())
for T in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	dq = collections.deque(a)
	a = 0
	b = 0
	moves = 0
	last = 0
	AB = 1
	while dq:
		moves += 1
		if AB == 1:
			eat = 0
			while dq and eat <= last:
				eat += dq.popleft()
			a += eat
			last = eat
		else:
			eat = 0
			while dq and eat <= last:
				eat += dq.pop()
			b += eat
			last = eat
		AB *= -1
	print(moves, a, b)


from sys import stdin
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	(*arr,) = map(int, input().split())
	(i, j) = (0, n - 1)
	s1 = s2 = c = cnt = a = b = 0
	while i <= j:
		if c:
			b = 0
			while i <= j and b <= a:
				b += arr[j]
				j -= 1
			s2 += b
		else:
			a = 0
			while i <= j and a <= b:
				a += arr[i]
				i += 1
			s1 += a
		cnt += 1
		c ^= 1
	print(cnt, s1, s2)


t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	(a, b) = (0, 0)
	steps = 0
	just_ate = [0, 0]
	cur_ate = [0, 0]
	to_go = 0
	next_to_eat = [0, n - 1]
	while next_to_eat[0] <= next_to_eat[1]:
		ate = False
		while cur_ate[0] <= just_ate[1] and next_to_eat[0] <= next_to_eat[1]:
			ate = True
			cur_ate[0] += c[next_to_eat[0]]
			a += c[next_to_eat[0]]
			next_to_eat[0] += 1
		if ate:
			steps += 1
		just_ate[0] = cur_ate[0]
		cur_ate[0] = 0
		ate = False
		while cur_ate[1] <= just_ate[0] and next_to_eat[0] <= next_to_eat[1]:
			ate = True
			cur_ate[1] += c[next_to_eat[1]]
			b += c[next_to_eat[1]]
			next_to_eat[1] -= 1
		if ate:
			steps += 1
		just_ate[1] = cur_ate[1]
		cur_ate[1] = 0
	print(steps, a, b)


import itertools as it
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ia = 0
	ib = len(a)
	turns = 0
	a_thrsh = 0
	b_thrsh = 0
	for turns in it.count():
		if ia == ib:
			turns = turns * 2
			break
		a_sum = 0
		while a_sum <= a_thrsh and ia < ib:
			a_sum += a[ia]
			ia += 1
		b_thrsh = a_sum
		if ia == ib:
			turns = turns * 2 + 1
			break
		b_sum = 0
		while b_sum <= b_thrsh and ia < ib:
			ib -= 1
			b_sum += a[ib]
		a_thrsh = b_sum
	print(turns, sum(a[:ia]), sum(a[ia:]))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(l, r) = (0, n)
	(curra, currb) = (a[0], 0)
	(suma, sumb) = (a[0], 0)
	c = 1
	while l < r - 1 and c < n:
		if c % 2 == 0:
			curra = 0
			while curra <= currb and l < r - 1:
				l += 1
				suma += a[l]
				curra += a[l]
		else:
			currb = 0
			while currb <= curra and l < r - 1:
				r -= 1
				sumb += a[r]
				currb += a[r]
		c += 1
	print(c, suma, sumb)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	i = 0
	p = 0
	c = 0
	a = 0
	b = 0
	j = n - 1
	f = 1
	while i < n and j >= 0 and (i <= j):
		if f:
			while s <= p and i < n and (i <= j):
				s += l[i]
				i += 1
				f = 0
			p = 0
		else:
			while p <= s and j >= 0 and (j >= i):
				p += l[j]
				j -= 1
				f = 1
			s = 0
		a += s
		b += p
		c += 1
	print(c, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s1 = s2 = 0
	r1 = r2 = 0
	k = 0
	while a != []:
		k += 1
		while a != [] and s2 <= s1:
			s2 += a[0]
			if len(a) > 1:
				a = a[1:]
			else:
				a = []
		r1 += s2
		s1 = s2
		s2 = 0
		if a == []:
			break
		k += 1
		while a != [] and s2 <= s1:
			s2 += a[-1]
			if len(a) > 1:
				a = a[:-1]
			else:
				a = []
		r2 += s2
		s1 = s2
		s2 = 0
	print(k, r1, r2)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(alice, bob, done) = (0, 0, 1)
	(alice_tot, bob_tot) = (arr[0], 0)
	alice = arr[0]
	(start, end) = (1, n - 1)
	while start <= end:
		if done % 2 != 0:
			for i in range(end, start - 1, -1):
				if bob <= alice:
					bob += arr[i]
					end -= 1
				else:
					break
			bob_tot += bob
			alice = 0
		else:
			for i in range(start, end + 1):
				if alice <= bob:
					alice += arr[i]
					start += 1
				else:
					break
			alice_tot += alice
			bob = 0
		done += 1
	print(done, alice_tot, bob_tot)


t = int(input())
for i in range(t):
	(n, s, a, b, i, j, k, x, y) = (int(input()), input().split(), 0, 0, 0, 1, 0, 0, 0)
	while i + j < n + 1:
		while b >= a and i + j < n + 1:
			(a, i) = (a + int(s[i]), i + 1)
		(b, x, k) = (0, x + a, k + 1)
		if i + j >= n + 1:
			break
		while a >= b and i + j < n + 1:
			(b, j) = (b + int(s[-j]), j + 1)
		(a, y, k) = (0, y + b, k + 1)
		if i + j >= n + 1:
			break
	print(str(k) + ' ' + str(x) + ' ' + str(y))


t = int(input())
out = []
for i in range(t):
	n = int(input())
	candies = [int(a) for a in input().split(' ')]
	b = 0
	a_prev = 0
	b_prev = 0
	flag = 1
	a = candies[0]
	a_prev = a
	del candies[0]
	moves = 1
	while len(candies):
		if flag == 0:
			a_prev = 0
			moves += 1
			while a_prev <= b_prev and len(candies):
				a_prev += candies[0]
				del candies[0]
			a += a_prev
			flag = 1
		else:
			b_prev = 0
			moves += 1
			while b_prev <= a_prev and len(candies):
				b_prev += candies[-1]
				candies.pop()
			b += b_prev
			flag = 0
	out.append((moves, a, b))
for (mov, a, b) in out:
	print(mov, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	sb = 0
	count = 1
	a = arr.pop(0)
	sa = a
	b = 0
	while len(arr) != 0:
		if a > b:
			b = 0
			while b < a + 1:
				b += arr[len(arr) - 1]
				arr.pop()
				if len(arr) == 0:
					break
			sb += b
		else:
			a = 0
			while a < b + 1:
				a += arr[0]
				arr.pop(0)
				if len(arr) == 0:
					break
			sa += a
		count += 1
	print(count, sa, sb)


def candies(a, n):
	if n == 1:
		print('1', a[0], '0')
		return
	e = 0
	m1 = 0
	m2 = 0
	m = 0
	p = n - 1
	i = 0
	while i <= p and p >= 0:
		d = 0
		while i <= p:
			if a[i] + d > e or i == p:
				m1 = m1 + d + a[i]
				m = m + 1
				e = a[i] + d
				break
			d = d + a[i]
			i = i + 1
		d = 0
		i = i + 1
		while p >= i:
			if a[p] + d > e or p == i:
				m2 = m2 + a[p] + d
				m = m + 1
				e = a[p] + d
				break
			d = d + a[p]
			p = p - 1
		p = p - 1
	print(m, m1, m2)
	return
t = int(input())
for i in range(t):
	n = int(input())
	T = input()
	l = list(map(int, T.split()))
	candies(l, n)


for _ in range(int(input())):
	n = int(input())
	v = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	(curra, currb, a, b, move) = (0,) * 5
	while i <= j:
		curra = 0
		while curra <= currb and i <= j:
			curra += v[i]
			i += 1
		if curra > 0:
			move += 1
		a += curra
		currb = 0
		while curra >= currb and i <= j:
			currb += v[j]
			j -= 1
		if currb > 0:
			move += 1
		b += currb
	print(' '.join((str(x) for x in [move, a, b])))


import math
import sys
from collections import defaultdict, Counter, deque, OrderedDict
import bisect
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]
from itertools import accumulate, groupby
import sys
for _ in range(int(input())):
	N = int(input())
	A = deque(ilele())
	a = 0
	b = 0
	turn = 0
	moves = 0
	c = 0
	d = 0
	if N == 1:
		print(1, A[0], 0)
	else:
		while len(A) > 0:
			temp = turn
			if turn == 0:
				x = A.popleft()
				a += x
				c += x
				if c > d:
					turn = 1
					d = 0
				if c <= d and len(A) == 0:
					moves += 1
			elif turn == 1:
				x = A.pop()
				b += x
				d += x
				if d > c:
					turn = 0
					c = 0
				if d <= c and len(A) == 0:
					moves += 1
			if temp != turn:
				moves += 1
		print(moves, a, b)


t = 1
t = int(input())

def solve():
	n = int(input())
	aa = list(map(int, input().split()))
	pi = 0
	pj = n - 1
	mov = 0
	cpr = bpr = a = b = 0
	while pi - pj < 1:
		mov += 1
		if mov % 2 == 1:
			ceat = 0
			while ceat <= bpr and pi - pj < 1:
				ceat += aa[pi]
				pi += 1
			cpr = ceat
			a += ceat
		if mov % 2 == 0:
			beat = 0
			while beat <= cpr and pi - pj < 1:
				beat += aa[pj]
				pj -= 1
			bpr = beat
			b += beat
	if n == 1:
		a = aa[0]
		b = 0
		mov = 1
	print(mov, a, b)
for xx in range(t):
	solve()


numcases = int(input())
for i in range(numcases):
	n = int(input())
	arr = list(map(int, input().split()))
	a = 0
	b = 0
	count = 0
	curr = 0
	last = 0
	turn = 0
	while arr:
		count += 1
		if turn == 0:
			while curr <= last:
				curr = curr + arr[0]
				arr.pop(0)
				if not arr:
					break
			a = a + curr
			last = curr
			curr = 0
			turn = 1
		else:
			while curr <= last:
				curr = curr + arr[-1]
				arr.pop()
				if not arr:
					break
			b = b + curr
			last = curr
			curr = 0
			turn = 0
	print(count, a, b)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	A = Scanner.map_int()
	alice = 0
	bob = 0
	prev = 0
	cnt = 0
	ai = 0
	bi = N - 1
	while ai < N and bi >= 0 and (A[ai] != 0) and (A[bi] != 0):
		n = 0
		if cnt % 2 == 0:
			while n <= prev:
				n += A[ai]
				A[ai] = 0
				ai += 1
				if ai >= N or A[ai] == 0:
					break
			prev = n
			alice += n
		else:
			while n <= prev:
				n += A[bi]
				A[bi] = 0
				bi -= 1
				if bi < 0 or A[bi] == 0:
					break
			prev = n
			bob += n
		cnt += 1
	print(cnt, alice, bob, sep=' ')

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


o = []
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(l, r, sl, sr, c, al, ar) = (0, n - 1, 0, 0, 0, 0, 0)
	while l <= r:
		if c % 2 < 1:
			nsl = 0
			while l <= r and nsl <= sr:
				nsl += a[l]
				l += 1
			al += nsl
			sl = nsl
		else:
			nsr = 0
			while l <= r and nsr <= sl:
				nsr += a[r]
				r -= 1
			ar += nsr
			sr = nsr
		c += 1
	o.append(str(c) + ' ' + str(al) + ' ' + str(ar))
print(*o, sep='\n')


import sys
ints = (int(x) for x in sys.stdin.read().split())
sys.setrecursionlimit(3000)

def main():
	ntc = next(ints)
	for tc in range(ntc):
		n = next(ints)
		a = [next(ints) for i in range(n)]
		turn = 1
		i = 1
		j = n
		l = L = a[0]
		r = R = 0
		while i < j:
			if turn % 2 == 0:
				l = 0
				while i < j and l <= r:
					l += a[i]
					i += 1
				L += l
			else:
				r = 0
				while i < j and r <= l:
					j -= 1
					r += a[j]
				R += r
			turn += 1
		print(turn, L, R)
	return
main()


from collections import deque
for _ in range(int(input())):
	a = 0
	b = 0
	ans = 0
	n = int(input())
	l = deque(map(int, input().split()))
	pers = True
	prev = 0
	while sum(l) >= prev:
		if pers:
			s = 0
			while len(l) > 0 and s <= prev:
				s += l.popleft()
			prev = s
			a += s
			pers = False
		else:
			s = 0
			while len(l) > 0 and s <= prev:
				s += l.pop()
			prev = s
			b += s
			pers = True
		ans += 1
	if sum(l) > 0:
		ans += 1
		if pers:
			a += sum(l)
		else:
			b += sum(l)
	print(ans, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	alices_turn = False
	rem_arr_left = 1
	rem_arr_right = n - 1
	a = arr[0]
	b = 0
	last_move = arr[0]
	counter = 1
	while rem_arr_right >= rem_arr_left:
		counter += 1
		if alices_turn:
			new_consumption = 0
			while new_consumption <= last_move and rem_arr_left <= rem_arr_right:
				new_consumption += arr[rem_arr_left]
				rem_arr_left += 1
			a += new_consumption
		else:
			new_consumption = 0
			while new_consumption <= last_move and rem_arr_left <= rem_arr_right:
				new_consumption += arr[rem_arr_right]
				rem_arr_right -= 1
			b += new_consumption
		alices_turn = not alices_turn
		last_move = new_consumption
	print('{} {} {}'.format(counter, a, b))


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	cur_a = 0
	cur_b = 0
	last_a = 0
	last_b = 0
	Alice = 0
	Bob = 0
	while len(a) != 0:
		Ar = 1
		cur_a = sum(a[0:Ar])
		while cur_a <= last_b:
			Ar += 1
			cur_a = sum(a[0:Ar])
			if len(a[0:Ar]) == len(a):
				break
		Alice += cur_a
		last_a = cur_a
		del a[0:Ar]
		if len(a) != 0:
			cnt += 1
		Bl = len(a) - 1
		cur_b = sum(a[Bl:len(a)])
		while cur_b <= last_a:
			Bl -= 1
			cur_b = sum(a[Bl:len(a)])
			if len(a[Bl:len(a)]) == len(a):
				break
		Bob += cur_b
		last_b = cur_b
		del a[Bl:len(a)]
		if len(a) != 0:
			cnt += 1
	print(cnt + 1, Alice, Bob)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	anz_b = 0
	sum_b = 0
	steps = 0
	anz_a = a.pop(0)
	sum_a = anz_a
	n -= 1
	player = 'Bob'
	steps += 1
	while n > 0:
		if player == 'Alice':
			done = False
			while done == False:
				anz_a += a.pop(0)
				n -= 1
				if anz_a > anz_b or n == 0:
					done = True
			sum_a += anz_a
			steps += 1
			player = 'Bob'
			anz_b = 0
		else:
			done = False
			while done == False:
				anz_b += a.pop()
				n -= 1
				if anz_b > anz_a or n == 0:
					done = True
			sum_b += anz_b
			steps += 1
			player = 'Alice'
			anz_a = 0
	print(steps, sum_a, sum_b)


for _ in range(int(input())):
	n = int(input())
	c = [int(i) for i in input().split()]
	a = b = 0
	pa = 0
	pb = n - 1
	t = m = 0
	f = False
	while pa <= pb:
		l = t
		t = 0
		m += 1
		if not f:
			while t <= l and pa <= pb:
				t += c[pa]
				pa += 1
			a += t
		else:
			while t <= l and pa <= pb:
				t += c[pb]
				pb -= 1
			b += t
		f = not f
	print(m, a, b)


import sys
input = sys.stdin.readline
import bisect
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	sa = 0
	sb = 0
	ssa = 0
	ssb = 0
	cou = 0
	lol = 0
	while i <= j:
		if cou % 2 == 1:
			while sb <= sa and i <= j:
				sb += l[j]
				j -= 1
			if sb <= sa:
				lol = 1
			sa = 0
		else:
			while sa <= sb and i <= j:
				sa += l[i]
				i += 1
			if sa <= sb:
				lol = 1
			sb = 0
		cou += 1
		ssa += sa
		ssb += sb
		if lol == 1:
			break
	print(cou, ssa, sum(l) - ssa)
	t -= 1


R1 = lambda : list(map(int, input().split()))
R2 = lambda : int(input())
for _ in range(R2()):
	(k, a) = (R2(), R1())
	(i, j) = (0, k - 1)
	l = 0
	x = y = z = 0
	while i <= j:
		c = 0
		while i <= j and c <= l:
			c += a[i]
			i += 1
		z += 1
		x += c
		l = c
		if i > j:
			break
		c = 0
		while i <= j and c <= l:
			c += a[j]
			j -= 1
		z += 1
		y += c
		l = c
	print(z, x, y)


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)


t = int(input())
for _ in range(t):
	n = int(input())
	B = list(input().split(' '))
	A = [int(x) for x in B]
	A_C = 0
	A_T = 0
	B_C = 0
	B_T = 0
	moves = 0
	while len(A) > 0:
		a = A[0]
		A_C = A[0]
		A_T += A[0]
		A.pop(0)
		while a <= B_C and len(A) > 0:
			a += A[0]
			A_C += A[0]
			A_T += A[0]
			A.pop(0)
		if a > B_C:
			moves += 1
		else:
			moves += 1
			break
		if len(A) == 0:
			break
		b = A[-1]
		B_C = A[-1]
		B_T += A[-1]
		A.pop(-1)
		while b <= A_C and len(A) > 0:
			b += A[-1]
			B_C += A[-1]
			B_T += A[-1]
			A.pop(-1)
		if b > A_C:
			moves += 1
		else:
			moves += 1
			break
		if len(A) == 0:
			break
	print(moves, A_T, B_T)


from sys import stdin, stdout
t = int(stdin.readline().rstrip())

def main():
	n = int(stdin.readline().rstrip())
	a = list(map(int, stdin.readline().strip().split()))
	(posA, posB) = (0, n - 1)
	(totA, totB) = (0, 0)
	(prev, now) = (0, 0)
	turn = 0
	totturn = 0
	while posA <= posB:
		if turn == 0:
			now += a[posA]
			totA += a[posA]
			posA += 1
		else:
			now += a[posB]
			totB += a[posB]
			posB -= 1
		if now > prev:
			prev = now
			now = 0
			turn = 1 - turn
			totturn += 1
	if now != 0:
		totturn += 1
	stdout.write('{} {} {}\n'.format(totturn, totA, totB))
for i in range(t):
	main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = 0
	i = 0
	(a1, b1) = (0, 0)
	while l:
		if i % 2 == 0:
			a1 = 0
			while not b1 < a1:
				if l:
					a1 += l.pop(0)
				else:
					break
			a += a1
		else:
			b1 = 0
			while not b1 > a1:
				if l:
					b1 += l.pop()
				else:
					break
			b += b1
		i += 1
	print(i, a, b)


from collections import deque
n = int(input())
for i in range(n):
	x = int(input())
	l = deque(list(map(int, input().split())))
	if x == 1:
		print(1, l[0], 0)
	elif x == 2:
		print(2, l[0], l[-1])
	else:
		c1 = 0
		al = 0
		bob = 0
		c = 0
		m = max(al, bob)
		if len(l) != 0:
			while len(l) != 0:
				c1 = c1 + 1
				if al <= bob:
					while c <= m:
						if len(l) == 0:
							break
						c = c + l.popleft()
					al = al + c
					m = c
					c = 0
				elif bob < al:
					while c <= m:
						if len(l) == 0:
							break
						c = c + l.pop()
					bob = bob + c
					m = c
					c = 0
			print(c1, al, bob)


t = int(input())
for i in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	(a, b) = (0, 0)
	(l, r) = (1, n - 1)
	isAlice = False
	a += ls[0]
	cur = ls[0]
	cnt = 1
	while l <= r:
		if isAlice:
			ccur = 0
			while l <= r and ccur <= cur:
				ccur += ls[l]
				l += 1
			a += ccur
		else:
			ccur = 0
			while l <= r and ccur <= cur:
				ccur += ls[r]
				r -= 1
			b += ccur
		cnt += 1
		isAlice = not isAlice
		cur = ccur
	print(cnt, a, b)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	q = deque(map(int, input().split()))
	turns = 1
	a = q[0]
	b = 0
	prev = q[0]
	whoseTurn = True
	q.popleft()
	while len(q) != 0:
		val = 0
		if whoseTurn:
			while len(q) != 0 and val <= prev:
				val += q[-1]
				q.pop()
			b += val
		else:
			while len(q) != 0 and val <= prev:
				val += q[0]
				q.popleft()
			a += val
		prev = val
		turns += 1
		whoseTurn = not whoseTurn
	print(turns, a, b)


def front(a1, size1, size2, size11):
	size1 = 0
	while len(a1) > 0:
		if size1 > size2:
			break
		else:
			size1 += a1[0]
			size11 += a1[0]
			a1.pop(0)
	return (a1, size1, size2, size11)

def back(a1, size1, size2, size22):
	size2 = 0
	while len(a1) > 0:
		if size2 > size1:
			break
		else:
			size2 += a1[-1]
			size22 += a1[-1]
			a1.pop(-1)
	return (a1, size1, size2, size22)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	size1 = 0
	size2 = 0
	p1 = 0
	size11 = 0
	size22 = 0
	while len(a) > 0:
		if size1 == 0:
			(a, size1, size2, size11) = front(a, size1, size2, size11)
			p1 += 1
		elif size1 < size2:
			(a, size1, size2, size11) = front(a, size1, size2, size11)
			p1 += 1
		else:
			(a, size1, size2, size22) = back(a, size1, size2, size22)
			p1 += 1
	print(p1, size11, size22)


t = input()
for _ in range(int(t)):
	n = int(input())
	a = input().split()
	a = [int(i) for i in a]
	ansa = ansb = suma = sumb = mov = 0
	i = 0
	j = n - 1
	flag = 0
	while flag != 1:
		suma = 0
		while i <= j:
			suma += a[i]
			i += 1
			if suma > sumb:
				mov += 1
				ansa += suma
				if i > j:
					flag = 1
				break
			if i > j:
				mov += 1
				ansa += suma
				flag = 1
				break
		if flag == 1:
			break
		sumb = 0
		while j >= i:
			sumb += a[j]
			j = j - 1
			if sumb > suma:
				mov += 1
				ansb += sumb
				if j < i:
					flag = 1
				break
			if j < i:
				flag = 1
				mov += 1
				ansb += sumb
				break
		if flag == 1:
			break
	print(f'{mov} {ansa} {ansb}')


T = int(input())
from itertools import accumulate
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(1, a[0], 0)
		continue
	left_to_right_sums = list(accumulate(a))
	right_to_left_sums = list(accumulate(a[::-1]))
	right_to_left_sums = [a[-1]]
	for e in reversed(a[:-1]):
		right_to_left_sums.append(e + right_to_left_sums[-1])
	right_to_left_sums = right_to_left_sums[::-1]
	i_left = 0
	i_right = n
	next_left = False
	done = False
	n_moves = 1
	last_eaten_opp = a[0]
	curr_eaten = 0
	while i_right - i_left > 1:
		if next_left:
			i_left += 1
			curr_eaten += a[i_left]
			if curr_eaten > last_eaten_opp:
				next_left = False
				last_eaten_opp = curr_eaten
				curr_eaten = 0
				n_moves += 1
			else:
				next_left = True
		else:
			i_right -= 1
			curr_eaten += a[i_right]
			if curr_eaten > last_eaten_opp:
				next_left = True
				last_eaten_opp = curr_eaten
				curr_eaten = 0
				n_moves += 1
			else:
				next_left = False
	if curr_eaten >= 1:
		n_moves += 1
	print(n_moves, left_to_right_sums[i_left], right_to_left_sums[i_right])


import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
MOD = 10 ** 9 + 7

def solve():
	_ = int(input())
	A = list(map(int, input().split()))
	que = deque(A)
	Alice = Bob = 0
	quota = 1
	cnt = 0
	flg = 0
	while que:
		if not flg:
			tot = 0
			while que and tot < quota:
				a = que.popleft()
				tot += a
			Alice += tot
			quota = tot + 1
		else:
			tot = 0
			while que and tot < quota:
				a = que.pop()
				tot += a
			Bob += tot
			quota = tot + 1
		flg ^= 1
		cnt += 1
	print(cnt, Alice, Bob)
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	alice = 0
	bob = 0
	move = 0
	turn = 0
	lbob = 0
	lalice = 0
	while len(arr) > 0:
		if turn % 2 == 0:
			if turn == 0:
				alice += arr[0]
				lalice = arr[0]
				del arr[0]
			else:
				sm = 0
				while sm <= lbob:
					sm += arr[0]
					del arr[0]
					if len(arr) == 0:
						break
				lalice = sm
				alice += sm
			turn += 1
			move += 1
		else:
			sm = 0
			while sm <= lalice:
				sm += arr[-1]
				del arr[-1]
				if len(arr) == 0:
					break
			lbob = sm
			move += 1
			bob += sm
			turn += 1
	print(move, alice, bob)


ans = ''
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	prevc = 0
	alic = 0
	bob = 0
	flag = 0
	i = 0
	count = 0
	while len(a) != 0:
		count += 1
		if flag == 0:
			i = 0
			curr = 0
			while curr <= prevc and len(a) != 0:
				curr += a[i]
				a.pop(i)
			prevc = curr
			alic += curr
			flag = 1
		elif flag == 1:
			curr = 0
			while curr <= prevc and len(a) != 0:
				i = len(a) - 1
				curr += a[i]
				a.pop(i)
			prevc = curr
			bob += curr
			flag = 0
	ans += str(count) + ' ' + str(alic) + ' ' + str(bob) + '\n'
print(ans)


t = int(input())
for T in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(1, a[0], 0)
	else:
		x = a[0]
		s1 = x
		ns = 1
		i = 1
		y = 0
		j = n - 1
		repeat = True
		while repeat:
			if j > i - 1:
				s2 = a[j]
				while s2 <= s1 and j > i:
					j -= 1
					s2 += a[j]
				y += s2
				ns += 1
				j -= 1
				if j <= i:
					repeat = False
			if j > i - 1:
				s1 = a[i]
				while repeat and s1 <= s2 and (i < j):
					i += 1
					s1 += a[i]
				x += s1
				ns += 1
				i += 1
				if j < i:
					repeat = False
		print(ns, x, y)


t = int(input())
for i in range(t):
	n = int(input())
	li = list(map(int, input().split()))
	alice = [li[0]]
	bob = [0]
	a = sum(alice)
	li.pop(0)
	b = 0
	count = 0
	while len(li) > 0:
		while a >= b and len(li) > 0:
			r = li.pop()
			b += r
		bob.append(b)
		a = 0
		while b >= a and len(li) > 0:
			r = li.pop(0)
			a += r
		alice.append(a)
		b = 0
	for i in alice:
		if i != 0:
			count += 1
	for i in bob:
		if i != 0:
			count += 1
	print(count, sum(alice), sum(bob))


for _ in range(int(input())):
	candies = int(input())
	l = list(map(int, input().split()))
	moves = 0
	ans1 = 0
	ans2 = 0
	a = 0
	b = candies - 1
	current_sweet = 0
	alic_sweet = 0
	bob_sweet = 0
	while a <= b:
		while alic_sweet <= current_sweet:
			alic_sweet += l[a]
			a += 1
			if a > b:
				break
		ans1 += alic_sweet
		current_sweet = alic_sweet
		alic_sweet = 0
		moves += 1
		if a > b:
			break
		while bob_sweet <= current_sweet:
			bob_sweet += l[b]
			b -= 1
			if b < a:
				break
		ans2 += bob_sweet
		current_sweet = bob_sweet
		bob_sweet = 0
		moves += 1
	print(moves, ans1, ans2)


from collections import deque
n = int(input())
for i in range(n):
	s = int(input())
	k = deque(map(int, input().split()))
	xra = k.popleft()
	b = 0
	x = 1
	a = xra
	while k:
		xrb = 0
		while k and xrb <= xra:
			xrb += k.pop()
		if xrb > 0:
			x += 1
		b += xrb
		xra = 0
		while k and xra <= xrb:
			xra += k.popleft()
		if xra > 0:
			x += 1
		a += xra
	print(x, a, b)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	deck = deque([int(x) for x in input().split()])
	(a, b) = (0, 0)
	(pa, pb) = (0, 0)
	moves = 0
	while len(deck) != 0:
		if moves % 2 == 0:
			cur = 0
			while len(deck) > 0 and cur <= pb:
				cur += deck.popleft()
			pa = cur
			a += cur
		else:
			cur = 0
			while len(deck) > 0 and cur <= pa:
				cur += deck.pop()
			pb = cur
			b += cur
		moves += 1
	print(moves, a, b)


MOD = 10 ** 9 + 7
RLIMIT = 1000
DEBUG = 1

def main():
	for _ in inputt():
		(n,) = inputi()
		A = deque(inputl())
		(i, a, b, c, d) = (0, 0, 0, 0, 0)
		while A:
			(i, c, d) = (i + 1, d + 1, 0)
			while A and d < c:
				x = A.popleft()
				a += x
				d += x
			if not A:
				break
			(i, c, d) = (i + 1, d + 1, 0)
			while A and d < c:
				x = A.pop()
				b += x
				d += x
		print(i, a, b)
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict, deque
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(RLIMIT)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	if args:
		sys.stdout.write(str(args[0]))
		split = kwargs.pop('split', ' ')
		for arg in args[1:]:
			sys.stdout.write(split)
			sys.stdout.write(str(arg))
	sys.stdout.write(kwargs.pop('end', '\n'))

def debug(*args, **kwargs):
	if DEBUG and (not __debug__):
		print('debug', *args, **kwargs)
		sys.stdout.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda k=int: map(k, inputs())
inputl = lambda t=0, k=lambda : list(inputi()): [k() for _ in range(t)] if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

class Tree:

	def __init__(n):
		self._n = n
		self._conn = [[] for _ in range(n)]
		self._list = [0] * n

	def connect(a, b):
		pass

class Sieve:

	def __init__(self):
		self._n = 6
		self._list = [2, 3, 5, 7, 11, 13]

	def extend(self, n):
		if n <= self._list[-1]:
			return
		maxbase = int(n ** 0.5) + 1
		self.extend(maxbase)
		begin = self._list[-1] + 1
		newsieve = [i for i in range(begin, n + 1)]
		for p in self.primerange(2, maxbase):
			for i in range(-begin % p, len(newsieve), p):
				newsieve[i] = 0
		self._list.extend([x for x in newsieve if x])

	def extend_to_no(self, i):
		while len(self._list) < i:
			self.extend(int(self._list[-1] * 1.5))

	def primerange(self, a, b):
		a = max(2, a)
		if a >= b:
			return
		self.extend(b)
		i = self.search(a)[1]
		maxi = len(self._list) + 1
		while i < maxi:
			p = self._list[i - 1]
			if p < b:
				yield p
				i += 1
			else:
				return

	def search(self, n):
		if n < 2:
			raise ValueError
		if n > self._list[-1]:
			self.extend(n)
		b = bisect(self._list, n)
		if self._list[b - 1] == n:
			return (b, b)
		else:
			return (b, b + 1)

	def __contains__(self, n):
		if n < 2:
			raise ValueError
		if not n % 2:
			return n == 2
		(a, b) = self.search(n)
		return a == b

	def __getitem__(self, n):
		if isinstance(n, slice):
			self.extend_to_no(n.stop + 1)
			return self._list[n.start:n.stop:n.step]
		else:
			self.extend_to_no(n + 1)
			return self._list[n]
sieve = Sieve()

def isprime(n):
	if n <= sieve._list[-1]:
		return n in sieve
	for i in sieve:
		if not n % i:
			return False
		if n < i * i:
			return True
prime = sieve.__getitem__
primerange = lambda a, b=0: sieve.primerange(a, b) if b else sieve.primerange(2, a)

def factorint(n):
	factors = []
	for i in sieve:
		if n < i * i:
			break
		while not n % i:
			factors.append(i)
			n //= i
	if n != 1:
		factors.append(n)
	return factors
factordict = lambda n: Counter(factorint(n))
main()


from sys import stdin
a = int(stdin.readline())
for bb in range(0, a):
	count = int(stdin.readline())
	c = stdin.readline().split()
	n = 1
	a = int(c[0])
	b = 0
	c = c[1:]
	ALICE = 0
	BOB = 0
	target = a
	if len(c) == 0:
		print(1, end=' ')
		print(a, end=' ')
		print(0)
		continue
	while True:
		while BOB - 1 < target and len(c) > 0:
			BOB += int(c[len(c) - 1])
			c = c[:len(c) - 1]
		n += 1
		target = BOB
		b += BOB
		BOB = 0
		if len(c) == 0:
			break
		while ALICE - 1 < target and len(c) > 0:
			ALICE += int(c[0])
			c = c[1:]
		n += 1
		target = ALICE
		a += ALICE
		ALICE = 0
		if len(c) == 0:
			break
	print(n, end=' ')
	print(a, end=' ')
	print(b)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	i = 0
	j = n - 1
	(c, c1, si, sj, tt, sii, sjj) = (0, 0, 0, 0, 0, 0, 0)
	while True:
		if i > j:
			break
		sii = 0
		while i <= j:
			c1 += 1
			si += a[i]
			sii += a[i]
			if sii > sjj:
				c += 1
				i += 1
				break
			elif i == j:
				c += 1
			i += 1
		if i > j:
			if c1 != n:
				c += 1
			break
		sjj = 0
		while j >= i:
			c1 += 1
			sj += a[j]
			sjj += a[j]
			if sjj > sii:
				c += 1
				j -= 1
				break
			elif i == j:
				c += 1
			j -= 1
	print(c, si, sj)


count = int(input())
boards = []
alise = 0
aliseLAST = 0
bob = 0
bobLAST = 0
turn = 0
for i in range(count):
	board = []
	count2 = int(input())
	textBoard = input().split()
	for k in textBoard:
		board.append(int(k))
	boards.append(board)
for i in boards:
	alise = 0
	aliseLAST = 0
	bob = 0
	bobLAST = 0
	turn = 0
	while True:
		needStop = False
		turn = turn + 1
		if turn == 1:
			alise = alise + i[0]
			aliseLAST = i[0]
			i.pop(0)
			if len(i) == 0:
				needStop = True
				break
		elif turn % 2 == 0:
			bobLAST = 0
			while bobLAST <= aliseLAST:
				if len(i) != 0:
					bobLAST = bobLAST + i[len(i) - 1]
					i.pop(len(i) - 1)
				else:
					needStop = True
					break
			if len(i) == 0:
				needStop = True
			bob = bob + bobLAST
		else:
			aliseLAST = 0
			while aliseLAST <= bobLAST:
				if len(i) != 0:
					aliseLAST = aliseLAST + i[0]
					i.pop(0)
				else:
					needStop = True
					break
			if len(i) == 0:
				needStop = True
			alise = alise + aliseLAST
		if needStop == True:
			break
	print(turn, end=' ')
	print(alise, end=' ')
	print(bob)


import sys
input = sys.stdin.readline
import collections

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		q = collections.deque(A)
		a = 0
		b = 0
		prev = 0
		i = 0
		while q:
			now = 0
			if i % 2 == 0:
				while q and prev >= now:
					now += q.popleft()
				a += now
			else:
				while q and prev >= now:
					now += q.pop()
				b += now
			prev = now
			i += 1
		print(i, a, b)
main()


import math
n = int(input())

def get_result(candles):
	count = 1
	size_a = candles[0]
	size_b = 0
	prev = candles[0]
	l = 1
	h = len(candles) - 1
	reverse = True
	while l <= h:
		curr = 0
		count += 1
		if reverse:
			while curr <= prev and l <= h:
				curr += candles[h]
				h -= 1
			prev = curr
			size_b += curr
			reverse = False
		else:
			while curr <= prev and l <= h:
				curr += candles[l]
				l += 1
			prev = curr
			size_a += curr
			reverse = True
	print(count, size_a, size_b)
for j in range(n):
	k = int(input())
	candles = list(map(int, input().split()))
	get_result(candles)


t = int(input())
while t != 0:
	n = int(input())
	ar = list(map(int, input().strip().split()))
	start = 1
	end = n - 1
	chances = 1
	aliceSum = ar[0]
	bobSum = 0
	lastAlice = ar[0]
	lastBob = 0
	flag = 0
	chance = 1
	while start <= end:
		if chance == 1:
			lastBob = 0
			while start <= end and lastBob <= lastAlice:
				bobSum += ar[end]
				lastBob += ar[end]
				end -= 1
			chance = 0
		else:
			lastAlice = 0
			while start <= end and lastAlice <= lastBob:
				aliceSum += ar[start]
				lastAlice += ar[start]
				start += 1
			chance = 1
		chances += 1
		if end < start:
			break
	print(chances, aliceSum, bobSum)
	t -= 1


import sys
input = sys.stdin.readline
from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = deque([int(item) for item in input().split()])
	alice = 0
	bob = 0
	turn = 0
	prev = 0
	while a:
		eaten = 0
		if turn % 2 == 0:
			while a and eaten <= prev:
				candy = a.popleft()
				alice += candy
				eaten += candy
		if turn % 2 == 1:
			while a and eaten <= prev:
				candy = a.pop()
				bob += candy
				eaten += candy
		turn += 1
		prev = eaten
	print(turn, alice, bob)


b77 = 'abcdefghijklmnopqrstuvwxyz'
arr = []
d = []
count = 0
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	move = 0
	step = 0
	alice = 0
	bob = 0
	last = 0
	while len(a) != 0:
		p = 0
		step += 1
		if move == 0:
			while len(a) != 0 and p <= last:
				alice += a[0]
				p += a[0]
				del a[0]
			move = 1
			last = p
		else:
			while len(a) != 0 and p <= last:
				bob += a[-1]
				p += a[-1]
				del a[-1]
			move = 0
			last = p
	print(step, alice, bob)


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	n = int(sys.stdin.readline().strip())
	candies = list(map(int, sys.stdin.readline().strip().split()))
	nMoves = 0
	remaining = len(candies)
	(sumA, sumB, prevTurnSum) = (0, 0, 0)
	(a, b) = (0, len(candies) - 1)
	aliceTurn = True
	while a <= b:
		turnSum = 0
		while turnSum <= prevTurnSum and remaining:
			if aliceTurn:
				turnSum += candies[a]
				a += 1
				remaining -= 1
			else:
				turnSum += candies[b]
				b -= 1
				remaining -= 1
		sumA += turnSum * aliceTurn
		sumB += turnSum * (not aliceTurn)
		nMoves += 1
		aliceTurn = not aliceTurn
		prevTurnSum = turnSum
	print(nMoves, sumA, sumB)


import math
a = int(input())
for j in range(0, a):
	num = int(input())
	ar = []
	for i in input().split(' '):
		ar.append(int(i))
	alice = 0
	bob = num - 1
	countA = 0
	countB = 0
	count = 0
	prev = 0
	ch = 1
	eat = 0
	curr = 0
	while bob - alice != -1:
		if count == 0:
			count = 1
			countA = ar[alice]
			prev = ar[alice]
			alice = alice + 1
			curr = 1
			continue
		if ch == 1:
			if ar[bob] + eat > prev:
				count = count + 1
				countB = countB + ar[bob]
				prev = ar[bob] + eat
				eat = 0
				ch = 0
				bob = bob - 1
				curr = 1
			else:
				countB = countB + ar[bob]
				eat = eat + ar[bob]
				bob = bob - 1
				curr = 0
		elif ar[alice] + eat > prev:
			count = count + 1
			countA = countA + ar[alice]
			prev = ar[alice] + eat
			eat = 0
			ch = 1
			alice = alice + 1
			curr = 1
		else:
			countA = countA + ar[alice]
			eat = eat + ar[alice]
			alice = alice + 1
			curr = 0
	if curr == 1:
		print(count, countA, countB)
	else:
		print(count + 1, countA, countB)


for _ in range(int(input())):
	n = int(input())
	aa = list(map(int, input().split()))
	raa = aa[::-1]
	(a, b) = (0, n - 1)
	alice = True
	prev = 0
	(asum, bsum) = (0, 0)
	done = False
	moves = 0
	while True:
		now = 0
		if alice:
			while True:
				if a == b:
					now += aa[a]
					asum += now
					done = True
					break
				now += aa[a]
				if now > prev:
					asum += now
					prev = now
					a += 1
					break
				a += 1
		else:
			while True:
				if b == a:
					now += aa[b]
					bsum += now
					done = True
					break
				now += aa[b]
				if now > prev:
					bsum += now
					prev = now
					b -= 1
					break
				b -= 1
		moves += 1
		alice = not alice
		if done:
			break
	print(moves, asum, bsum)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	b = a = c = s2 = 0
	while i <= j and i < n and (j > -1):
		(s1, f) = (0, False)
		while s1 <= s2 and i < n and (i <= j):
			f = True
			s1 += l[i]
			i += 1
		if f:
			c += 1
		a += s1
		(s2, f) = (0, False)
		while s2 <= s1 and j > -1 and (i <= j):
			f = True
			s2 += l[j]
			j -= 1
		if f:
			c += 1
		b += s2
	print(c, a, b)


t = int(input())
for tests in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	(ca, cb) = (0, 0)
	(pa, pb) = (0, 0)
	(ia, ib) = (0, n - 1)
	while ia <= ib:
		if count % 2 == 0:
			pa = 0
			pb = max(0.5, pb)
			while ia <= ib and pa <= pb:
				pa += a[ia]
				ca += a[ia]
				ia += 1
			count += 1
		else:
			pb = 0
			while ib >= ia and pb <= pa:
				pb += a[ib]
				cb += a[ib]
				ib -= 1
			count += 1
	print(count, ca, cb)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		a = ria()
		ta = 0
		tb = 0
		currsize = 0
		k = 1
		l = 0
		r = n - 1
		moves = 0
		while True:
			quit = 1
			if k == 0:
				c = 0
				for i in range(r, l - 1, -1):
					c += a[i]
					if c > currsize:
						currsize = c
						k = 1 - k
						r = i - 1
						quit = 0
						break
				if c != 0:
					moves += 1
				tb += c
			else:
				c = 0
				for i in range(l, r + 1):
					c += a[i]
					if c > currsize:
						currsize = c
						k = 1 - k
						l = i + 1
						quit = 0
						break
				if c != 0:
					moves += 1
				ta += c
			if quit == 1:
				break
		print(moves, ta, tb)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


T = int(input())
r = 1
while r <= T:
	n = int(input())
	arr = list(map(int, input().split()))
	front = 1
	rear = n - 1
	prenum = arr[0]
	turn = 1
	a = prenum
	b = 0
	while front <= rear:
		temp = 0
		while True:
			temp += arr[rear]
			rear -= 1
			if rear < front or temp > prenum:
				break
		turn += 1
		b += temp
		prenum = temp
		if front > rear:
			break
		temp = 0
		while True:
			temp += arr[front]
			front += 1
			if front > rear or temp > prenum:
				break
		turn += 1
		a += temp
		prenum = temp
	print(turn, a, b)
	r += 1


from collections import deque
for _ in range(int(input())):
	n = int(input())
	q = deque(map(int, input().split()))
	(a, b) = (0, 0)
	(ta, tb) = (0, 0)
	m = 0
	while q:
		if m % 2:
			s = 0
			while s <= a and q:
				s += q.pop()
			b = s
			tb += s
		else:
			s = 0
			while s <= b and q:
				s += q.popleft()
			a = s
			ta += s
		m += 1
	print(m, ta, tb)


tests = int(input())
for test in range(tests):
	number_of_candys = int(input())
	candys = list(map(int, input().split()))
	all_Alica = 0
	all_Tom = 0
	last_Alica = 0
	last_Tom = 0.1
	hod = 0
	while len(candys) > 2:
		n = 0
		for i in range(len(candys) + 1):
			if n == 1:
				hod += 1
			if len(candys) == 0:
				break
			n += 1
			if last_Alica > last_Tom:
				break
			all_Alica += candys[0]
			last_Alica += candys[0]
			candys = candys[1:]
		last_Tom = 0
		if len(candys) == 0:
			break
		n = 0
		for i in range(len(candys) + 1):
			if n == 1:
				hod += 1
			if len(candys) == 0:
				break
			n += 1
			if last_Alica < last_Tom:
				break
			all_Tom += candys[-1]
			last_Tom += candys[-1]
			candys = candys[:-1]
		last_Alica = 0
	if len(candys) == 2:
		if last_Alica == 0:
			if last_Alica + candys[0] > last_Tom:
				hod += 2
				all_Alica += candys[0]
				all_Tom += candys[-1]
			else:
				hod += 1
				all_Alica = all_Alica + candys[0] + candys[1]
		if last_Tom == 0:
			if last_Tom + candys[-1] > last_Alica:
				hod += 2
				all_Alica += candys[0]
				all_Tom += candys[-1]
			else:
				hod += 1
				all_Tom = all_Tom + candys[0] + candys[1]
	elif len(candys) == 1:
		if last_Alica == 0:
			hod += 1
			all_Alica += candys[0]
		else:
			hod += 1
			all_Tom += candys[0]
	print(hod, all_Alica, all_Tom)


t = int(input())
for i in range(t):
	n = int(input())
	arr = input()
	a = list(map(int, arr.split(' ')))
	ana_candies = a[0]
	bob_candies = 0
	ana_ind = 1
	bob_ind = n - 1
	player = 1
	prev_candies = a[0]
	moves = 1
	while ana_ind <= bob_ind:
		to_eat = 0
		moves += 1
		if player == 0:
			while to_eat <= prev_candies and ana_ind <= bob_ind:
				to_eat += a[ana_ind]
				ana_ind += 1
			ana_candies += to_eat
		else:
			while to_eat <= prev_candies and ana_ind <= bob_ind:
				to_eat += a[bob_ind]
				bob_ind -= 1
			bob_candies += to_eat
		prev_candies = to_eat
		player = 1 - player
	print(moves, ana_candies, bob_candies)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	fsum = a[0]
	psum = 0
	current = a[0]
	L = 1
	R = n
	moves = 1
	while L < R:
		need = current
		current = 0
		while current <= need:
			current += a[R - 1]
			R -= 1
			if L == R:
				break
		psum += current
		moves += 1
		if L == R:
			break
		need = current
		current = 0
		while current <= need:
			current += a[L]
			L += 1
			if L == R:
				break
		fsum += current
		moves += 1
		if L == R:
			break
	print(moves)
	print(fsum)
	print(psum)


t = int(input())
i = 0
while i < t:
	n = int(input())
	arr = list(map(int, input().split()))
	k = 0
	l = n - 1
	sum1 = 0
	sum2 = 0
	count = 0
	a = 0
	b = 0
	while k <= l:
		a = 0
		z = False
		while a <= b and k <= l:
			sum1 = sum1 + arr[k]
			a = a + arr[k]
			k = k + 1
			z = True
		if z == True:
			count = count + 1
		b = 0
		z = False
		while b <= a and k <= l:
			sum2 = sum2 + arr[l]
			b = b + arr[l]
			l = l - 1
			z = True
		if z == True:
			count = count + 1
	print(count, sum1, sum2)
	i = i + 1


from sys import stdin, stdout
from collections import deque

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		ar = deque(map(int, stdin.readline().split()))
		a = 0
		b = 0
		prev = ar.popleft()
		a += prev
		turn = 1
		move = 1
		while ar:
			if turn == 1:
				curr = 0
				while ar and curr <= prev:
					curr += ar.pop()
				b += curr
				prev = curr
				move += 1
			else:
				curr = 0
				while ar and curr <= prev:
					curr += ar.popleft()
				a += curr
				prev = curr
				move += 1
			turn = 1 - turn
		print(move, a, b)
main()


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	q = deque(rl())
	moves = 0
	a = 0
	b = 0
	curr = 0
	while q:
		curr_a = 0
		while q and curr_a <= curr:
			curr_a += q.popleft()
		moves += 1
		curr = curr_a
		a += curr_a
		if not q:
			break
		curr_b = 0
		while q and curr_b <= curr:
			curr_b += q.pop()
		moves += 1
		curr = curr_b
		b += curr_b
	print(moves, a, b)


import sys
from collections import deque

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	A = LIST()
	que = deque(A)
	mx = 0
	cur = 0
	alice = 0
	bob = 0
	turn = 0
	while que:
		cur = 0
		if turn % 2 == 0:
			while que and cur <= mx:
				cur += que.popleft()
			mx = cur
			alice += cur
		else:
			while que and cur <= mx:
				cur += que.pop()
			mx = cur
			bob += cur
		turn += 1
	print(turn, alice, bob)


t = int(input())
for test in range(t):
	n = int(input())
	arr = input().split()
	left = 1
	right = len(arr) - 1
	alice = int(arr[0])
	bob = 0
	talice = alice
	moves = 1
	while left <= right:
		tbob = 0
		while left <= right and tbob < talice + 1:
			tbob += int(arr[right])
			right -= 1
		bob += tbob
		talice = 0
		moves += 1
		if left <= right:
			moves += 1
		while left <= right and talice < tbob + 1:
			talice += int(arr[left])
			left += 1
		alice += talice
	print(str(moves) + ' ' + str(alice) + ' ' + str(bob))


t = int(input())
temporal = 0
sum_1 = 0
sum_2 = 0
change = 0
index = 2
count = 0
switch = True
posicion = 0
rpta = []
please = []
for i in range(t):
	numero = int(input())
	main = list(map(int, input().split()))
	temporal = main[0] + 1
	main.pop(0)
	sum_1 = temporal - 1
	while True:
		if len(main) == 0:
			break
		else:
			if index % 2 == 0:
				posicion = len(main) - 1
				change = -1
				switch = False
			else:
				posicion = 0
				change = 1
				switch = True
			count = 0
			while True:
				if temporal <= count:
					break
				count = count + main[posicion]
				main.pop(posicion)
				if switch:
					posicion = 0
				else:
					posicion = len(main) - 1
				if len(main) == 0:
					break
			if index % 2 == 0:
				sum_2 = sum_2 + count
			else:
				sum_1 = sum_1 + count
			temporal = count + 1
			index = index + 1
	please.append(index - 1)
	please.append(sum_1)
	please.append(sum_2)
	rpta.append(please)
	please = []
	index = 2
	temporal = 0
	count = 0
	sum_1 = 0
	sum_2 = 0
for xxx in rpta:
	for yyy in xxx:
		print(yyy, end=' ')
	print()


import math
for _ in range(int(input())):
	n = int(input())
	x = [int(y) for y in input().split()]
	t = [0] * 2
	m = 1
	p = 0
	while len(x) != 0:
		m += 1
		c = 0
		while len(x) != 0 and c <= p:
			c += x[0]
			x = x[1:]
		t[m % 2] += c
		p = c
		x.reverse()
	print(m - 1, *t)


t = int(input())
for _ in range(0, t):
	fa = 0
	fb = 0
	rr = 0
	n = int(input())
	a = [int(x) for x in input().split()]
	lside = 0
	rside = n - 1
	al = 0
	bob = 0
	summ = sum(a)
	gg = 1
	while lside <= rside:
		css = 0
		al = 0
		if lside <= rside:
			rr += gg
		while lside <= rside and css <= bob:
			al += a[lside]
			fa += a[lside]
			css += a[lside]
			lside += gg
		u = 0
		css = u
		bob = u
		if lside <= rside:
			rr = rr + gg
		while lside <= rside and css <= al:
			bob += a[rside]
			fb += a[rside]
			css += a[rside]
			rside -= gg
	print(rr, fa, fb)


from sys import stdin, stdout
import math

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		if n == 1:
			x = int(stdin.readline())
			stdout.write('1 ' + str(x) + ' 0\n')
			continue
		arr = list(map(int, stdin.readline().split()))
		l = 0
		r = n - 1
		do_left = True
		prev = 0
		count = 0
		left = 0
		right = 0
		while l <= r:
			if do_left:
				do_left = False
				s = 0
				while s <= prev:
					s += arr[l]
					l += 1
					if l > r:
						break
				left += s
				prev = s
			else:
				do_left = True
				s = 0
				while s <= prev:
					s += arr[r]
					r -= 1
					if l > r:
						break
				right += s
				prev = s
			count += 1
		stdout.write(' '.join((str(x) for x in [count, left, right])) + '\n')
main()


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, Counter
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	li = listIn()
	left = [0] * n
	right = [0] * n
	(left[0], right[n - 1]) = (li[0], li[n - 1])
	for i in range(1, n):
		left[i] = left[i - 1] + li[i]
	for i in range(n - 2, -1, -1):
		right[i] = right[i + 1] + li[i]
	alice = 0
	maxx = 0
	bob = 0
	chance = 0
	i = 0
	j = n - 1
	moves = 0
	while i <= j:
		if chance == 1:
			val = right[j] - bob
			if val > maxx:
				bob += val
				maxx = val
				j -= 1
				chance = 0
				moves += 1
			else:
				j -= 1
		else:
			val = left[i] - alice
			if val > maxx:
				alice += val
				maxx = val
				i += 1
				chance = 1
				moves += 1
			else:
				i += 1
	summ = left[-1]
	if alice + bob == summ:
		print(moves, alice, bob)
	else:
		if chance == 0:
			alice += summ - alice - bob
		else:
			bob += summ - (alice + bob)
		print(moves + 1, alice, bob)


def solve():
	N = int(input())
	arr = [int(el) for el in input().split()]
	(l, r) = (1, N - 1)
	(A, B) = (arr[0], 0)
	(A_cur, B_cur) = (arr[0], 0)
	cnt = 0
	for i in range(1, N):
		if i % 2 == 1:
			B_cur = 0
			while B_cur <= A_cur and r >= l:
				B_cur += arr[r]
				r -= 1
			if B_cur > 0:
				cnt += 1
				B += B_cur
		else:
			A_cur = 0
			while A_cur <= B_cur and l <= r:
				A_cur += arr[l]
				l += 1
			if A_cur > 0:
				cnt += 1
				A += A_cur
	print(cnt + 1, A, B)
for t in range(1, int(input()) + 1):
	solve()


from collections import deque
t = int(input())
for i in range(t):
	n = int(input())
	l = deque(map(int, input().split()))
	(a, b) = (l[0], 0)
	turns = 1
	(lasta, lastb) = (l[0], 0)
	l.popleft()
	while len(l):
		turns += 1
		sm = 0
		while sm <= lasta and len(l):
			sm += l[-1]
			l.pop()
		b += sm
		lastb = sm
		sm = 0
		if len(l) == 0:
			break
		while sm <= lastb and len(l):
			sm += l[0]
			l.popleft()
		a += sm
		lasta = sm
		turns += 1
	print(turns, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ls = 0
	rs = 0
	mv = 0
	t = 0
	prev = 0
	while True:
		mv += 1
		if t % 2 == 0:
			cur = 0
			while cur <= prev and len(a) > 0:
				cur = cur + a[0]
				ls = ls + a[0]
				a = a[1:]
			prev = cur
			t += 1
		else:
			cur = 0
			while cur <= prev and len(a) > 0:
				cur = cur + a[-1]
				rs += a[-1]
				a = a[:-1]
			prev = cur
			t += 1
		if len(a) == 0:
			break
	print(mv, ls, rs)


t = int(input())
for i in range(t):
	n = int(input())
	v = list(map(int, input().strip().split()))[:n]
	i = 1
	j = n - 1
	al = v[0]
	bob = 0
	k = 1
	b_ = 0
	a_ = v[0]
	cnt = 1
	while i <= j:
		if k and 1:
			b_ = 0
			while j >= i and b_ <= a_:
				bob = bob + v[j]
				b_ = b_ + v[j]
				j = j - 1
			k = 0
			cnt = cnt + 1
		else:
			a_ = 0
			while i <= j and b_ >= a_:
				a_ = a_ + v[i]
				al = al + v[i]
				i = i + 1
			k = 1
			cnt = cnt + 1
	print(cnt, al, bob)


from sys import stdin
from math import gcd
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	start = 1
	end = n - 1
	lastStart = a[0]
	lastEnd = 0
	prev = True
	totalS = a[0]
	totalE = 0
	ans = 1
	while True:
		if n == 1:
			break
		if prev:
			lastEnd += a[end]
			totalE += a[end]
			if lastEnd > lastStart:
				prev = not prev
				lastStart = 0
				ans += 1
				if start == end:
					break
			if start == end:
				ans += 1
				break
			end -= 1
		else:
			lastStart += a[start]
			totalS += a[start]
			if lastEnd < lastStart:
				prev = not prev
				lastEnd = 0
				ans += 1
				if start == end:
					break
			if start == end:
				ans += 1
				break
			start += 1
	print(ans, totalS, totalE)


t = int(input())
for test in range(t):
	n = int(input())
	candy = [int(x) for x in input().split()]
	from collections import deque
	alice = deque(candy)
	bob = deque([candy[i] for i in range(n - 1, -1, -1)])
	(a_p, at) = (0, 0)
	(b_p, bt) = (0, 0)
	move = 0
	to_eat = 0
	while len(alice) > 0 or len(bob) > 0:
		if move % 2 == 0:
			toeat = b_p + 1
			b_p = 0
			while toeat > 0 and len(alice) != 0:
				bob.pop()
				toeat -= alice[0]
				at += alice[0]
				a_p += alice[0]
				alice.popleft()
		else:
			toeat = a_p + 1
			a_p = 0
			while toeat > 0 and len(bob) != 0:
				alice.pop()
				toeat -= bob[0]
				bt += bob[0]
				b_p += bob[0]
				bob.popleft()
		move += 1
	print(move)
	print(at, bt)


import math
for _ in range(int(input())):
	x = int(input())
	y = list(map(int, input().split()))
	if x == 1:
		print(1, y[0], 0)
		continue
	mm = [0] * x
	i = 1
	j = x - 1
	mm[0] += 1
	pac = y[0]
	bac = 0
	ac = y[0]
	bc = 0
	f = 1
	c = 1
	while mm[i] == 0 and mm[j] == 0 and (i < x) and (j > -1):
		c += 1
		if f == 1:
			t1 = 0
			while t1 <= pac and mm[j] == 0:
				mm[j] += 1
				t1 += y[j]
				j -= 1
			bac = t1
			bc += t1
			f = 0
		else:
			t2 = 0
			while t2 <= bac and mm[i] == 0:
				mm[i] += 1
				t2 += y[i]
				i += 1
			pac = t2
			ac += t2
			f = 1
	print(c, ac, bc)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	(left, right) = (0, len(arr) - 1)
	a = b = steps = flag = 0
	a = arr[0]
	steps = 1
	left += 1
	sum_alice = arr[0]
	while left <= right:
		sum_bob = 0
		step = 0
		while sum_bob <= sum_alice and left <= right:
			sum_bob += arr[right]
			right -= 1
			step = 1
		b += sum_bob
		steps += step
		sum_alice = 0
		step = 0
		while sum_alice <= sum_bob and left <= right:
			sum_alice += arr[left]
			left += 1
			step = 1
		a += sum_alice
		steps += step
	print(steps, a, b)


from collections import deque

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		A = deque(map(int, input().split()))
		num = 0
		pre = 0
		Flag = 0
		a = 0
		b = 0
		while A:
			eats = 0
			while A and eats <= pre:
				if Flag == 0:
					v = A.popleft()
				else:
					v = A.pop()
				eats += v
			pre = eats
			num += 1
			if Flag == 0:
				a += eats
			else:
				b += eats
			Flag = 1 - Flag
		ret = [num, a, b]
		print(*ret)
main()


from sys import stdin, stdout
for test in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = [int(x) for x in stdin.readline().split()]
	alice = 0
	bob = 0
	ptr_a = 0
	ptr_b = n - 1
	rnd = 0
	ansa = 0
	ansb = 0
	while ptr_b >= ptr_a:
		rnd = rnd + 1
		if rnd % 2 == 0:
			while bob <= alice and arr[ptr_b] != -1:
				bob = bob + arr[ptr_b]
				ansb = ansb + arr[ptr_b]
				arr[ptr_b] = -1
				ptr_b = ptr_b - 1
			alice = 0
		else:
			while alice <= bob and arr[ptr_a] != -1:
				alice = alice + arr[ptr_a]
				ansa = ansa + arr[ptr_a]
				arr[ptr_a] = -1
				ptr_a = ptr_a + 1
			bob = 0
	print(rnd, ansa, ansb)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = 0
	e = len(l) - 1
	count = 0
	(ae, be) = (0, 0)
	pae = 0
	pbe = 0
	while s <= e:
		pae = 0
		f = 0
		while s <= e and pae <= pbe:
			pae += l[s]
			f = 1
			s += 1
		if f == 1:
			ae += pae
			count += 1
			pbe = 0
		f1 = 0
		while s <= e and pbe <= pae:
			pbe += l[e]
			f1 = 1
			e -= 1
		if f1 == 1:
			count += 1
			be += pbe
	print(count, ae, be)


t = int(input().strip())
while t > 0:
	n = int(input().strip())
	a = [int(x) for x in input().strip().split()]
	val = a[0]
	(p, q) = (0, 0)
	(x, y) = (0, n)
	p += val
	flag = 1
	cnt = 1
	while x < y:
		v = 0
		if flag:
			while v <= val and x < y - 1:
				y -= 1
				v += a[y]
			q += v
		else:
			while v <= val and x + 1 < y:
				x += 1
				v += a[x]
			p += v
		if v == 0:
			break
		flag = 1 - flag
		val = v
		cnt += 1
	print(cnt, p, q)
	t -= 1


import sys
input = sys.stdin.readline
import random
import copy
import math

def main():
	q = int(input())
	for _ in range(q):
		n = int(input())
		tab = list(map(int, input().split()))
		nb_mov = 0
		if n == 1:
			print(1, tab[0], 0)
			continue
		a = 0
		b = 0
		last = 0
		l = 1
		r = n - 1
		while l <= r:
			if nb_mov == 0:
				a = tab[0]
				last = tab[0]
			else:
				su = 0
				while su <= last and l <= r:
					su += tab[l]
					a += tab[l]
					l += 1
				last = su
			nb_mov += 1
			if l > r:
				break
			su = 0
			while su <= last and l <= r:
				su += tab[r]
				b += tab[r]
				r -= 1
			last = su
			nb_mov += 1
		print(nb_mov, a, b)
main()


def main():
	n_t = int(input())
	for t in range(n_t):
		n = int(input())
		a = [int(val) for val in input().split(' ')]
		last_size = 0
		alice = 0
		bob = 0
		moves = 0
		while len(a) > 0:
			curr_sum = 0
			while len(a) > 0 and curr_sum <= last_size:
				curr_sum += a.pop(0)
			alice += curr_sum
			last_size = curr_sum
			moves += 1
			if len(a) == 0:
				break
			curr_sum = 0
			while len(a) > 0 and curr_sum <= last_size:
				curr_sum += a.pop(-1)
			bob += curr_sum
			last_size = curr_sum
			moves += 1
		print('{} {} {}'.format(moves, alice, bob))
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	alice = []
	bob = []
	ac = 0
	bc = 0
	turn = 0
	i = 0
	j = n - 1
	check = 0
	lock = 0
	moves = 0
	while True:
		if turn % 2 == 0:
			if arr[i] == -1:
				lock = 1
				break
			ac = arr[i]
			alice.append(arr[i])
			arr[i] = -1
			i += 1
			moves += 1
			while ac <= check:
				if arr[i] == -1:
					lock = 1
					break
				ac += arr[i]
				alice.append(arr[i])
				arr[i] = -1
				i += 1
				if len(alice) + len(bob) == n:
					lock = 1
					break
			check = ac
		else:
			if arr[j] == -1:
				lock = 1
				break
			bc = arr[j]
			bob.append(arr[j])
			arr[j] = -1
			j -= 1
			moves += 1
			while bc <= check:
				if arr[j] == -1:
					lock = 1
					break
				bc += arr[j]
				bob.append(arr[j])
				arr[j] = -1
				j -= 1
				if len(alice) + len(bob) == n:
					lock = 1
					break
			check = bc
		if lock == 1:
			break
		turn += 1
	print(moves, sum(alice), sum(bob))


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	bobTotal = 0
	aliceTemp = lst[0]
	aliceTotal = aliceTemp
	bobTemp = 0
	alice = 1
	bob = 1
	flag = False
	moves = 1
	while n != alice + bob - 1 and n >= alice + bob:
		moves += 1
		if not flag:
			temp = lst[n - bob]
			bob += 1
			while temp <= aliceTemp and n - bob >= alice:
				temp += lst[n - bob]
				bob += 1
			bobTemp = temp
			bobTotal += bobTemp
			flag = True
		else:
			temp = lst[alice]
			alice += 1
			while temp <= bobTemp and alice <= n - bob:
				temp += lst[alice]
				alice += 1
			aliceTemp = temp
			aliceTotal += aliceTemp
			flag = False
	print(moves, aliceTotal, bobTotal)


import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
import sys
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

class Bisect:

	def __init__(self, func):
		self.__func = func

	def bisect_left(self, x, lo, hi):
		while lo < hi:
			mid = (lo + hi) // 2
			if self.__func(mid) < x:
				lo = mid + 1
			else:
				hi = mid
		return lo

	def bisect_right(self, x, lo, hi):
		while lo < hi:
			mid = (lo + hi) // 2
			if x < self.__func(mid):
				hi = mid
			else:
				lo = mid + 1
		return lo

def slv(N, A):
	sa = [0]
	for a in A:
		sa.append(sa[-1] + a)
	ai = 0
	bi = N
	ae = 0
	be = 0
	pbe = 0
	t = 0
	while True:
		t += 1
		i = Bisect(lambda x: sa[ai + x] - sa[ai]).bisect_left(pbe + 1, 0, bi - ai)
		pae = sa[ai + i] - sa[ai]
		ae += pae
		ai = ai + i
		if ai == bi:
			break
		t += 1
		i = Bisect(lambda x: sa[bi] - sa[bi - x]).bisect_left(pae + 1, 0, bi - ai)
		pbe = sa[bi] - sa[bi - i]
		be += pbe
		bi = bi - i
		if ai == bi:
			break
	return [t, ae, be]

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		A = read_int_n()
		print(*slv(N, A))
main()


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	moves = 0
	a = 0
	b = 0
	l = 0
	r = n - 1
	preA = 0
	preB = 0
	i = 0
	while l <= r:
		if i == 0:
			a += x[l]
			l += 1
			preA = x[i]
		elif i % 2 == 0:
			preA = 0
			while preA <= preB and l <= r:
				preA += x[l]
				a += x[l]
				l += 1
		elif i % 2 == 1:
			preB = 0
			while preB <= preA and l <= r:
				preB += x[r]
				b += x[r]
				r -= 1
		i += 1
	print(i, a, b)


from sys import stdout, stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	lis = list(map(int, input().split()))
	i = 0
	j = n - 1
	sumA = lis[0]
	sumB = lis[j]
	move = 1
	sum1 = sumA
	sum2 = sumB
	flag = 0
	while True and n != 1:
		while sumB <= sumA:
			if j <= i + 1:
				move += 1
				flag = 1
				break
			else:
				j -= 1
				sumB += lis[j]
				sum2 += lis[j]
		else:
			move += 1
			if i + 1 >= j:
				flag = 1
				break
			else:
				i += 1
				sum1 += lis[i]
				sumA = lis[i]
		if flag == 1:
			break
		while sumA <= sumB:
			if i + 1 >= j:
				move += 1
				flag = 1
				break
			else:
				i += 1
				sumA += lis[i]
				sum1 += lis[i]
		else:
			move += 1
			if i + 1 >= j:
				flag = 1
				break
			else:
				j -= 1
				sum2 += lis[j]
				sumB = lis[j]
		if flag == 1:
			break
	else:
		move = 1
		sum1 = lis[0]
		sum2 = 0
	print(move, sum1, sum2, sep=' ')


t = int(input())
for w in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	sum2 = moves = sum1 = i = 0
	j = n - 1
	a = []
	b = []
	while j >= i:
		sum1 = 0
		while sum1 <= sum2 and i <= j:
			p = arr[i]
			sum1 += p
			a.append(p)
			i += 1
		moves += 1
		if i > j:
			break
		sum2 = 0
		while sum2 <= sum1 and j >= i:
			q = arr[j]
			sum2 += q
			b.append(q)
			j -= 1
		moves += 1
		if i > j:
			break
	print(moves, sum(a), sum(b))


def candy(a):
	n = len(a)
	(l, r) = (0, n - 1)
	(totl, totr) = (0, 0)
	(prevl, prevr) = (0, 0)
	move = 0
	while l <= r:
		aggl = a[l]
		while aggl <= prevr and l + 1 <= r:
			l += 1
			aggl += a[l]
		if l == r:
			totl += aggl
			move += 1
			return (move, totl, totr)
		move += 1
		l += 1
		prevl = aggl
		totl += aggl
		aggr = a[r]
		while aggr <= prevl and r - 1 >= l:
			r -= 1
			aggr += a[r]
		if r == l:
			totr += aggr
			move += 1
			return (move, totl, totr)
		move += 1
		r -= 1
		prevr = aggr
		totr += aggr
	return (move, totl, totr)
t = int(input())
for i in range(t):
	n = int(input())
	a = [int(c) for c in input().split()]
	print(*candy(a))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	al = 0
	ar = 0
	bl = 0
	br = 0
	ar += l[0]
	i = 1
	j = n - 1
	c = 1
	d = 0
	while i <= j:
		br = bl
		d = j
		while bl - br <= ar - al:
			bl += l[j]
			if d == j:
				c += 1
			j -= 1
			if i > j:
				break
		al = ar
		if i > j:
			break
		d = i
		while ar - al <= bl - br:
			ar += l[i]
			if d == i:
				c += 1
			i += 1
			if i > j:
				break
	print(c, ar, bl)


for t in range(int(input())):
	N = int(input())
	l = list(map(int, input().split()))
	(i, j) = (0, N - 1)
	prev = 0
	move = 0
	(A, B) = (0, 0)
	while True:
		curr = 0
		move += 1
		while curr <= prev:
			curr += l[i]
			i += 1
			if i > j:
				break
		A += curr
		if i > j:
			break
		prev = curr
		curr = 0
		move += 1
		while curr <= prev:
			curr += l[j]
			j -= 1
			if i > j:
				break
		B += curr
		prev = curr
		if i > j:
			break
	print(move, A, B)


class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from bisect import bisect_right, bisect_left
from fractions import Fraction

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def pari(a):
	for i in range(0, 2, n):
		print(i)
	for i in range(1, 2, n):
		print(i)
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def f(n, a=1):
	if a == 1:
		a = []
	s = len(str(n))
	p = 10 ** (s - 1)
	ans = 1
	a += [n // p * p]
	n -= a[0]
	if n:
		ans += 1
		a += f(n)
		return a
	else:
		return a
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(alice, bob) = (0, 0)
	i = 0
	j = n - 1
	req = 1
	turn = 0
	while i <= j:
		if turn % 2 == 0:
			eat = 0
			while eat < req and i <= j:
				eat += a[i]
				i += 1
			alice += eat
			req = eat + 1
			turn += 1
		else:
			eat = 0
			while eat < req and i <= j:
				eat += a[j]
				j -= 1
			bob += eat
			req = eat + 1
			turn += 1
	print(turn, alice, bob)


def solve(a, n):
	i = 0
	j = n - 1
	sa = 0
	sb = 0
	alice = 0
	bob = 0
	c = 0
	while i <= j:
		alice = a[i]
		i += 1
		while alice <= bob and i <= j:
			alice += a[i]
			i += 1
		sa += alice
		c += 1
		if i > j:
			break
		bob = a[j]
		j -= 1
		while bob <= alice and i <= j:
			bob += a[j]
			j -= 1
		sb += bob
		c += 1
	return (c, sa, sb)
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	r = solve(a, n)
	print(*r)


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	moves = 0
	alice = 0
	bob = 0
	last = 0
	while len(arr) > 0:
		moves += 1
		if moves % 2 == 1:
			current = arr.pop(0)
		else:
			current = arr.pop(len(arr) - 1)
		while current <= last:
			if len(arr) == 0:
				break
			if moves % 2 == 1:
				current += arr.pop(0)
			else:
				current += arr.pop(len(arr) - 1)
		last = current
		if moves % 2 == 1:
			alice += last
		else:
			bob += last
	print(moves, alice, bob)


for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	(i, j) = (0, n - 1)
	v = 0
	c = 0
	(p, q) = (0, 0)
	while True:
		t = 0
		c += 1
		while t <= v:
			t += d[i]
			i += 1
			if i > j:
				break
		p += t
		if i > j:
			break
		v = t
		t = 0
		c += 1
		while t <= v:
			t += d[j]
			j -= 1
			if i > j:
				break
		q += t
		v = t
		if i > j:
			break
	print(c, p, q)


import sys
from collections import deque
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))

def solve(arr):
	res = []
	for a in arr:
		q = deque(a)
		count = 0
		(a, b) = (0, 0)
		(a_prev, b_prev) = (0, 0)
		a_turn = True
		while q:
			if a_turn:
				i = q.popleft()
				a += i
				a_prev += i
				if a_prev > b_prev:
					a_turn = False
					b_prev = 0
					count += 1
				elif not q:
					count += 1
			else:
				i = q.pop()
				b += i
				b_prev += i
				if b_prev > a_prev:
					a_turn = True
					a_prev = 0
					count += 1
				elif not q:
					count += 1
		res.append([count, a, b])
	return res
n = inp()
arr = []
for i in range(n):
	l = inp()
	arr.append(inlt())
res = solve(arr)
for r in res:
	print(' '.join(map(str, r)))


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	i = 1
	j = n - 1
	ta = ar[0]
	tb = 0
	a = ar[0]
	b = 0
	turn = 1
	moves = 1
	while i <= j:
		if turn == 0:
			ta += ar[i]
			a += ar[i]
			i += 1
			if ta > tb:
				turn = (turn + 1) % 2
				tb = 0
				moves += 1
		else:
			tb += ar[j]
			b += ar[j]
			j -= 1
			if tb > ta:
				turn = (turn + 1) % 2
				ta = 0
				moves += 1
	if turn == 0 and ta != 0:
		moves += 1
	if turn == 1 and tb != 0:
		moves += 1
	print(moves, a, b)


def task(n, a):
	aa = 0
	bb = 0
	moves = 0
	Alice = True
	last = 0
	candies = 0
	while True:
		if Alice:
			candy = a.pop(0)
			candies += candy
			aa += candy
		else:
			candy = a.pop()
			candies += candy
			bb += candy
		if len(a) == 0:
			moves += 1
			break
		if candies > last:
			last = candies
			candies = 0
			Alice = not Alice
			moves += 1
	print(moves, aa, bb)
t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	task(n, a)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	prevA = a[0]
	prevB = 0
	cntA = a[0]
	cntB = 0
	cntM = 1
	ai = 1
	bi = n - 1
	wm = 1
	while ai <= bi:
		if wm == 1:
			prevB = 0
			while prevB <= prevA and ai <= bi:
				prevB += a[bi]
				bi -= 1
			cntB += prevB
			wm = 0
			cntM += 1
		else:
			prevA = 0
			while prevA <= prevB and ai <= bi:
				prevA += a[ai]
				ai += 1
			cntA += prevA
			wm = 1
			cntM += 1
	print(cntM, cntA, cntB)


t = int(input())
for _ in range(t):
	n = int(input())
	k = list(map(int, input().split()))
	alice = True
	i = -1
	j = n
	(m, a, b, w) = (0, 0, 0, 0)
	cnt = 0
	while i + 1 != j:
		if alice:
			i += 1
			a += k[i]
			w += k[i]
			if w > m:
				m = w
				alice = False
				cnt += 1
				w = 0
			elif i + 1 == j:
				cnt += 1
		else:
			j -= 1
			b += k[j]
			w += k[j]
			if w > m:
				m = w
				alice = True
				cnt += 1
				w = 0
			elif i + 1 == j:
				cnt += 1
	print(cnt, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	X = a[0]
	x = a[0]
	a.pop(0)
	y = 0
	Y = 0
	moves = 1
	while len(a) != 0:
		while Y <= X:
			if len(a) == 0:
				break
			Y += a[-1]
			a.pop(-1)
		moves += 1
		y += Y
		if len(a) == 0:
			break
		X = 0
		while X <= Y:
			if len(a) == 0:
				break
			X += a[0]
			a.pop(0)
		moves += 1
		x += X
		Y = 0
	print(moves, x, y)


def candies(n, l):
	st = 0
	end = n - 1
	bob = 0
	alice = 0
	move = 0
	b = 0
	while st <= end:
		a = 0
		while st <= end and a <= b:
			alice += l[st]
			a += l[st]
			st += 1
		move += 1
		if st > end:
			break
		b = 0
		while end >= st and b <= a:
			bob += l[end]
			b += l[end]
			end -= 1
		move += 1
		if st > end:
			break
	print(move, alice, bob)
	return
T = int(input())
for i in range(T):
	n = int(input())
	a = [int(j) for j in input().split()]
	candies(n, a)


def a(l, pp):
	s = l[0]
	l.pop(0)
	while pp[0] >= s and len(l) > 0:
		s += l[0]
		l.pop(0)
	pp[0] = s
	pp[1] += s

def b(l, pp):
	s = l[-1]
	l.pop(-1)
	while pp[0] >= s and len(l) > 0:
		s += l[-1]
		l.pop(-1)
	pp[0] = s
	pp[2] += s
from sys import stdin
t = stdin.readline()
for _ in range(int(t)):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	alice = 0
	bob = 0
	moves = 1
	pp = [l[0], l[0], 0]
	cur_size = l[0]
	l.pop(0)
	while len(l) > 0:
		b(l, pp)
		moves += 1
		if len(l) > 0:
			a(l, pp)
			moves += 1
	pp[0] = moves
	print(*pp)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	if n == 1:
		print(1, *a, 0)
	else:
		(m, p, sa, sb) = (0, 0, 0, 0)
		while i <= j:
			if m % 2 == 0:
				c = 0
				while c <= p and i <= j:
					c = c + a[i]
					i = i + 1
				p = c
				sa = sa + c
			else:
				d = 0
				while d <= p and i <= j:
					d = d + a[j]
					j = j - 1
				p = d
				sb = sb + d
			m = m + 1
		print(m, sa, sb)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	a = arr[0]
	f = 1
	i = 1
	move = 1
	j = n - 1
	a_current = arr[0]
	b_current = 0
	while i <= j:
		if f == 0:
			while a_current <= b_current and i <= j:
				a_current += arr[i]
				i += 1
			a += a_current
			b_current = 0
			f = 1
			move += 1
		else:
			while b_current <= a_current and i <= j:
				b_current += arr[j]
				j -= 1
			a_current = 0
			f = 0
			move += 1
	print(move, end=' ')
	print(a, end=' ')
	print(sum(arr) - a)


import math
from collections import Counter, deque
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	n = I()
	l = L()
	(a, b) = (l[0], 0)
	l.pop(0)
	li = deque(l)
	s = 1
	(p, q) = (a, 0)
	n -= 1
	moves = 1
	while len(li) > 0:
		if s == 1 and n > 0:
			moves += 1
			x = 0
			while p >= x:
				if n > 0:
					x += li[-1]
					n -= 1
					li.pop()
				else:
					break
			q = x
			b += x
			s = 0
		elif s == 0 and n > 0:
			moves += 1
			x = 0
			while q >= x:
				if n > 0:
					x += li[0]
					n -= 1
					li.popleft()
				else:
					break
			p = x
			a += x
			s = 1
	print(moves, a, b)


from pprint import pprint
import sys
import collections
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	n = int(input())
	dat = list(map(int, input().split()))
	dat = collections.deque(dat)
	cnt = 0
	(alice, bob) = (0, 0)
	prevEat = 0
	isAliceTurn = True
	while len(dat) > 0:
		cnt += 1
		canEat = False
		curEat = 0
		while len(dat) > 0:
			if isAliceTurn:
				xx = dat.popleft()
				curEat += xx
			else:
				xx = dat.pop()
				curEat += xx
			if curEat > prevEat:
				prevEat = curEat
				canEat = True
				break
		if isAliceTurn:
			alice += curEat
		else:
			bob += curEat
		if canEat is False:
			break
		isAliceTurn = not isAliceTurn
	print(cnt, alice, bob)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = 0
	Alice = 0
	Bob = 0
	ca = 0
	cb = 0
	aturn = True
	pm = 0
	while len(a) > 0:
		if aturn:
			v = a.pop(0)
			ca += v
			Alice += v
			if ca > pm or len(a) == 0:
				pm = ca
				ca = 0
				aturn = False
				m += 1
		else:
			v = a.pop(-1)
			cb += v
			Bob += v
			if cb > pm or len(a) == 0:
				pm = cb
				cb = 0
				aturn = True
				m += 1
	print(m, Alice, Bob)


from collections import deque
T = int(input())
for t in range(T):
	n = int(input())
	arr = deque(map(int, input().split()))
	a = 0
	b = 0
	count = 0
	prev = 0
	while len(arr) > 0:
		cur = 0
		while cur <= prev and len(arr) > 0:
			cur += arr.popleft()
		count += 1
		prev = cur
		a += cur
		cur = 0
		if len(arr) == 0:
			break
		while cur <= prev and len(arr) > 0:
			cur += arr.pop()
		count += 1
		prev = cur
		b += cur
	print(count, a, b)


from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
import operator as op
from functools import reduce
import sys

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	n = get_int()
	candies = get_list()
	i = 0
	j = n - 1
	turn = 1
	moves = 0
	alice = 0
	bob = 0
	temp_alice = 0
	temp_bob = 0
	while i <= j:
		if turn:
			temp_alice += candies[i]
			if temp_alice > temp_bob:
				alice += temp_alice
				temp_bob = 0
				turn = not turn
				moves += 1
			i += 1
		else:
			temp_bob += candies[j]
			j -= 1
			if temp_bob > temp_alice:
				bob += temp_bob
				temp_alice = 0
				turn = not turn
				moves += 1
	if not turn and temp_bob > 0:
		bob += temp_bob
		moves += 1
	elif turn and temp_alice > 0:
		alice += temp_alice
		moves += 1
	print(moves, alice, bob)

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


from collections import deque as dq
for t in range(int(input())):
	n = int(input())
	c = dq(list(map(int, input().split())))
	(a, b) = (0, 0)
	cnt = 0
	prev = 0
	while len(c) > 0:
		cnt += 1
		if cnt % 2 == 1:
			tmp = 0
			while tmp <= prev and len(c) > 0:
				tmp += c.popleft()
			a += tmp
			prev = tmp
		else:
			tmp = 0
			while tmp <= prev and len(c) > 0:
				tmp += c.pop()
			b += tmp
			prev = tmp
	print(cnt, a, b)


import sys
import math
import collections

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	n = int(input())
	arr = get_list()
	a = 0
	b = 0
	prev = 0
	dir = 0
	while len(arr) > 0:
		curr = 0
		while curr <= prev:
			if len(arr) > 0:
				if dir % 2 == 0:
					curr += arr.pop(0)
				else:
					curr += arr.pop(-1)
			else:
				break
		if dir % 2 == 0:
			a += curr
		else:
			b += curr
		prev = curr
		dir += 1
	print(dir, a, b)


from queue import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = deque(map(int, input().split()))
	alice = 0
	bob = 0
	move = 0
	prev = 0
	while a:
		move += 1
		tmp = 0
		while tmp <= prev:
			if len(a) == 0:
				break
			tmp += a.popleft()
		alice += tmp
		prev = tmp
		if len(a) == 0:
			break
		move += 1
		tmp = 0
		while tmp <= prev:
			if len(a) == 0:
				break
			tmp += a.pop()
		bob += tmp
		prev = tmp
	print(move, alice, bob)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	a = 0
	b = 0
	i = 0
	j = n - 1
	t = 0
	bp = 0
	ap = 0
	while i <= j:
		x = 0
		y = 0
		t += 1
		if t % 2 == 1:
			while i <= j:
				if ar[i] + x <= bp:
					x += ar[i]
					i += 1
				else:
					x += ar[i]
					i += 1
					break
		else:
			while i <= j:
				if ar[j] + y <= ap:
					y += ar[j]
					j -= 1
				else:
					y += ar[j]
					j -= 1
					break
		bp = y
		ap = x
		a += x
		b += y
	print(t, 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 T in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans1 = 0
	ans2 = 0
	moves = 0
	temp = 0
	while arr:
		c0 = 0
		c1 = 0
		if arr:
			moves += 1
			while c0 <= temp:
				if arr:
					a = arr.pop(0)
					c0 += a
				else:
					break
		ans1 += c0
		temp = c0
		if arr:
			moves += 1
			while c1 <= temp:
				if arr:
					b = arr.pop()
					c1 += b
				else:
					break
		temp = c1
		ans2 += c1
	print(moves, ans1, ans2)


def min_terms(n, arr):
	a = 0
	b = 0
	moves = 1
	turn = 1
	ta = 0
	tb = 0
	while arr:
		if turn == 1:
			num = arr.pop(0)
			a += num
			ta += num
			if ta > tb:
				tb = 0
				moves += 1
				turn = 2
		elif turn == 2:
			num = arr.pop()
			b += num
			tb += num
			if tb > ta:
				ta = 0
				moves += 1
				turn = 1
		if (ta == 0 or tb == 0) and len(arr) == 0:
			moves -= 1
	print(moves, a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	min_terms(n, arr)


t = int(input())
for i in range(t):
	n = int(input())
	arr1 = input().split(' ')
	arr = []
	for i in range(n):
		arr = arr + [int(arr1[i])]
	l = c = 1
	r = n - 1
	a = d = arr[0]
	b = e = 0
	while l <= r:
		if c % 2 == 0:
			while a <= b and l <= r:
				a = a + arr[l]
				d = d + arr[l]
				l = l + 1
			b = 0
			c = c + 1
		else:
			while b <= a and l <= r:
				b = b + arr[r]
				e = e + arr[r]
				r = r - 1
			a = 0
			c = c + 1
	print(c, d, e)


from sys import stdin
input = stdin.readline

def list_input():
	return list(map(int, input().split()))

def sep_input():
	return map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	l = list_input()
	prev = -1
	a = 0
	b = 0
	i = 0
	j = n - 1
	sa = 0
	sb = 0
	moves = 0
	while True:
		f1 = False
		f2 = False
		temp = 0
		for pp in range(i, j + 1):
			temp += l[pp]
			if temp > prev:
				i = pp + 1
				f1 = True
				prev = temp
				break
		if f1:
			sa += prev
			moves += 1
		else:
			sa += temp
			moves += 1
			break
		if i > j:
			break
		temp = 0
		for pp in range(j, i - 1, -1):
			temp += l[pp]
			if temp > prev:
				f2 = True
				j = pp - 1
				prev = temp
				break
		if f2:
			sb += prev
			moves += 1
		else:
			sb += temp
			moves += 1
			break
		if i > j:
			break
	print(moves, sa, sb)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
for _ in range(int(input())):
	n = int(input())
	candy = array()
	at = 0
	bt = 0
	a = 0
	b = 0
	c = 0
	(i, j) = (0, n - 1)
	while i <= j:
		a = 0
		while i <= j and a <= b:
			a += candy[i]
			i += 1
		if a != 0:
			c += 1
		at += a
		if a <= b:
			break
		b = 0
		while i <= j and b <= a:
			b += candy[j]
			j -= 1
		if b != 0:
			c += 1
		bt += b
		if b <= a:
			break
	print(c, at, bt)


for _ in range(int(input())):
	n = int(input())
	arr = [int(s) for s in input().split()]
	left = 1
	right = n - 1
	a = arr[0]
	b = 0
	preva = arr[0]
	prevb = 0
	moves = 1
	while left <= right:
		if moves % 2 == 0:
			eat = 0
			while eat <= prevb and left <= right:
				eat += arr[left]
				left += 1
			moves += 1
			a += eat
			preva = eat
		else:
			eat = 0
			while eat <= preva and left <= right:
				eat += arr[right]
				right -= 1
			moves += 1
			b += eat
			prevb = eat
	print(moves, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = 0
	v = 0
	ca = 0
	cb = n - 1
	la = 0
	lb = 0
	m = 0
	change = 0
	while ca <= cb:
		change = 0
		if v == 0:
			a += l[ca]
			la += l[ca]
			if la > lb:
				lb = 0
				m += 1
				v = 1
				change = 1
			ca += 1
		else:
			b += l[cb]
			lb += l[cb]
			if lb > la:
				la = 0
				m += 1
				v = 0
				change = 1
			cb -= 1
	if change == 0:
		m += 1
	print(str(m) + ' ' + str(a) + ' ' + str(b))


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	num = 1
	a = lis[0]
	b = 0
	vala = lis[0]
	valb = 0
	lis = lis[1:]
	length = len(lis)
	while length != 0:
		if vala > valb:
			n = 1
			while vala >= valb:
				if length < n:
					break
				valb += lis[-n]
				n += 1
			b += valb
			lis = lis[:-n + 1]
			vala = 0
		else:
			n = 0
			while valb >= vala:
				if length <= n:
					break
				vala += lis[n]
				n += 1
			a += vala
			lis = lis[n:]
			valb = 0
		length = len(lis)
		num += 1
	print(num, a, b)


from sys import stdin, stdout
import bisect

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def solve():
	n = inp()
	l = li()
	alice = []
	bob = []
	eat = l[0]
	eatt = 0
	move = 1
	alice.append(l[0])
	i = 1
	j = n - 1
	while i <= j:
		move += 1
		if move & 1:
			eat = 0
			while i <= j and eat <= eatt:
				eat += l[i]
				alice.append(l[i])
				i += 1
		else:
			eatt = 0
			while j >= i and eatt <= eat:
				eatt += l[j]
				bob.append(l[j])
				j -= 1
	print(move, sum(alice), sum(bob))
for _ in range(inp()):
	solve()


t = int(input())
for a in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	AliceAte = nums[0]
	BobAte = 0
	aIndex = 1
	bIndex = len(nums) - 1
	turn = 'b'
	totalTurns = 1
	maxStreak = AliceAte
	while aIndex <= bIndex:
		currentStreak = 0
		while currentStreak <= maxStreak and aIndex <= bIndex:
			if turn == 'b':
				BobAte += nums[bIndex]
				currentStreak += nums[bIndex]
				bIndex -= 1
			else:
				AliceAte += nums[aIndex]
				currentStreak += nums[aIndex]
				aIndex += 1
		maxStreak = currentStreak
		if turn == 'b':
			turn = 'a'
		else:
			turn = 'b'
		totalTurns += 1
	print(totalTurns, AliceAte, BobAte)


numTest = int(input())
for _ in range(numTest):
	thisLength = int(input())
	inputLine = input()
	tempStr = inputLine.split(' ')
	indexAlice = 0
	totalAlice = 0
	indexBob = thisLength - 1
	totalBob = 0
	totalStep = 0
	currentLimit = -1
	while True:
		if totalStep % 2 == 0:
			canEatAlice = 0
			while True:
				if indexAlice <= indexBob:
					canEatAlice = canEatAlice + int(tempStr[indexAlice])
					indexAlice = indexAlice + 1
					if canEatAlice >= currentLimit:
						break
				else:
					break
			currentLimit = canEatAlice + 1
			totalAlice = totalAlice + canEatAlice
		else:
			canEatBob = 0
			while True:
				if indexAlice <= indexBob:
					canEatBob = canEatBob + int(tempStr[indexBob])
					indexBob = indexBob - 1
					if canEatBob >= currentLimit:
						break
				else:
					break
			currentLimit = canEatBob + 1
			totalBob = totalBob + canEatBob
		totalStep = totalStep + 1
		if indexAlice > indexBob:
			print(totalStep, totalAlice, totalBob)
			break


import math
t = int(input())
for tt in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	alice = arr[0]
	bob = 0
	moves = 1
	i = 1
	j = n - 1
	cc = 1
	prealice = arr[0]
	prebob = 0
	while i <= j:
		if cc % 2 == 0:
			temp = 0
			while i <= j and temp <= prebob:
				temp += arr[i]
				i += 1
			if temp <= prebob:
				alice += temp
				moves += 1
				break
			alice += temp
			prealice = temp
		else:
			temp = 0
			while i <= j and temp <= prealice:
				temp += arr[j]
				j -= 1
			if temp <= prealice:
				bob += temp
				moves += 1
				break
			bob += temp
			prebob = temp
		moves += 1
		cc += 1
	print(moves, alice, bob)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	p = 0
	(i, j) = (-1, n)
	(s1, s2) = (0, 0)
	c = 0
	while i < j - 1:
		s = 0
		if i < j - 1:
			c += 1
		while i < j - 1 and s <= p:
			i += 1
			s += a[i]
		s1 += s
		p = s
		s = 0
		if j > i + 1:
			c += 1
		while j > i + 1 and s <= p:
			j -= 1
			s += a[j]
		s2 += s
		p = s
	print(c, s1, s2)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		n = I()
		arr = L()
		(sa, sb) = (0, 0)
		a = 0
		b = 0
		t = 1
		l = 0
		r = n - 1
		x = 0
		while r >= l:
			x += 1
			if t == 1:
				a = 0
				while a <= b and l <= r:
					a += arr[l]
					sa += arr[l]
					l += 1
			else:
				b = 0
				while b <= a and r >= l:
					b += arr[r]
					sb += arr[r]
					r -= 1
			t *= -1
		print(x, sa, sb)
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	L = l.copy()
	a = []
	b = []
	i = 1
	c = L[0]
	while len(L) > 0:
		d = []
		if sum(L) >= c:
			if i % 2 == 1:
				while sum(d) < c:
					d.append(L[0])
					L.pop(0)
				c = sum(d) + 1
				a.extend(d)
				i += 1
			elif i % 2 == 0:
				while sum(d) < c:
					d.append(L[-1])
					L.pop(-1)
				c = sum(d) + 1
				b.extend(d)
				i += 1
		else:
			d.extend(L)
			L.clear()
			if i % 2 == 1:
				a.extend(d)
				i += 1
			elif i % 2 == 0:
				b.extend(d)
				i += 1
	e = []
	e.append(i - 1)
	e.append(sum(a))
	e.append(sum(b))
	print(*e)


for _ in range(int(input())):
	n = int(input())
	candies = list(map(int, input().split()))
	a = -1
	b = n
	alic = bhob = mov = 0
	mx = 0
	while a < b and n != 1:
		t = 0
		while t <= mx and a < b:
			a += 1
			if a == b:
				break
			alic += candies[a]
			t += candies[a]
		if a == b:
			if t > 0:
				mov += 1
			break
		mov += 1
		if b - a == 1:
			break
		mx = max(mx, t)
		t = 0
		while t <= mx and a < b:
			b -= 1
			if a == b:
				break
			bhob += candies[b]
			t += candies[b]
		if a == b:
			if t > 0:
				mov += 1
			break
		mov += 1
		mx = max(mx, t)
		if b - a == 1:
			break
	if n == 1:
		print(1, candies[0], 0)
	else:
		print(mov, alic, bhob)


t = int(input())
for _ in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = 0
	c = 0
	x = 0
	lasta = 0
	lastb = 0
	while True:
		lasta = 0
		while len(l) > 0 and lasta <= lastb:
			a = a + l[0]
			lasta = lasta + l[0]
			del l[0]
			x = 1
		if x == 1:
			c = c + 1
			x = 0
		if lasta < lastb:
			break
		lastb = 0
		while len(l) > 0 and lastb <= lasta:
			lastb = lastb + l[len(l) - 1]
			b = b + l[len(l) - 1]
			del l[len(l) - 1]
			x = 1
		if x == 1:
			c = c + 1
			x = 0
		if lastb < lasta:
			break
	print(c, end=' ')
	print(a, end=' ')
	print(b, end=' ')


t = int(input())

def to_sum(a):
	res = []
	for (i, n) in enumerate(a):
		num = int(str(n) + '0' * (len(a) - i - 1))
		if num != 0:
			res.append(num)
	return res
for _ in range(t):
	n = input()
	ai = list(map(int, input().split()))
	bob_p = len(ai) - 1
	alice_p = 0
	alice_sweet = 0
	bob_sweet = 0
	alice_turn = True
	alice_sum = 0
	bob_sum = 0
	turns = 1
	while bob_p >= alice_p:
		if alice_turn:
			alice_sweet += ai[alice_p]
			if alice_sweet > bob_sweet:
				bob_sweet = 0
				alice_turn = False
				turns += 1
			alice_sum += ai[alice_p]
			alice_p += 1
		else:
			bob_sweet += ai[bob_p]
			if bob_sweet > alice_sweet:
				alice_sweet = 0
				alice_turn = True
				turns += 1
			bob_sum += ai[bob_p]
			bob_p -= 1
	if alice_turn and alice_sweet == 0 or (not alice_turn and bob_sweet == 0):
		turns -= 1
	print(turns, alice_sum, bob_sum)


def solve():
	n = int(input())
	total_sums = [0, 0]
	sums = [0, 0]
	cnt = 0
	a = list(map(int, input().split()))
	pointer_a = 0
	pointer_b = len(a) - 1
	while pointer_a <= pointer_b:
		cnt += 1
		while pointer_a <= pointer_b and sums[0] <= sums[1]:
			sums[0] += a[pointer_a]
			total_sums[0] += a[pointer_a]
			pointer_a += 1
		sums[1] = 0
		if not pointer_a <= pointer_b:
			break
		cnt += 1
		while pointer_a <= pointer_b and sums[1] <= sums[0]:
			sums[1] += a[pointer_b]
			total_sums[1] += a[pointer_b]
			pointer_b -= 1
		sums[0] = 0
	print(cnt, *total_sums)
for i in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ab = [0, 0]
	d = 0
	pa = 0
	pb = n - 1
	cnt = 0
	while pa <= pb:
		s = 0
		while pa <= pb and s <= d:
			if cnt % 2 == 0:
				s += arr[pa]
				pa += 1
			else:
				s += arr[pb]
				pb -= 1
		ab[cnt % 2] += s
		d = s
		cnt += 1
	print(cnt, *ab)


for i in range(int(input())):
	(n, k) = (int(input()), list(map(int, input().split())))
	Alice_eat = []
	Bob_eat = []
	Alice_eat.append([k[0]])
	del k[0]
	moves = 0
	while k:
		Bob_eat.append([k[-1]])
		del k[-1]
		while sum(Bob_eat[-1]) <= sum(Alice_eat[-1]) and k:
			Bob_eat[-1].append(k[-1])
			del k[-1]
		moves += 1
		if not k:
			break
		Alice_eat.append([k[0]])
		del k[0]
		while sum(Alice_eat[-1]) <= sum(Bob_eat[-1]) and k:
			Alice_eat[-1].append(k[0])
			del k[0]
		moves += 1
	print(moves + 1, sum(map(sum, Alice_eat)), sum(map(sum, Bob_eat)))


def solve(n, candies):
	a_prev = candies[0]
	a_total = candies[0]
	a_index = 0
	b_index = n
	b_total = 0
	numMoves = 1
	aTurn = False
	while a_index + 1 != b_index:
		if aTurn:
			a_prev = 0
			while a_index + 1 != b_index and a_prev < b_prev + 1:
				a_prev += candies[a_index + 1]
				a_index += 1
			a_total += a_prev
		else:
			b_prev = 0
			while b_index - 1 != a_index and b_prev < a_prev + 1:
				b_prev += candies[b_index - 1]
				b_index -= 1
			b_total += b_prev
		aTurn = not aTurn
		numMoves += 1
	print(numMoves, a_total, b_total)
numTests = int(input())
for test in range(numTests):
	n = int(input())
	candies = [int(candy) for candy in input().split()]
	solve(n, candies)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(alice, alice_curr) = (0, 0)
	(bob, bob_curr) = (0, 0)
	turns = 0
	alice_ptr = 0
	bob_ptr = -1
	alice_turn = 1
	while alice_ptr <= n + bob_ptr:
		if alice_turn:
			alice_curr = 0
			while alice_ptr <= n + bob_ptr and alice_curr <= bob_curr:
				alice += a[alice_ptr]
				alice_curr += a[alice_ptr]
				alice_ptr += 1
		else:
			bob_curr = 0
			while alice_ptr <= n + bob_ptr and bob_curr <= alice_curr:
				bob += a[bob_ptr]
				bob_curr += a[bob_ptr]
				bob_ptr -= 1
		turns += 1
		alice_turn ^= 1
	print(turns, alice, bob)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	u = 0
	w = 0
	v = 0
	s = 0
	x = 0
	y = 0
	z = 0
	while True:
		while v <= s:
			if len(a) > 0:
				v = v + a[0]
				del a[0]
			else:
				x = x + v
				u = 1
				break
		if v != 0:
			w = w + 1
		if u == 1:
			break
		x = x + v
		s = v
		v = 0
		while v <= s:
			if len(a) > 0:
				v = v + a[-1]
				a.pop()
			else:
				y = y + v
				u = 1
				break
		if v != 0:
			w = w + 1
		if u == 1:
			break
		y = y + v
		s = v
		v = 0
	print(str(w) + ' ' + str(x) + ' ' + str(y))


from sys import stdin

def solve(n, L):
	sum_a = 0
	sum_b = 0
	size = 0
	a = 0
	b = n - 1
	count = 0
	val = 0
	while a <= b:
		size = 0
		flag = 0
		while size <= val and a <= b:
			size += L[a]
			flag = 1
			a += 1
		sum_a += size
		if flag == 1:
			count += 1
		val = 0
		flag = 0
		while val <= size and a <= b:
			val += L[b]
			b -= 1
			flag = 1
		sum_b += val
		if flag == 1:
			count += 1
	print(count, sum_a, sum_b)
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	L = list(map(int, stdin.readline().split()))
	solve(n, L)


def main():
	import sys, math
	from heapq import heapify, heappush, heappop
	from collections import defaultdict as dd, deque

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

	def mdata():
		return list(map(int, data().split()))

	def out(*var, end='\n'):
		sys.stdout.write(' '.join(map(str, var)) + end)
	INF = int(1000000000.0)
	mod = int(1000000000.0) + 7
	for t in range(int(data())):
		(n,) = mdata()
		A = mdata()
		(a, b) = (0, 0)
		a1 = 0
		b1 = 0
		(inda, indb) = (0, n - 1)
		k = 0
		cnt = 0
		while inda <= indb:
			if k == 0:
				a += A[inda]
				a1 += A[inda]
				inda += 1
				if a1 > b1:
					k = 1
					cnt += 1
					b1 = 0
			else:
				b += A[indb]
				b1 += A[indb]
				indb -= 1
				if b1 > a1:
					k = 0
					cnt += 1
					a1 = 0
		if k == 0 and a1 != 0 or (k == 1 and b1 != 0):
			cnt += 1
		print(cnt, a, b)
main()


for ii in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	alice = 0
	bob = n - 1
	a1 = []
	a2 = []
	moves = 0
	curralice = 0
	currbob = 0
	turn = 1
	while alice <= bob:
		if turn:
			f = 0
			while curralice <= currbob and alice <= bob:
				f = 1
				curralice += arr[alice]
				alice += 1
			if f:
				moves += 1
				a1.append(curralice)
			currbob = 0
		else:
			f = 0
			while currbob <= curralice and bob >= alice:
				f = 1
				currbob += arr[bob]
				bob -= 1
			if f:
				a2.append(currbob)
				moves += 1
			curralice = 0
		turn = not turn
	print(moves, sum(a1), sum(a2))


t = int(input())
while t:
	t -= 1
	n = int(input())
	c = [int(i) for i in input().split()]
	i = 1
	a = 0
	b = 0
	a_pos = 1
	b_pos = n - 1
	a = c[0]
	prev = a
	while a_pos <= b_pos:
		cur = 0
		while cur <= prev and a_pos <= b_pos:
			if i % 2:
				cur += c[b_pos]
				b_pos -= 1
			else:
				cur += c[a_pos]
				a_pos += 1
		if i % 2:
			b += cur
		else:
			a += cur
		prev = cur
		i += 1
	print(i, a, b)


from collections import Counter
from collections import defaultdict
import math
import sys
input = sys.stdin.readline
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
from collections import deque
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = rl()
	a1 = 0
	a2 = 0
	s1 = 0
	s2 = 0
	l = 0
	r = n - 1
	prev = a[0]
	c = 0
	for i in range(0, n):
		if i % 2 == 0:
			c = c + 1
			if i == 0:
				a1 = a1 + a[0]
				prev = a[0]
				a[l] = -1
				l = l + 1
			else:
				a1 = 0
				while a[l] != -1:
					if a1 > prev:
						prev = a1
						break
					a1 = a1 + a[l]
					a[l] = -1
					l = l + 1
			s1 = s1 + a1
		else:
			c = c + 1
			a2 = 0
			while a[r] != -1:
				if a2 > prev:
					prev = a2
					break
				a2 = a2 + a[r]
				a[r] = -1
				r = r - 1
			s2 = s2 + a2
		if a[r] == -1 or a[l] == -1:
			break
	print(c, s1, s2)


(t, _) = (int(input()), 0)
while _ < t:
	n = int(input())
	sizes = list(map(int, input().split()))
	(c, alice, bob) = (0, 0, 0)
	(i, j, k) = (0, 0, n - 1)
	(cur_a, cur_b) = (0, 0)
	while i < n:
		if c % 2 == 0:
			cur_a += sizes[j]
			j += 1
			i += 1
			while cur_a <= cur_b and j <= k:
				cur_a += sizes[j]
				j += 1
				i += 1
			alice += cur_a
			cur_b = 0
			c += 1
		else:
			cur_b += sizes[k]
			k -= 1
			i += 1
			while cur_b <= cur_a and j <= k:
				cur_b += sizes[k]
				k -= 1
				i += 1
			bob += cur_b
			cur_a = 0
			c += 1
	print(c, alice, bob)
	_ += 1


t = int(input())
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	(l, r) = (0, n - 1)
	(a, b) = (0, 0)
	(pa, pb) = (0, 0)
	z = 0
	ct = 0
	while z == 0:
		(tl, tr) = (l, r)
		(sa, sb) = (0, 0)
		st = 0
		while sa <= pb and z == 0:
			sa += ar[tl]
			if tl >= r:
				z = 1
				st = 1
				break
			tl += 1
		a += sa
		pa = sa
		ct += 1
		l = tl
		while sb <= pa and z == 0:
			sb += ar[tr]
			if tr <= l:
				z = 1
				break
			tr -= 1
		b += sb
		pb = sb
		if st == 0:
			ct += 1
		r = tr
	print(ct, a, b)


GI = lambda : int(input())
GIS = lambda : map(int, input().split())
LGIS = lambda : list(GIS())

def main():
	for t in range(GI()):
		n = GI()
		arr = LGIS()
		l = -1
		r = n
		last_eat = 0
		alice_ate = bob_ate = 0
		rounds = 0
		while l < r:
			eat = 0
			while eat <= last_eat:
				l += 1
				if l >= r:
					break
				eat += arr[l]
				alice_ate += arr[l]
			if eat:
				rounds += 1
				last_eat = eat
			if l >= r:
				break
			eat = 0
			while eat <= last_eat:
				r -= 1
				if l >= r:
					break
				eat += arr[r]
				bob_ate += arr[r]
			if eat:
				rounds += 1
				last_eat = eat
		print(rounds, alice_ate, bob_ate)
main()


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)


n = int(input())
for x in range(n):
	q = int(input())
	t = list(map(int, input().split()))
	sq = set()
	counter = 0
	counter2 = q - 1
	suma = 0
	prevsuma = 0
	prevsumb = 0
	sumb = 0
	current = 0
	tl = 0
	steps = 0
	while True:
		if tl == 0:
			if counter not in sq:
				sq.add(counter)
				suma += t[counter]
				if t[counter] <= current:
					current -= t[counter]
				else:
					current = suma - prevsuma
					prevsuma = suma
					tl = 1
					steps += 1
				counter += 1
			else:
				break
		elif counter2 not in sq:
			sq.add(counter2)
			sumb += t[counter2]
			if t[counter2] <= current:
				current -= t[counter2]
			else:
				current = sumb - prevsumb
				prevsumb = sumb
				tl = 0
				steps += 1
			counter2 -= 1
		else:
			break
	if prevsuma != suma or prevsumb != sumb:
		steps += 1
	print(steps, suma, sumb, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	alice = 0
	ali = 0
	bob = 0
	bo = 0
	c = 0
	i = 0
	j = -1
	while sum(a) > 0:
		ali = 0
		c += 1
		while ali <= bo:
			if len(a) > 0:
				alice += a[i]
				ali += a[i]
				del a[i]
			else:
				break
		bo = 0
		if sum(a) > 0:
			c += 1
			while bo <= ali:
				if len(a) > 0:
					bob += a[j]
					bo += a[j]
					del a[j]
				else:
					break
	print(c, alice, bob)


from math import sqrt
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	moves = 0
	a = 0
	b = 0
	candies = 0
	while len(arr) > 0:
		if moves % 2 == 0:
			eaten = 0
			while eaten <= candies:
				eaten += arr[0]
				arr = arr[1:]
				if len(arr) == 0:
					break
			candies = eaten
			a += eaten
			moves += 1
		else:
			eaten = 0
			while eaten <= candies:
				eaten += arr[-1]
				arr = arr[:-1]
				if len(arr) == 0:
					break
			candies = eaten
			b += eaten
			moves += 1
	print(moves, a, b)


def solve():
	n = int(input())
	c = list(map(int, input().split()))
	a = 0
	b = 0
	current = 0
	prev = 0
	turn = 0
	aliceturn = True
	while c:
		if aliceturn:
			current += c.pop(0)
		else:
			current += c.pop()
		if current > prev:
			turn += 1
			if aliceturn:
				a += current
			else:
				b += current
			prev = current
			current = 0
			aliceturn = not aliceturn
	if current:
		turn += 1
		if aliceturn:
			a += current
		else:
			b += current
	print(turn, a, b)
for _ in range(int(input())):
	solve()


from collections import *
from itertools import *
from functools import *
import sys
import os
import time
timer = False
debug = False

def timeit(method):

	def wrapper(*args, **kwargs):
		mname = method.__name__
		if debug:
			print('{}(args:{}, kwargs:{})'.format(mname, args, kwargs))
		if timer:
			ts = time.time()
		result = method(*args, **kwargs)
		if timer:
			te = time.time()
			print('%r  %2.2f ms' % (mname, (te - ts) * 1000))
		return result
	return wrapper

def read_ints():
	return list(map(int, input().split()))

def read_floats():
	return list(map(float, input().split()))

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

@timeit
def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = read_ints()
		(alex, bob) = (0, 0)
		(alex_prev, bob_prev) = (0, 0)
		(i, j) = (0, len(arr) - 1)
		moves = 0
		while True:
			moves += 1
			if moves % 2 == 1:
				while i <= j and alex_prev <= bob_prev:
					alex_prev += arr[i]
					i += 1
				bob_prev = 0
				alex += alex_prev
			else:
				while i <= j and alex_prev >= bob_prev:
					bob_prev += arr[j]
					j -= 1
				alex_prev = 0
				bob += bob_prev
			if i > j:
				break
		print(moves, alex, bob)
main()


for _ in range(int(input())):
	d = int(input())
	arr = [int(i) for i in input().split()]
	i = 1
	j = d - 1
	countI = arr[0]
	countE = 0
	countS = 1
	countET = 0
	countIT = arr[0]
	while i <= j:
		if countE < countI:
			while countE <= countI and i <= j:
				countE += arr[j]
				countET += arr[j]
				j = j - 1
			countI = 0
			countS += 1
		elif countI < countE:
			while countI <= countE and i <= j:
				countIT += arr[i]
				countI += arr[i]
				i = i + 1
			countE = 0
			countS += 1
	print(countS, countIT, countET)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	alice = a.pop(0)
	bob = 0
	n -= 1
	move = 1
	previous = alice
	flag = False
	while n > 0:
		current = 0
		if move % 2 != 0:
			while current <= previous:
				if n == 0:
					break
				current += a.pop()
				n -= 1
			bob += current
		else:
			while current <= previous:
				if n == 0:
					break
				current += a.pop(0)
				n -= 1
			alice += current
		previous = current
		move += 1
	if flag:
		move -= 1
		if move % 2 != 0:
			bob -= previous
		else:
			alice -= previous
	print(move, alice, bob)


for _ in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	(r, x, y, u, v) = (0, 0, 0, 0, 0)
	(a, b) = (0, n)
	while a < b:
		r += 1
		x = 0
		while a < b and x <= y:
			x += c[a]
			a += 1
		u += x
		if a < b:
			r += 1
			y = 0
			while a < b and y <= x:
				b -= 1
				y += c[b]
			v += y
	print(r, u, v)


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	a = il()
	i = 0
	j = n - 1
	da = ea = 0
	db = eb = 0
	turn = 1
	moves = 0
	while i <= j:
		if turn:
			da = 0
			while da <= db and i <= j:
				da += a[i]
				i += 1
			ea += da
		else:
			db = 0
			while db <= da and i <= j:
				db += a[j]
				j -= 1
			eb += db
		moves += 1
		if turn == 0:
			turn = turn + 1
		else:
			turn = turn - 1
	print(moves, ea, eb)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	a = 0
	b = n - 1
	(ac, bc, m) = (0, 0, 0)
	(atot, btot) = (0, 0)
	while a <= b:
		while ac <= bc and a <= b:
			ac += l[a]
			a += 1
		atot += ac
		bc = 0
		m += 1
		if a > b:
			break
		while bc <= ac and a <= b:
			bc += l[b]
			b -= 1
		btot += bc
		ac = 0
		m += 1
	print(m, atot, btot)


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	su = 0
	se = 0
	sa = 0
	sb = 0
	b = []
	count = 0
	while len(a) != 0:
		for i in range(0, len(a)):
			if count + a[0] <= su:
				count += a[0]
				a.remove(a[0])
			else:
				count += a[0]
				a.remove(a[0])
				break
		su = count
		b.append(count)
		count = 0
		a = a[::-1]
		se += 1
	for i in range(0, len(b), 2):
		sa += b[i]
	sb = sum(b) - sa
	print(se, sa, sb)


t = int(input())
for v in range(t):
	n = int(input())
	li = list(map(int, input().split(' ')))
	low = 0
	high = n - 1
	size_a = 0
	size_b = 0
	i = 0
	ma = 0
	while low <= high:
		if i % 2 == 0:
			temp = 0
			while low <= high and temp <= ma:
				size_a += li[low]
				temp += li[low]
				low += 1
			ma = temp
		else:
			temp = 0
			while low <= high and temp <= ma:
				size_b += li[high]
				temp += li[high]
				high -= 1
			ma = temp
		i += 1
	print(i, size_a, size_b)
	print()


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	moves = 0
	a = 0
	b = 0
	tempround = 0
	turn = 0
	while len(arr) > 0:
		temp = 0
		while temp <= tempround and len(arr) > 0:
			item = arr.pop(-turn)
			temp += item
			if turn % 2 == 1:
				b += item
			else:
				a += item
		tempround = temp
		turn += 1
		turn %= 2
		moves += 1
	print(moves, a, b, sep='\n')
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	i = 0
	j = n - 1
	turn = 0
	a = 0
	b = 0
	last_a = 0
	last_b = 0
	c = 0
	while i <= j:
		if c % 2 == 0:
			s = 0
			for x in range(i, j + 1):
				s += lst[x]
				i = x + 1
				if s > last_b:
					last_a = s
					break
			a += s
			c += 1
		else:
			s = 0
			f = 0
			for x in range(j, i - 1, -1):
				s += lst[x]
				j = x - 1
				if s > last_a:
					last_b = s
					break
			b += s
			c += 1
	print(c, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	l = 0
	r = n - 1
	alice = 0
	bob = 0
	moves = 0
	newa = a[l]
	l += 1
	alice += newa
	moves += 1
	if l != r + 1:
		while l != r + 1:
			newb = 0
			while l != r + 1 and newb <= newa:
				newb += a[r]
				r -= 1
			bob += newb
			moves += 1
			if l == r + 1:
				break
			newa = 0
			while l != r + 1 and newa <= newb:
				newa += a[l]
				l += 1
			alice += newa
			moves += 1
	print(moves, alice, bob)


T = int(input())
for t in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	i = 1
	j = n - 1
	alice_total_size = A[0]
	bob_total_size = 0
	prev_size_i = A[0]
	prev_size_j = -1
	alice_playing = False
	moves = 1
	while i <= j:
		if alice_playing:
			s = 0
			while s <= prev_size_j and i <= j:
				s += A[i]
				i += 1
			prev_size_i = s
			alice_total_size += s
			alice_playing = False
			moves += 1
		else:
			s = 0
			while s <= prev_size_i and i <= j:
				s += A[j]
				j -= 1
			prev_size_j = s
			bob_total_size += s
			alice_playing = True
			moves += 1
	print(moves, alice_total_size, bob_total_size)


import sys
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def read():
	c = 0
	if c:
		input = sys.stdin.readline
	else:
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')

def solve():
	for _ in range(ii()):
		n = ii()
		a = li()
		b = [0] * 2
		f = 1
		i = 1
		b[0] += a[0]
		j = n - 1
		c2 = 0
		c1 = a[0]
		c = 1
		while i <= j:
			if f == 0:
				c1 = 0
				while c1 <= c2:
					if i > j:
						break
					c1 += a[i]
					b[f] += a[i]
					i += 1
			else:
				c2 = 0
				while c2 <= c1:
					if j < i:
						break
					c2 += a[j]
					b[f] += a[j]
					j -= 1
			f ^= 1
			c += 1
		print(c, b[0], b[1])
solve()


a = int(input())

def candy(lst, prev, reverse):
	total = 0
	if reverse:
		for i in range(len(lst)):
			i = len(lst) - i - 1
			total += lst[i]
			if total > prev or i == 0:
				del lst[i:]
				return (total, lst)
	else:
		for i in range(len(lst)):
			total += lst[i]
			if total > prev or i == len(lst) - 1:
				del lst[:i + 1]
				return (total, lst)
for ifei in range(a):
	num = int(input())
	lst = input().split()
	lst = [int(i) for i in lst]
	a = 0
	b = 0
	count = -1
	prev = 0
	while len(lst) > 0:
		count += 1
		if count % 2 == 0:
			lst2 = candy(lst, prev, False)
			a = a + lst2[0]
			prev = lst2[0]
			lst = lst2[1]
		else:
			lst2 = candy(lst, prev, True)
			b = b + lst2[0]
			prev = lst2[0]
			lst = lst2[1]
	print(count + 1, a, b)


from sys import stdin

def solve(n, a):
	(ac, bc) = (0, n - 1)
	(x, y) = (0, 0)
	(aa, ba) = (0, 0)
	m = 0
	f = True
	while ac <= bc:
		m += 1
		if f:
			x = 0
			while x <= y and ac <= bc:
				x += a[ac]
				ac += 1
			aa += x
			if x <= y:
				break
		else:
			y = 0
			while y <= x and ac <= bc:
				y += a[bc]
				bc -= 1
			ba += y
			if y <= x:
				break
		f = not f
	print(m, aa, ba)

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		n = int(inp())
		a = list(map(int, inp().split()))
		solve(n, a)
main()


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	left = 0
	right = len(a) - 1
	maxx = a[0] - 1
	alise = 0
	bob = 0
	cnt = 1
	cur = 0
	while left <= right:
		if cnt % 2 == 1:
			alise += a[left]
			cur += a[left]
			left += 1
			if cur > maxx:
				maxx = cur
				cur = 0
				cnt += 1
		else:
			bob += a[right]
			cur += a[right]
			right -= 1
			if cur > maxx:
				maxx = cur
				cur = 0
				cnt += 1
	if cur > 0:
		cnt += 1
	print(cnt - 1, alise, bob)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 1
	i = 1
	s1 = a[0]
	ans1 = s1
	j = n - 1
	s2 = 0
	ans2 = 0
	f = 1
	while i <= j:
		if f == 1:
			c += 1
			f = 0
			s2 = 0
			for x in range(j, i - 1, -1):
				s2 += a[x]
				if s2 > s1:
					ans2 += s2
					break
			else:
				ans2 += s2
				break
			j = x - 1
		else:
			c += 1
			f = 1
			s1 = 0
			for x in range(i, j + 1):
				s1 += a[x]
				if s1 > s2:
					ans1 += s1
					break
			else:
				ans1 += s1
				break
			i = x + 1
	print(c, ans1, ans2)


def main():
	t = int(input())
	arr = []
	for i in range(t):
		temp = input()
		arr.append(list(map(int, input().split())))
	for j in range(t):
		countcandies(arr[j])

def countcandies(candylist):
	count = 0
	alice = 0
	bob = 0
	i = 0
	j = -1
	total = [0, 0]
	while candylist != []:
		sumalice = i = 0
		while sumalice <= bob:
			if i < len(candylist):
				sumalice += candylist[i]
			else:
				count += 1
				total[0] += sumalice
				candylist = []
				break
			if sumalice > bob:
				alice = sumalice
				total[0] += sumalice
				count += 1
				candylist = candylist[i + 1:]
				break
			i += 1
		if candylist != []:
			sumbob = 0
			j = -1
			while sumbob <= alice:
				if j * -1 <= len(candylist):
					sumbob += candylist[j]
				else:
					count += 1
					total[1] += sumbob
					candylist = []
					break
				if sumbob > alice:
					bob = sumbob
					total[1] += sumbob
					count += 1
					candylist = candylist[:j]
					break
				j -= 1
	print(count, total[0], total[1])
main()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	arr = deque(l())
	(a, b) = (0, 0)
	p = 0
	chance = 0
	while arr:
		temp = 0
		if chance & 1:
			while arr and temp <= p:
				temp += arr.pop()
			b += temp
		else:
			while arr and temp <= p:
				temp += arr.popleft()
			a += temp
		p = temp
		chance += 1
	out(chance, a, b)


import math
from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	arr = deque([int(p) for p in input().split()])
	count1 = arr.popleft()
	curr1 = count1
	count2 = 0
	curr2 = 0
	move = 1
	i = 0
	j = n - 1
	counter = 0
	while True:
		ok = True
		if move == 1:
			while curr2 <= curr1:
				try:
					curr2 += arr.pop()
				except IndexError:
					ok = False
					if curr2:
						counter += 1
					break
			counter += 1
			count2 += curr2
			curr1 = 0
			move = 0
		else:
			while curr1 <= curr2:
				try:
					curr1 += arr.popleft()
				except IndexError:
					ok = False
					if curr1:
						counter += 1
					break
			counter += 1
			count1 += curr1
			curr2 = 0
			move = 1
		if not ok:
			break
	print(counter, count1, count2)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	turn = 'a'
	prev = 0
	count = 0
	sizea = 0
	sizeb = 0
	while True:
		if turn == 'a':
			size = 0
			while a and size <= prev:
				size += a.pop(0)
			sizea += size
			count += 1
			if a and size > prev:
				prev = size
				turn = 'b'
			else:
				break
		else:
			size = 0
			while a and size <= prev:
				size += a.pop()
			sizeb += size
			count += 1
			if a and size > prev:
				prev = size
				turn = 'a'
			else:
				break
	print(count, sizea, sizeb)


import getopt
import sys
import math
onlyCase = -1
verbose = False
try:
	(opts, args) = getopt.getopt(sys.argv[1:], 'vc:', ['case='])
except getopt.GetoptError as err:
	print(str(err))
	sys.exit(2)
for (o, a) in opts:
	if o in ('-c', '--case'):
		onlyCase = int(a)
	elif o == '-v':
		verbose = True
	else:
		sys.exit()
ncases = int(input())
for c in range(1, ncases + 1):
	_ = input()
	A = [int(x) for x in input().split()]
	if onlyCase != -1 and onlyCase != c:
		continue
	s1 = s2 = 0
	moves = 0
	p1 = -1
	p2 = len(A)
	if verbose:
		print(A)
	lsum = 0
	tasum = tbsum = 0
	while p1 + 1 < p2:
		asum = 0
		moves += 1
		while asum <= lsum and p1 + 1 < p2:
			p1 += 1
			asum += A[p1]
		lsum = asum
		tasum += asum
		if verbose:
			print('[%d] Alice: %d -> %d ' % (moves, asum, tasum))
		if verbose:
			print('%d %d' % (p1, p2))
		if not p1 + 1 < p2:
			break
		bsum = 0
		moves += 1
		while bsum <= lsum and p1 + 1 < p2:
			p2 -= 1
			bsum += A[p2]
		lsum = bsum
		tbsum += bsum
		if verbose:
			print('[%d] Bob: %d -> %d' % (moves, bsum, tbsum))
	print('%d %d %d' % (moves, tasum, tbsum))


import collections
n = int(input())
for i in range(n):
	t = int(input())
	arr = collections.deque(list(map(int, input().split())))
	alice = 0
	bob = 0
	alice += arr.popleft()
	last = alice
	check = -1
	progress = 1
	while len(arr) != 0:
		sum = 0
		if check == -1:
			while sum <= last and len(arr) != 0:
				sum += arr.pop()
			bob += sum
		else:
			while sum <= last and len(arr) != 0:
				sum += arr.popleft()
			alice += sum
		last = sum
		check *= -1
		progress += 1
	print(progress, alice, bob)


t = int(input())
while t != 0:
	n = int(input())
	arr = list(map(int, input().split()))[:n]
	i = 1
	j = n - 1
	turn = 1
	player0 = arr[0]
	player1 = 0
	chances = 1
	eatenInMove0 = arr[0]
	eatenInMove1 = 0
	discnt = 0
	if n == 1:
		print(1, player0, player1)
	else:
		while discnt == 0:
			if turn == 0:
				while eatenInMove0 <= eatenInMove1 and i <= j:
					if i == j:
						discnt = 1
					player0 += arr[i]
					eatenInMove0 += arr[i]
					i += 1
				eatenInMove1 = 0
				turn = 1
				chances += 1
			else:
				while eatenInMove1 <= eatenInMove0 and i <= j:
					if i == j:
						discnt = 1
					player1 += arr[j]
					eatenInMove1 += arr[j]
					j -= 1
				eatenInMove0 = 0
				turn = 0
				chances += 1
		print(chances, player0, player1)
	t -= 1


import collections
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	dq = collections.deque(arr)
	(a, b, m) = (0, 0, 0)
	x = 0
	y = 0
	f = 0
	while len(dq) > 0:
		if f == 0:
			temp = 0
			while len(dq) > 0 and temp <= y:
				temp += dq[0]
				dq.popleft()
			f = 1
			m += 1
			x = temp
			a += temp
		else:
			temp = 0
			while len(dq) > 0 and temp <= x:
				temp += dq[-1]
				dq.pop()
			f = 0
			m += 1
			y = temp
			b += temp
	print(m, a, b)


for __ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(m, a, b) = (1, arr[0], 0)
	(i, j) = (1, n - 1)
	x = arr[0]
	while i < j:
		curr = 0
		if m % 2 == 1:
			while j >= i and curr <= x:
				curr += arr[j]
				b += arr[j]
				j -= 1
		else:
			while i <= j and curr <= x:
				curr += arr[i]
				a += arr[i]
				i += 1
		(x, m) = (curr, m + 1)
	rem = False
	if m % 2 == 1:
		while j >= i:
			rem = True
			b += arr[j]
			j -= 1
	else:
		while i <= j:
			rem = True
			a += arr[i]
			i += 1
	if rem:
		m = m + 1
	print(str(m) + ' ' + str(a) + ' ' + str(b))


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	c = a = b = 0
	i = -1
	j = n
	x = y = 0
	k = 0
	while i < j:
		if c % 2 == 0:
			a = 0
			while a <= b and i < j:
				i += 1
				if i == j:
					k = 1
					break
				a += l[i]
			x += a
			if k != 1 or (k == 1 and a != 0):
				c += 1
		else:
			b = 0
			while b <= a and i < j:
				j -= 1
				if i == j:
					k = 1
					break
				b += l[j]
			y += b
			if k != 1 or (k == 1 and b != 0):
				c += 1
	print(c, x, y)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	alt = 0
	bt = 0
	cal = 0
	cb = 0
	al = 0
	b = 0
	while len(a) != 0:
		cbt = False
		calt = False
		while al <= b and len(a) != 0:
			calt = True
			i = 0
			al = al + a[i]
			a.pop(i)
			if len(a) == 0:
				break
		if calt:
			b = 0
			alt = alt + al
			cal = cal + 1
		while b <= al and len(a) != 0:
			cbt = True
			i = len(a) - 1
			b = b + a[i]
			a.pop(i)
			if len(a) == 0:
				break
		if cbt:
			al = 0
			bt = bt + b
			cb = cb + 1
	print(cal + cb, alt, bt)


def solve(n, arr):
	pointers = [0, len(arr) - 1]
	other = [1, 0]
	inc = [1, -1]
	total = [0, 0]
	last_eaten = [0, 0]
	num_moves = 0
	i = 0
	not_done = True
	while not_done:
		i %= 2
		cur_eaten = 0
		while cur_eaten <= last_eaten[other[i]]:
			cur_eaten += arr[pointers[i]]
			pointers[i] += inc[i]
			if pointers[0] > pointers[1]:
				not_done = False
				break
		last_eaten[i] = cur_eaten
		total[i] += cur_eaten
		num_moves += 1
		i += 1
	return [num_moves, total[0], total[1]]
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	res = solve(n, arr)
	print(' '.join(map(str, res)))


from collections import deque
t = int(input())
while t > 0:
	n = int(input())
	q = deque(list(map(int, input().split())))
	(alice, bob, moves) = ([0, 0], [0, 0], 0)
	alice_turn = True
	total_moves = 0
	while q:
		if alice_turn:
			tmp = 0
			while q and tmp <= bob[1]:
				tmp += q.popleft()
			alice[0] += tmp
			alice[1] = tmp
			alice_turn = False
		else:
			tmp = 0
			while q and tmp <= alice[1]:
				tmp += q.pop()
			bob[0] += tmp
			bob[1] = tmp
			alice_turn = True
		total_moves += 1
	print(total_moves, ' ', alice[0], ' ', bob[0])
	t -= 1


def al(A, ta=0):
	e = 0
	global ali
	global bob
	global flag
	for j in range(len(A)):
		if e <= ta and ali < bob - 1:
			e += A[ali + 1]
			ali += 1
		else:
			break
	if e < ta or ali > bob - 1:
		flag = 1
	return e

def bo(A, ta=0):
	e = 0
	global bob
	global ali
	global flag
	for j in range(len(A)):
		if e <= ta and ali < bob - 1:
			e += A[bob - 1]
			bob -= 1
		else:
			break
	if e < ta or ali > bob - 1:
		flag = 1
	return e
t = int(input())
A = []
for i in range(t):
	n = int(input())
	B = []
	B.extend(input().split())
	for j in range(n):
		B[j] = int(B[j])
	A.append(B)
for i in range(t):
	flag = 0
	c = 0
	r = 0
	ali = -1
	bob = len(A[i])
	q = 0
	w = 0
	while flag == 0:
		if c % 2 == 0:
			r = al(A[i], r)
			q += r
			c += 1
		else:
			r = bo(A[i], r)
			w += r
			c += 1
		if ali >= bob - 1:
			flag = 1
	print(c, q, w)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(f, r) = (0, n - 1)
	p = 0
	(a, b, m) = (0, 0, 0)
	while f <= r:
		j = 0
		while f <= r and j <= p:
			j += l[f]
			f += 1
		m += 1
		a += j
		p = j
		if f > r:
			break
		j = 0
		while f <= r and j <= p:
			j += l[r]
			r -= 1
		m += 1
		b += j
		p = j
	print(m, a, b)


from math import *
from collections import deque

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = [int(x) for x in input().split()]
		if n == 1:
			print(1, arr[0], 0)
			continue
		q = deque(arr)
		(ali, bob) = (0, 0)
		(f, l) = (0, n - 1)
		(apre, bpre) = (0, 0)
		mov = 0
		fag = True
		while q:
			if q:
				while apre <= bpre:
					if q:
						t = q.popleft()
						apre += t
						ali += t
					else:
						break
				mov += 1
				bpre = 0
			if q:
				while bpre <= apre:
					if q:
						t = q.pop()
						bpre += t
						bob += t
					else:
						break
				mov += 1
				apre = 0
		print(mov, ali, bob)
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(ap, bp) = (1, n - 1)
	(asum, bsum) = (l[0], 0)
	aprev = l[0]
	moves = 1
	while ap <= bp:
		bint = 0
		f = False
		while ap <= bp and bint <= aprev:
			bint += l[bp]
			bsum += l[bp]
			bp -= 1
			f = True
		bprev = bint
		if f:
			moves += 1
		aint = 0
		f = False
		while ap <= bp and aint <= bprev:
			aint += l[ap]
			asum += l[ap]
			ap += 1
			f = True
		aprev = aint
		if f:
			moves += 1
	print(moves, asum, bsum, sep=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	al = 0
	bo = 0
	cr = 1
	flag = 1
	num = 0
	TL = n
	while a != []:
		if flag == 1:
			ii = 0
			sm = 0
			fl = 0
			while ii < TL:
				sm += a[ii]
				if sm >= cr:
					al += sm
					fl = -1
					break
				ii += 1
			if fl == 0:
				al += sum(a)
				num += 1
				break
			for xxx in range(ii + 1):
				a.pop(0)
			TL -= ii + 1
			cr = sm + 1
			flag = -1
			num += 1
		else:
			ii = len(a) - 1
			sm = 0
			fl = 0
			cnt = 0
			while ii >= 0:
				sm += a[ii]
				cnt += 1
				if sm >= cr:
					bo += sm
					fl = -1
					break
				ii -= 1
			if fl == 0:
				bo += sum(a)
				num += 1
				break
			for xxx in range(cnt):
				TL -= 1
				a.pop()
			flag = 1
			cr = sm + 1
			num += 1
	print(num, al, bo)


num = int(input())
while num > 0:
	num = num - 1
	t = int(input())
	nbr = list(map(int, input().split()))
	a = 0
	b = 0
	count = 1
	ref1 = 0
	ref2 = 0
	ma = 0
	mb = 0
	ma = a = nbr[0]
	nbr.pop(0)
	while len(nbr) > 0:
		flag = 0
		while mb <= ma and len(nbr) > 0:
			temp = nbr[-1]
			mb = mb + temp
			b = b + temp
			nbr.pop(-1)
			flag = 3
		ma = 0
		if flag == 3:
			count = count + 1
		while ma <= mb and len(nbr) > 0:
			temp = nbr[0]
			a = a + temp
			ma = ma + temp
			nbr.pop(0)
			flag = 2
		mb = 0
		if flag == 2:
			count = count + 1
	print('%d %d %d' % (count, a, b))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = 0
	a1 = 0
	b1 = 0
	c = 0
	if n == 1:
		a = l[0]
		print(1, a, b)
	else:
		a = l[0]
		a1 = a - a1
		del l[0]
		c = c + 1
		while True:
			b1 = 0
			while b1 <= a1:
				if len(l) == 0:
					break
				b1 = b1 + l[-1]
				del l[-1]
			b = b + b1
			c = c + 1
			if len(l) <= 0:
				break
			a1 = 0
			while a1 <= b1:
				if len(l) == 0:
					break
				a1 = a1 + l[0]
				del l[0]
			a = a + a1
			c = c + 1
			if len(l) <= 0:
				break
		print(c, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	a = 0
	b = n
	last = 0
	cnt = 0
	while b > a:
		cur = 0
		while b > a and cur <= last:
			if cnt % 2 == 0:
				cur += arr[a]
				a += 1
			else:
				b -= 1
				cur += arr[b]
		last = cur
		cnt += 1
	print(cnt, sum(arr[:a]), sum(arr[b:]))


from collections import deque
for T in range(int(input())):
	n = int(input())
	c = deque(list(map(int, input().split())))
	prev = 0
	a = b = 0
	turn = 0
	while 1:
		if not c:
			break
		t = 0
		while t <= prev:
			if not c:
				break
			t += c.popleft()
		a += t
		prev = t
		turn += 1
		if not c:
			break
		t = 0
		while t <= prev:
			if not c:
				break
			t += c.pop()
		b += t
		prev = t
		turn += 1
	print(turn, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(po, pa, last, st, ass, flag) = ([], [], 0, 0, n - 1, 0)
	while st <= ass:
		sum1 = 0
		while sum1 <= last and st <= ass:
			if flag == False:
				sum1 += a[st]
				st += 1
			else:
				sum1 += a[ass]
				ass -= 1
		if flag == False:
			po.append(sum1)
		else:
			pa.append(sum1)
		(flag, last) = (1 - flag, sum1)
	print(len(po) + len(pa), sum(po), sum(pa))


count = int(input())
for i in range(count):
	numbers = int(input())
	mass = input().split(' ')
	turn = 1
	alisa = int(mass[0])
	bob = 0
	left_counter = 1
	right_counter = numbers - 1
	eat = alisa
	while left_counter <= right_counter:
		round_eat = 0
		while round_eat <= eat and left_counter <= right_counter:
			if turn % 2 == 0:
				round_eat += int(mass[left_counter])
				alisa += int(mass[left_counter])
				left_counter += 1
			else:
				round_eat += int(mass[right_counter])
				bob += int(mass[right_counter])
				right_counter -= 1
		eat = round_eat
		turn += 1
	print(turn, end=' ')
	print(alisa, end=' ')
	print(bob)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	arr = int_array()
	i = 0
	j = n - 1
	a = b = preva = prevb = 0
	thisa = thisb = 0
	move = 0
	total = 1
	while i <= j:
		if move == 0:
			if thisa > prevb:
				move = 1
				preva = thisa
				thisa = 0
				total += 1
			else:
				thisa += arr[i]
				a += arr[i]
				i += 1
		elif thisb > preva:
			move = 0
			prevb = thisb
			thisb = 0
			total += 1
		else:
			thisb += arr[j]
			b += arr[j]
			j -= 1
	print(total, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = 0
	ta = 0
	tb = 0
	count = 0
	s = 0
	i = 0
	j = n - 1
	chance = 'a'
	end = 0
	if n == 1:
		print(1, l[0], 0, sep=' ')
		continue
	while j > i - 1:
		if chance == 'a':
			if ta + l[i] > s:
				s = ta + l[i]
				a = a + s
				chance = 'b'
				ta = 0
				tb = 0
				count = count + 1
				end = 1
			else:
				ta = ta + l[i]
				end = 0
			i = i + 1
		else:
			if tb + l[j] > s:
				s = tb + l[j]
				b = b + s
				chance = 'a'
				tb = 0
				ta = 0
				count = count + 1
				end = 1
			else:
				tb = tb + l[j]
				end = 0
			j = j - 1
	else:
		a = a + ta
		b = b + tb
		if not end:
			count = count + 1
		print(count, a, b, sep=' ')


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	st = 0
	en = n - 1
	step = 0
	(prv, cnt) = (0, 0)
	(x, y) = (0, 0)
	while st <= en:
		cur = 0
		if step == 0:
			while st <= en and cur <= prv:
				cur += a[st]
				x += a[st]
				st += 1
		else:
			while st <= en and cur <= prv:
				cur += a[en]
				y += a[en]
				en -= 1
		prv = cur
		step ^= 1
		cnt += 1
	print(cnt, x, y)


for _ in range(int(input())):
	n = int(input())
	ls = [int(x) for x in input().split()]
	(lf, cnt) = (0, 0)
	rt = n - 1
	prev = 0
	(ansa, ansb) = (0, 0)
	while lf <= rt:
		cur = 0
		if cnt & 1 ^ 1:
			while cur <= prev and lf <= rt:
				cur += ls[lf]
				lf += 1
			ansa += cur
		else:
			while cur <= prev and rt >= lf:
				cur += ls[rt]
				rt -= 1
			ansb += cur
		prev = cur
		cnt += 1
	print(cnt, ansa, ansb)


t = int(input())
for ii in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = 1
	r = len(a) - 1
	s = a[0]
	sa = s
	sb = 0
	moves = 1
	while r >= l:
		s1 = 0
		while r >= l and s1 <= s:
			s1 += a[r]
			r -= 1
		sb += s1
		moves += 1
		s = s1
		if r >= l:
			s1 = 0
			while r >= l and s1 <= s:
				s1 += a[l]
				l += 1
			sa += s1
			moves += 1
			s = s1
	print(moves, sa, sb)


t = int(input())
while t > 0:
	n = int(input())
	candy = list(map(int, input().split()))
	alice = 0
	bob = n - 1
	prev = 0
	curr = 0
	at = 0
	bt = 0
	cnt = 0
	while True:
		if alice > bob:
			break
		if cnt % 2 == 0:
			if curr <= prev:
				curr += candy[alice]
				at += candy[alice]
				alice += 1
			else:
				cnt += 1
				prev = curr
				curr = 0
		elif curr <= prev:
			curr += candy[bob]
			bt += candy[bob]
			bob -= 1
		else:
			cnt += 1
			prev = curr
			curr = 0
	print(cnt + 1, at, bt)
	t -= 1


from collections import deque
for _ in range(int(input())):
	n = int(input())
	l = deque(map(int, input().split()))
	alice = 0
	bob = 0
	move = 0
	j = 0
	prev = 0
	ok = True
	while len(l) > 0:
		add = 0
		if j & 1 == 0:
			while add <= prev:
				add += l.popleft()
				if len(l) == 0:
					break
			else:
				prev = add
			alice += add
			move += 1
		else:
			while add <= prev:
				add += l.pop()
				if len(l) == 0:
					break
			else:
				prev = add
			bob += add
			move += 1
		j += 1
	print(move, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	S = list(map(int, input().split()))
	sum0 = 0
	sum1 = 0
	count = 0
	counta = 0
	countb = 0
	while S:
		while sum0 <= sum1 and S:
			sum0 += S.pop(0)
		else:
			count += 1
			counta += sum0
			sum1 = sum0
			sum0 = 0
		if not S:
			break
		while sum0 <= sum1 and S:
			sum0 += S.pop()
		else:
			count += 1
			countb += sum0
			sum1 = sum0
			sum0 = 0
	print(count, counta, countb)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	left = 1
	right = n - 1
	(c, a, b) = (1, l[0], 0)
	lastmove = l[0]
	move = 1
	while left <= right:
		c += 1
		if move == 1:
			cur = 0
			while right >= left and cur <= lastmove:
				cur += l[right]
				right -= 1
			b += cur
			lastmove = cur
			move = 0
		else:
			cur = 0
			while left <= right and cur <= lastmove:
				cur += l[left]
				left += 1
			a += cur
			lastmove = cur
			move = 1
	print(c, a, b)


def eat(l, side, total):
	temp = 0
	while temp <= total and len(l) != 0:
		temp += l.pop(side)
	return (temp, l)
for _ in range(int(input())):
	_ = input()
	candy = list(map(int, input().split()))
	a = 0
	b = 0
	count = 0
	total = 0
	while len(candy) != 0:
		if count % 2 == 0:
			(temp, candy) = eat(candy, 0, total)
			a += temp
		else:
			(temp, candy) = eat(candy, -1, total)
			b += temp
		total = temp
		count += 1
	print(count, a, b)


import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
cases = int(input())
for t in range(cases):
	n = int(input())
	a = list(map(int, input().split()))
	i = 1
	j = n - 1
	s = 1
	al = a[0]
	b = 0
	pa = al
	pb = 0
	while i <= j:
		while pb <= pa and j >= i:
			pb += a[j]
			j -= 1
		if pb:
			s += 1
			b += pb
			pa = 0
		while pa <= pb and i <= j:
			pa += a[i]
			i += 1
		if pa:
			s += 1
			al += pa
			pb = 0
	print(s, al, b)


t = int(input())
AnsList = []
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	A = [l[0]]
	del l[0]
	B = []
	move = 0
	while len(l) != 0:
		if move % 2 == 0:
			B.append(0)
			while B[-1] < A[-1] + 1 and len(l) != 0:
				B[-1] += l[-1]
				del l[-1]
		else:
			A.append(0)
			while A[-1] < B[-1] + 1 and len(l) != 0:
				A[-1] += l[0]
				del l[0]
		move += 1
	a = sum(A)
	b = sum(B)
	move += 1
	AnsList.append((move, a, b))
for x in AnsList:
	print(x[0], x[1], x[2])


t = int(input())
while t > 0:
	n = int(input())
	inp = list(map(int, input().split()))
	t -= 1
	a = 0
	b = 0
	ptr1 = 0
	ptr2 = n - 1
	prev = 0
	it = 0
	while 1:
		if ptr1 > ptr2:
			break
		it += 1
		if it % 2 == 1:
			temp = 0
			while ptr1 <= ptr2 and temp <= prev:
				temp += inp[ptr1]
				ptr1 += 1
			a += temp
			prev = temp
		else:
			temp = 0
			while ptr1 <= ptr2 and temp <= prev:
				temp += inp[ptr2]
				ptr2 -= 1
			b += temp
			prev = temp
	print(it, a, b, sep=' ')


for _ in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	a = c[0]
	c.pop(0)
	ans = 1
	b = 0
	cur = a
	while len(c) != 0:
		if ans % 2 == 1:
			now = 0
			while now <= cur and len(c) != 0:
				now += c[-1]
				b += c[-1]
				c.pop(-1)
			ans += 1
			cur = now
		else:
			now = 0
			while now <= cur and len(c) != 0:
				now += c[0]
				a += c[0]
				c.pop(0)
			ans += 1
			cur = now
	print(ans, a, b)


from sys import stdin, stdout
from math import *
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	p = 0
	x = 0
	y = n - 1
	c = 0
	t = 0
	a1 = 0
	a2 = 0
	ans = 0
	while x <= y:
		if t == 0:
			c += ar[x]
			a1 += ar[x]
			x += 1
			if p < c or x > y:
				t = 1
				p = c
				c = 0
				ans += 1
		elif t == 1:
			c += ar[y]
			a2 += ar[y]
			y -= 1
			if p < c or x > y:
				t = 0
				p = c
				c = 0
				ans += 1
	print(ans, a1, a2)


import sys
t = int(input())
for i in range(t):
	n = int(input())
	Massive = list(map(int, input().split()))
	a = 0
	b = 0
	move = 0
	sweet_last = 0
	sweet_now = 0
	role = 'Alice'
	while Massive != []:
		sweet_now = 0
		while sweet_now <= sweet_last:
			if Massive == []:
				break
			elif role == 'Alice':
				sweet_now += Massive[0]
				a += Massive[0]
				del Massive[0]
			else:
				sweet_now += Massive[-1]
				b += Massive[-1]
				del Massive[-1]
		if role == 'Alice':
			role = 'Bob'
		else:
			role = 'Alice'
		sweet_last = sweet_now
		move += 1
	print(move, a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ali = 0
	bob = 0
	i = 0
	j = n - 1
	temp = 0
	ali += 0
	count = 0
	while i <= j:
		aa = 0
		while aa <= temp and i <= j:
			aa += a[i]
			i += 1
		if aa > temp:
			ali += aa
			temp2 = aa
			count += 1
		else:
			ali += aa
			if aa != 0:
				count += 1
		bb = 0
		while bb <= temp2 and i <= j:
			bb += a[j]
			j -= 1
		if bb > temp:
			bob += bb
			temp = bb
			count += 1
		else:
			bob += bb
			if bb != 0:
				count += 1
	print(count, ali, bob)


t = int(input())
for T in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	a = l[0]
	b = 0
	ar = l[0]
	br = 0
	mov = 1
	l.pop(0)
	while len(l) != 0:
		if mov & 1:
			bn = 0
			while bn <= ar and len(l) > 0:
				bn += l.pop()
			br = bn
			b += bn
		else:
			an = 0
			while an <= br and len(l) > 0:
				an += l.pop(0)
			ar = an
			a += an
		mov += 1
	print(mov, a, b)


def solve(n, s):
	turn = True
	prev = 0
	turns = 0
	a_count = 0
	b_count = 0
	while len(s) > 0:
		candy = 0
		turns += 1
		if turn == True:
			while candy <= prev:
				if len(s) == 0:
					break
				candy += s[0]
				s.pop(0)
			turn = False
			a_count += candy
		else:
			while candy <= prev:
				if len(s) == 0:
					break
				candy += s[len(s) - 1]
				s.pop()
			b_count += candy
			turn = True
		prev = candy
	return ' '.join(list(map(str, [turns, a_count, b_count])))
t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	print(solve(n, s))


t = int(input())
for i1 in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	i = -1
	i_help = 0
	j = n
	j_help = n - 1
	a = 0
	sum_a = 0
	b = 0
	sum_b = 0
	chance = 0
	move = 0
	prev = 0
	traversed = 0
	while i < j:
		while chance == 0:
			i += 1
			traversed += 1
			if i >= j:
				move += 1
				sum_a += a
				break
			a = a + l[i]
			if a > prev:
				sum_a += a
				chance = 1
				prev = a
				a = 0
				move += 1
		if traversed == n:
			break
		while chance == 1:
			j -= 1
			traversed += 1
			if i >= j:
				sum_b += b
				move += 1
				break
			b = b + l[j]
			if b > prev:
				sum_b += b
				chance = 0
				prev = b
				b = 0
				move += 1
		if traversed == n:
			break
	print(move, sum_a, sum_b)


T = int(input())
while T:
	T -= 1
	n = input()
	a = list(map(int, input().split()))
	l = 0
	r = len(a) - 1
	x = 0
	y = 0
	tot = 0
	ans = 0
	while l <= r:
		s = 0
		while l <= r and s <= tot:
			s += a[l]
			x += a[l]
			l += 1
		ans += 1
		if l > r:
			break
		tot = s
		s = 0
		while l <= r and s <= tot:
			s += a[r]
			y += a[r]
			r -= 1
		ans += 1
		if l > r:
			break
		tot = s
	print(ans, x, y)


t = int(input())
q = []
for i in range(t):
	n = int(input())
	l = list(input().split())
	l = [int(i) for i in l]
	sum_a = 0
	sum_b = 0
	temp_a = 0
	temp_b = 0
	sum_a += l[0]
	temp_a += l[0]
	l.remove(l[0])
	move = 1
	while len(l) > 0:
		while temp_b <= temp_a and len(l) > 0:
			sum_b += l[-1]
			temp_b += l[-1]
			l.pop(-1)
		move += 1
		temp_a = 0
		result = 0
		while temp_a <= temp_b and len(l) > 0:
			sum_a += l[0]
			temp_a += l[0]
			l.pop(0)
			result = 1
		temp_b = 0
		if result == 1:
			move += 1
	q.append(str(move) + ' ' + str(sum_a) + ' ' + str(sum_b))
for i in q:
	print(i)


import sys, threading
sys.setrecursionlimit(2 * 10 ** 5)

def dfs(index, d, visited, p, dep, ans):
	visited[index] = True
	dep[index] = d
	for i in range(len(ans[index])):
		if visited[ans[index][i]] == False:
			dfs(ans[index][i], d + 1, visited, p, dep, ans)
			p[index] += p[ans[index][i]]

def solve():
	n = list(map(int, input().split()))
	n = int(n[0])
	arr = list(map(int, input().split()))
	alice = 0
	bob = 0
	t_alice = 0
	t_bob = 0
	i = 0
	j = n - 1
	flag = 0
	count = 0
	while i <= j:
		count += 1
		if flag == 0:
			alice = 0
			flag = 1
			while i < n and i <= j:
				alice += arr[i]
				i += 1
				if alice > bob:
					break
			t_alice += alice
		else:
			bob = 0
			flag = 0
			while j >= 0 and i <= j:
				bob += arr[j]
				j -= 1
				if bob > alice:
					break
			t_bob += bob
	print(count, t_alice, t_bob)

def main():
	t = input().split()
	t = int(t[0])
	for _ in range(t):
		solve()
sys.setrecursionlimit(2 ** 32 // 2 - 1)
threading.stack_size(1 << 27)
thread = threading.Thread(target=main)
thread.start()
thread.join()


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	j = 1
	k = len(l) - 1
	a = l[0]
	b = 0
	last = l[0]
	f = 1
	count = 1
	while j <= k:
		count += 1
		if f == 1:
			sum = 0
			for x in range(k, -1, -1):
				sum = sum + l[x]
				if x == j or sum > last:
					k = x - 1
					b += sum
					last = sum
					break
			f = 0
		else:
			sum = 0
			for x in range(j, len(l)):
				sum = sum + l[x]
				if x == k or sum > last:
					j = x + 1
					a += sum
					last = sum
					break
			f = 1
	print(count, a, b)


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
for _ in range(int(z())):
	n = int(z())
	l = list(map(int, z().split()))
	x = l[0]
	(a, b) = (x, 0)
	it = 1
	count = 1
	l = l[1:]
	vm = sum(l)
	ct = 0
	if vm <= x:
		if vm != 0:
			it += 1
		print(it, a, b + vm)
		continue
	while True:
		if it % 2 == 0:
			t = 0
			j = 0
			tr = 0
			for i in l:
				t += i
				j += 1
				if t > x:
					x = t
					a += t
					l = l[j:]
					tr = 1
					break
			vm = sum(l)
			if tr == 0:
				a += t
				ct = 1
				if vm != 0:
					it += 1
				break
		if it % 2 == 1:
			t = 0
			j = 0
			tr = 0
			for i in l[::-1]:
				t += i
				j += 1
				if t > x:
					x = t
					b += t
					l = l[::-1][j:][::-1]
					tr = 1
					break
			vm = sum(l)
			if tr == 0:
				b += t
				ct = 1
				if vm != 0:
					it += 1
				break
		it += 1
		count += 1
		if ct == 1:
			break
	print(it, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	al = [a[0]]
	for i in range(1, n):
		al.append(al[-1] + a[i])
	i = n - 2
	bo = [a[-1]]
	while i >= 0:
		bo.append(bo[-1] + a[i])
		i -= 1
	aprev = 0
	bprev = 0
	asum = 0
	bsum = 0
	al = []
	bo = []
	count = 0
	k = 0
	while len(a) > 0:
		if k % 2 == 0:
			if asum > bprev:
				al.append(asum)
				aprev = asum
				asum = 0
				k = 1 - k
				count += 1
			else:
				asum += a[0]
				a.pop(0)
		elif bsum > aprev:
			bo.append(bsum)
			bprev = bsum
			bsum = 0
			k = 1 - k
			count += 1
		else:
			bsum += a[-1]
			a.pop()
	al.append(asum)
	bo.append(bsum)
	print(count + 1, sum(al), sum(bo))


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	q = deque(list(map(int, input().split())))
	a = 0
	b = 0
	turn = 0
	bef = 0
	while True:
		count = 0
		turn += 1
		if turn % 2:
			while q and count <= bef:
				count += q.popleft()
			a += count
		else:
			while q and count <= bef:
				count += q.pop()
			b += count
		if count > bef and q:
			bef = count
		else:
			break
	print(turn, a, b)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
import itertools

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

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

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	lcm = x * y // gcd(x, y)
	return lcm

def solve(a, b, i, j, l, a1, a2, c):
	while i <= j:
		c += 1
		if a > b:
			while b <= a and i <= j:
				b = b + l[j]
				a2.append(l[j])
				j = j - 1
			return solve(0, b, i, j, l, a1, a2, c)
		if a < b:
			while a <= b and i <= j:
				a = a + l[i]
				a1.append(l[i])
				i = i + 1
			return solve(a, 0, i, j, l, a1, a2, c)
	return (c + 1, sum(a1), sum(a2))

def solution():
	for j in range(Int()):
		n = Int()
		l = List()
		(a, b) = (l[0], 0)
		(i, j) = (1, n - 1)
		(a1, a2) = ([l[0]], [])
		count = 0
		t = solve(a, b, i, j, l, a1, a2, count)
		print(*t)
solution()


t = int(input())
for trying in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	A = [0]
	B = [0]
	x = 0
	while len(s) != 0:
		if x % 2 == 0:
			x += 1
			r = 0
			for i in range(len(s)):
				r += s[i]
				if r > B[-1]:
					A.append(r)
					r = i + 1
					break
			else:
				A += s
				break
			del s[:r]
		else:
			x += 1
			r = 0
			for i in range(len(s) - 1, -1, -1):
				r += s[i]
				if r > A[-1]:
					B.append(r)
					r = i
					break
			else:
				B += s
				break
			del s[r:]
	print(str(x), str(sum(A)), str(sum(B)), sep=' ')


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = 1
	j = len(l) - 1
	s1 = 0
	s2 = 0
	s3 = 0
	p1 = l[0]
	p2 = 0
	s1 = sum(l)
	s2 = l[0]
	tmp1 = 1
	while s2 + s3 < s1:
		p2 = 0
		while p2 <= p1 and j >= i:
			p2 += l[j]
			s3 += l[j]
			j = j - 1
		tmp1 += 1
		p1 = 0
		if s2 + s3 == s1:
			break
		while p1 <= p2 and i <= j:
			p1 += l[i]
			s2 += l[i]
			i = i + 1
		tmp1 += 1
	print(tmp1, s2, s3)


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	m = 0
	b = 0
	a = 0
	p = 0
	while len(l) != 0:
		c = 0
		if m % 2 == 0:
			j = 0
			while j < len(l):
				c += l[j]
				l.pop(j)
				if c > p:
					break
			m += 1
			a += c
			p = c
		else:
			j = len(l) - 1
			while j < len(l) and j >= 0:
				c += l[j]
				l.pop(j)
				j = len(l) - 1
				if c > p:
					break
			m += 1
			b += c
			p = c
	print(m, a, b)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	total = 1
	at = s[0]
	bt = 0
	a = s[0]
	b = 0
	curr = 'b'
	ai = 1
	bi = n - 1
	ac = s[0]
	bc = 0
	while ai <= bi:
		if curr == 'b':
			bc = 0
			while ai <= bi and bc <= ac:
				bc += s[bi]
				bi -= 1
			curr = 'a'
			b += bc
			total += 1
		else:
			ac = 0
			while ai <= bi and ac <= bc:
				ac += s[ai]
				ai += 1
			curr = 'b'
			a += ac
			total += 1
	print(total, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	j = len(arr) - 1
	a = 0
	b = 0
	c = 0
	s1 = 0
	s2 = 0
	if len(arr) == 1:
		print(1, arr[0], 0)
	elif len(arr) == 2:
		print(2, arr[0], arr[1])
	else:
		while i < j + 1:
			while a <= b:
				a += arr[i]
				i += 1
				if i == j + 1:
					break
			c += 1
			s1 += a
			b = 0
			if i == j + 1:
				break
			while a >= b:
				b += arr[j]
				j -= 1
				if i == j + 1:
					break
			c += 1
			s2 += b
			a = 0
		print(c, s1, s2)


t = int(input())
for _ in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	(lans, rans, lprev, rprev, lptr, rptr, moves) = (0, 0, 0, 0, 0, n - 1, 0)
	while lptr <= rptr:
		if moves % 2 == 0:
			lprev = 0
			while lprev <= rprev and lptr <= rptr:
				lprev += inp[lptr]
				lptr += 1
			lans += lprev
		else:
			rprev = 0
			while rprev <= lprev and lptr <= rptr:
				rprev += inp[rptr]
				rptr -= 1
			rans += rprev
		moves += 1
	print(moves, lans, rans)


T = int(input())
from collections import deque
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	q = deque(A)
	sa = sb = x = px = k = 0
	while q:
		k += 1
		x = 0
		while q and x <= px:
			v = q.popleft()
			x += v
			sa += v
		px = x
		if not q:
			break
		k += 1
		x = 0
		while q and x <= px:
			v = q.pop()
			x += v
			sb += v
		px = x
	print(k, sa, sb)


import sys
from sys import maxsize
from collections import Counter as cnt
from collections import defaultdict as dic
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().rstrip().split()))
TEST_CASES = True

def main():
	n = get_int()
	arr = get_list()
	(alice, bob, c, i) = [0] * 4
	j = n - 1
	curr = last = 0
	while i <= j:
		if c % 2 == 0:
			while curr <= last and i <= j:
				curr += arr[i]
				i += 1
			(last, curr) = (curr, 0)
			alice += last
			c += 1
		else:
			while curr <= last and i <= j:
				curr += arr[j]
				j -= 1
			(last, curr) = (curr, 0)
			bob += last
			c += 1
	print(c, alice, bob)
if not TEST_CASES:
	main()
else:
	[main() for _ in range(int(input()))]


t = int(input())
movesf = []
alice = []
bob = []
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	a = 0
	b = 0
	i = 0
	j = n - 1
	moves = 0
	c = 0
	total = 0
	while i <= j:
		moves += 1
		if c % 2 == 0:
			current = 0
			while current <= total and i <= j:
				current += arr[i]
				i += 1
			total = current
			a += current
		elif c % 2 != 0:
			current = 0
			while current <= total and i <= j:
				current += arr[j]
				j -= 1
			total = current
			b += total
		c += 1
	movesf.append(moves)
	alice.append(a)
	bob.append(b)
for i in range(t):
	print(str(movesf[i]) + ' ' + str(alice[i]) + ' ' + str(bob[i]))


cases = int(input())
for t in range(cases):
	n = int(input())
	a = list(map(int, input().split()))
	i = 1
	j = n - 1
	s = 1
	al = a[0]
	b = 0
	pa = al
	pb = 0
	while i <= j:
		while pb <= pa and j >= i:
			pb += a[j]
			j -= 1
		if pb:
			s += 1
			b += pb
			pa = 0
		while pa <= pb and i <= j:
			pa += a[i]
			i += 1
		if pa:
			s += 1
			al += pa
			pb = 0
	print(s, al, b)


t = int(input())
for i in range(t):
	n = int(input())
	sweets = list(map(int, input().split()))
	a = sweets[0]
	a1 = a
	sweets = sweets[1:]
	b = 0
	b1 = 0
	count = 1
	while len(sweets) > 0:
		if count % 2 == 1:
			b = 0
			j = 1
			while j < len(sweets) and b <= a:
				b += sweets[-j]
				j += 1
			b1 += b
			if j == len(sweets) and b <= a:
				b1 += sweets[0]
				sweets = []
			else:
				sweets = sweets[:-j + 1]
			count += 1
		else:
			a = 0
			j = 0
			while j < len(sweets) and a <= b:
				a += sweets[j]
				j += 1
			a1 += a
			if j == len(sweets) and a <= b:
				sweets = []
			else:
				sweets = sweets[j:]
			count += 1
	print(count, a1, b1)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	alis = [a[0]]
	bob = []
	j = 0
	k = n
	s = a[0]
	while k - j > 1:
		d2 = 0
		while d2 <= s and j < k:
			k -= 1
			if k != j:
				d2 += a[k]
		if d2 != 0:
			bob.append(d2)
			s = d2
		d1 = 0
		while d1 <= s and j < k:
			j += 1
			if j != k:
				d1 += a[j]
		if d1 != 0:
			alis.append(d1)
			s = d1
	print(len(alis) + len(bob), sum(alis), sum(bob))


import math

def r():
	return map(int, input().split())

def lis():
	return list(map(int, input().split()))

def i():
	return int(input())

def si():
	return input()

def pYes():
	print('YES')

def pNo():
	print('NO')

def plist(l):
	print(''.join(l))
t = int(input())
for i in range(t):
	n = int(input())
	li = lis()
	l = 0
	r = n - 1
	t = 0
	lres = 0
	s = sum(li)
	a = 0
	while l <= r:
		res = 0
		if t % 2 == 0:
			while lres >= res and l <= r:
				res = res + li[l]
				l = l + 1
			lres = res
			a = a + lres
		else:
			while lres >= res and l <= r:
				res = res + li[r]
				r = r - 1
			lres = res
		t = t + 1
	print(t, a, s - a)


mod = int(1000000000.0) + 7

def ip():
	return int(input())

def Ip():
	return map(int, input().split())
for _ in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(nm, a, b) = (1, l[0], 0)
	(ps, cs) = (l[0], 0)
	(i, j) = (1, n - 1)
	t = 1
	while j >= i:
		nm += 1
		if t == 1:
			while j >= i and cs < ps + 1:
				cs += l[j]
				b += l[j]
				j -= 1
			t = 0
		else:
			while j >= i and cs < ps + 1:
				cs += l[i]
				a += l[i]
				i += 1
			t = 1
		ps = cs
		cs = 0
	print(nm, a, b)


from collections import deque
t = int(input())
rez = []
for i in range(t):
	h = 0
	k = 0
	a = 0
	b = 0
	n = int(input())
	A = input().split()
	ai = deque()
	for j in range(n):
		ai.append(int(A[j]))
	for j in range(len(ai)):
		t = 0
		if j % 2 == 0:
			while t <= k and len(ai) > 0:
				m = ai.popleft()
				a += m
				t += m
		else:
			while t <= k and len(ai) > 0:
				m = ai.pop()
				b += m
				t += m
		k = t
		h += 1
		if len(ai) == 0:
			break
	rez.append(str(h) + ' ' + str(a) + ' ' + str(b))
for i in range(len(rez)):
	print(rez[i])


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for _ in range(T):
		N = int(input())
		A = getlist()
		(n, a, b) = (0, 0, 0)
		i = 0
		j = N - 1
		turn = 0
		pre = 0
		while i <= j:
			if turn == 0:
				var = 0
				while i <= j:
					var += A[i]
					a += A[i]
					i += 1
					if var > pre:
						pre = var
						break
			else:
				var = 0
				while i <= j:
					var += A[j]
					b += A[j]
					j -= 1
					if var > pre:
						pre = var
						break
			if turn == 0:
				turn = 1
			else:
				turn = 0
			n += 1
		print(n, a, b)
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	e = n - 1
	prev = 0
	alice = 0
	bob = 0
	counter = 0
	flag = 0
	while s <= e:
		if flag == 0:
			d = 0
			while s <= e:
				d += a[s]
				if d > prev:
					break
				s += 1
			alice += d
			s += 1
			prev = d
			counter += 1
		else:
			d = 0
			while s <= e:
				d += a[e]
				if d > prev:
					break
				e -= 1
			bob += d
			e -= 1
			prev = d
			counter += 1
		flag = 1 - flag
	print(counter, alice, bob)


from sys import stdout, stdin
(_input, _print) = (stdin.buffer.readline, stdout.write)
(_sum, _range, _int) = (sum, range, int)

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		arr = [_int(i) for i in _input().split()]
		alice_index = 0
		bob_index = n - 1
		alice_summary = 0
		bob_summary = 0
		step_summary = 0
		step_counter = 0
		while alice_index <= bob_index:
			temp = 0
			f = False
			while temp <= step_summary and alice_index <= bob_index:
				temp += arr[alice_index]
				alice_index += 1
				f = True
			if f:
				step_counter += 1
			step_summary = temp
			alice_summary += temp
			temp = 0
			f = False
			while temp <= step_summary and alice_index <= bob_index:
				temp += arr[bob_index]
				bob_index -= 1
				f = True
			if f:
				step_counter += 1
			step_summary = temp
			bob_summary += temp
		print(step_counter, alice_summary, bob_summary)
solution()


cases = int(input())
for i in range(cases):
	n_candies = int(input())
	arr = []
	moves = 0
	line2 = input().split(' ')
	for l in line2:
		arr.append(int(l))
	left = 0
	right = len(arr) - 1
	total_a = 0
	total_b = 0
	while True:
		if moves == 0:
			eaten = arr[left]
			total_a += eaten
			arr[left] = 0
			moves += 1
			left += 1
			continue
		elif moves % 2 == 1:
			b_eat = 0
			end = False
			while b_eat <= eaten:
				b_eat += arr[right]
				arr[right] = 0
				right -= 1
				if right == -1:
					if b_eat > 0:
						moves += 1
					end = True
					total_b += b_eat
					break
			if end == False:
				eaten = b_eat
				moves += 1
				total_b += b_eat
			else:
				break
		elif moves % 2 == 0:
			a_eat = 0
			end_a = False
			while a_eat <= eaten:
				a_eat += arr[left]
				arr[left] = 0
				left += 1
				if left == len(arr):
					if a_eat > 0:
						moves += 1
					end_a = True
					total_a += a_eat
					break
			if end_a == False:
				eaten = a_eat
				moves += 1
				total_a += a_eat
			else:
				break
	print(moves, total_a, total_b)


import math
import sys
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	x = 1
	y = n - 1
	m = 1
	a = arr[0]
	b = 0
	cur = arr[0]
	now = 0
	f = True
	while x <= y:
		if f:
			if now <= cur:
				now += arr[y]
				b += arr[y]
				y -= 1
			else:
				f = False
				cur = now
				now = 0
				m += 1
		elif now <= cur:
			now += arr[x]
			a += arr[x]
			x += 1
		else:
			f = True
			cur = now
			now = 0
			m += 1
	if now > 0:
		m += 1
	print(m, a, b)


from sys import stdin

def solve():
	l = int(input())
	A = [int(i) for i in stdin.readline().split()]
	if l == 1:
		print(1, A[0], 0)
		return 0
	(a, b) = (0, l - 1)
	m = 1
	(am, bm) = (A[0], 0)
	(ac, bc) = (A[0], 0)
	turn = 'b'
	while b > a:
		if turn == 'b':
			while ac >= bc:
				bc += A[b]
				bm += A[b]
				b -= 1
				if a == b:
					break
			m += 1
			turn = 'a'
			ac = 0
		else:
			while bc >= ac:
				if a == b:
					break
				a += 1
				ac += A[a]
				am += A[a]
			m += 1
			turn = 'b'
			bc = 0
	print(m, am, bm)
t = int(input())
for i in range(t):
	k = solve()


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	a = 0
	b = n - 1
	s1 = 0
	s2 = 0
	m = 0
	l = n
	p2 = 0
	f1 = 1
	f2 = 1
	while l > 0:
		p1 = 0
		while a <= b:
			f1 = 0
			s1 += s[a]
			p1 += s[a]
			a += 1
			l -= 1
			if p1 > p2:
				m += 1
				f1 = 1
				break
		if f1 == 0:
			m += 1
			break
		p2 = 0
		while b >= a:
			f2 = 0
			s2 += s[b]
			p2 += s[b]
			b -= 1
			l -= 1
			if p2 > p1:
				m += 1
				f2 = 1
				break
		if f2 == 0:
			m += 1
			break
	print(str(m) + ' ' + str(s1) + ' ' + str(s2))


from collections import deque
I = lambda : list(map(int, input().split()))
t = I()[0]
while t:
	t -= 1
	(n, arr) = (I()[0], I())
	dq = deque(arr)
	(alice, bob, moves) = (0, 0, 0)
	last = 0
	chance = 0
	while len(dq):
		a = 0
		while len(dq) and a <= last:
			if chance:
				b = dq.pop()
				a += b
				bob += b
			else:
				b = dq.popleft()
				a += b
				alice += b
		last = a
		chance ^= 1
		moves += 1
	print(moves, alice, bob)


tc = int(input())
for _ in range(tc):
	n = int(input())
	a = [int(s) for s in input().split()]
	als = bos = 0
	ap = 0
	bp = n - 1
	turn = True
	pres = prev = moves = 0
	while ap <= bp:
		if turn:
			pres += a[ap]
			ap += 1
			if pres > prev:
				als += pres
				prev = pres
				pres = 0
				turn = False
				moves += 1
		else:
			pres += a[bp]
			bp -= 1
			if pres > prev:
				bos += pres
				prev = pres
				pres = 0
				turn = True
				moves += 1
	if pres > 0:
		moves += 1
		if turn:
			als += pres
		else:
			bos += pres
	print(moves, als, bos)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	la = 0
	lb = 0
	aa = 0
	bb = 0
	turn = 1
	nb = 0
	while i <= j:
		nb += 1
		if turn:
			c = 0
			while i <= j and c <= lb:
				c += a[i]
				i += 1
			la = c
			aa += c
		else:
			c = 0
			while i <= j and c <= la:
				c += a[j]
				j -= 1
			lb = c
			bb += c
		turn ^= 1
	print(nb, aa, bb)


for i in range(int(input())):
	n = int(input())
	k = [int(x) for x in input().split()]
	m = k.copy()
	j = 0
	a = 0
	b = 0
	o = 0
	c = 0
	p = 0
	q = 0
	for t in range(n):
		if j % 2 == 0:
			c = c + k[q]
			if c > o:
				j = j + 1
				a = a + c
				o = c
				c = 0
				m.remove(m[0])
			else:
				m.remove(m[0])
			q = q + 1
		else:
			c = c + k[n - p - 1]
			if c > o:
				j = j + 1
				b = b + c
				o = c
				c = 0
				m.remove(m[-1])
			else:
				m.remove(m[-1])
			p = p + 1
		if m == []:
			if c != 0:
				if j % 2 != 0:
					b = b + c
					j = j + 1
				else:
					a = a + c
					j = j + 1
				break
			else:
				break
	print(j, a, b)


tests = int(input())
while tests:
	n = int(input())
	nums = [int(i) for i in input().split(' ')]
	(a, b) = (0, 0)
	(l, r) = (0, len(nums) - 1)
	(turn, weight) = (0, 0)
	while l <= r:
		sums = 0
		if turn % 2 == 0:
			while sums <= weight and l < len(nums):
				sums += nums[l]
				l += 1
				if l > r:
					break
			weight = sums
			a += weight
			turn += 1
		else:
			while sums <= weight and r > -1:
				sums += nums[r]
				r -= 1
				if r < l:
					break
			weight = sums
			b += weight
			turn += 1
	print(turn, a, b)
	tests -= 1


for _ in range(int(input())):
	n = int(input())
	candies = [int(i) for i in input().split()]
	alice = 0
	bob = 0
	move = 0
	previous = 0
	current = 0
	bob_move = len(candies) - 1
	alice_move = 0
	if len(candies) == 1:
		print('1 {} 0'.format(candies[0]))
		continue
	if len(candies) == 2:
		print('2 {} {}'.format(candies[0], candies[1]))
		continue
	while alice_move <= bob_move and alice_move < n and (bob_move >= 0):
		move += 1
		current = 0
		if move % 2 == 0:
			while current <= previous:
				current += candies[bob_move]
				candies[bob_move] = 0
				bob_move -= 1
				if candies[bob_move] == 0:
					break
			bob += current
			previous = current
		elif move % 2 == 1:
			while current <= previous:
				current += candies[alice_move]
				candies[alice_move] = 0
				alice_move += 1
				if candies[alice_move] == 0:
					break
			alice += current
			previous = current
	print(move, alice, bob)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	j = n - 1
	(a, b) = (0, 0)
	(ca, cb) = (0, 0)
	m = 0
	while True:
		ca = 0
		while ca <= cb and i <= j:
			ca += arr[i]
			i += 1
		a += ca
		m += 1
		if i > j:
			break
		cb = 0
		while cb <= ca and i <= j:
			cb += arr[j]
			j -= 1
		b += cb
		m += 1
		if i > j:
			break
	print(m, a, b)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	j = n - 1
	alice = 0
	bob = 0
	crr = 0
	move = 0
	eveodd = 0
	while i <= j:
		summ = 0
		move += 1
		if eveodd % 2 == 0:
			while i <= j and summ <= crr:
				summ += arr[i]
				i += 1
			crr = summ
			alice += summ
		else:
			while i <= j and summ <= crr:
				summ += arr[j]
				j -= 1
			crr = summ
			bob += summ
		eveodd += 1
	print(move, alice, bob)


n = []
arr = []
t = int(input())
for _ in range(t):
	n.append(int(input()))
	arr.append(list(map(int, input().split())))
for array in arr:
	a = array[0]
	array.pop(0)
	b = 0
	c = 1
	lim = a
	while len(array) > 0:
		cur = 0
		while cur <= lim:
			b += array[-1]
			cur += array[-1]
			array.pop()
			if len(array) == 0:
				break
		c += 1
		if len(array) == 0:
			break
		lim = cur
		cur = 0
		while cur <= lim:
			a += array[0]
			cur += array[0]
			array.pop(0)
			if len(array) == 0:
				break
		c += 1
		lim = cur
	print(str(c) + ' ' + str(a) + ' ' + str(b))


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	alice = 0
	bob = 0
	i = 0
	j = len(l) - 1
	current = 0
	moves = 0
	while i <= j:
		if moves % 2 == 0:
			sub = 0
			while i <= j and sub <= current:
				sub += l[i]
				i += 1
			current = sub
			moves += 1
			alice += sub
		else:
			sub2 = 0
			while i <= j and sub2 <= current:
				sub2 += l[j]
				j -= 1
			current = sub2
			moves += 1
			bob += sub2
	print(moves, alice, bob)


t = int(input())
for _ in range(t):
	n = int(input())
	(*a,) = map(int, input().split())
	l = 0
	r = n - 1
	A = True
	al = 0
	bb = 0
	pre = 0
	cnt = 0
	while r >= l:
		tmp = 0
		if A:
			while r >= l and tmp <= pre:
				tmp += a[l]
				l += 1
			al += tmp
		else:
			while r >= l and tmp <= pre:
				tmp += a[r]
				r -= 1
			bb += tmp
		pre = tmp
		cnt += 1
		A = not A
	print(cnt, al, bb)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	moves = 0
	alice = 0
	bob = 0
	curr_alice = 0
	curr_bob = 0
	i = 1
	while len(arr) != 0:
		if i & 1:
			curr_alice = 0
			while len(arr) != 0 and curr_alice <= curr_bob:
				curr_alice += arr.pop(0)
			alice += curr_alice
		else:
			curr_bob = 0
			while len(arr) != 0 and curr_bob <= curr_alice:
				curr_bob += arr.pop()
			bob += curr_bob
		moves += 1
		i += 1
	print('{} {} {}'.format(moves, alice, bob))


t = int(input())
for g in range(t):
	n = int(input())
	k = list(map(int, input().split()))
	a = k[0]
	sa = a
	sb = 0
	(ia, ib, i, count) = (1, 1, 1, 1)
	while i < n:
		b = 0
		while b <= a and i < n:
			b += k[n - ib]
			ib += 1
			i += 1
		count += 1
		sb += b
		a = 0
		while a <= b and i < n:
			a += k[ia]
			ia += 1
			i += 1
		count += 1
		sa += a
	if a == 0:
		print(count - 1, sa, sb)
	else:
		print(count, sa, sb)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	i = 1
	j = n - 1
	c = 1
	a = l[0]
	b = 0
	temp1 = l[0]
	temp2 = 0
	while i <= j:
		if c % 2 == 1:
			while i <= j and temp2 <= temp1:
				temp2 += l[j]
				b += l[j]
				j -= 1
			temp1 = 0
		else:
			while i <= j and temp1 <= temp2:
				temp1 += l[i]
				a += l[i]
				i += 1
			temp2 = 0
		c += 1
	print(c, a, b)


import math
tt = int(input())
while tt:
	n = int(input())
	A = [int(x) for x in input().split()]
	moves = 0
	Alice = []
	Bob = []
	l = 0
	r = len(A) - 1
	Alice_sum = A[l]
	Alice.append(A[l])
	l += 1
	moves += 1
	Bob_sum = 0
	flag = False
	while l <= r:
		moves += 1
		if flag == False:
			temp = A[r]
			Bob.append(A[r])
			r -= 1
			while temp <= Alice_sum and l <= r:
				Bob.append(A[r])
				temp += A[r]
				r -= 1
			Bob_sum = temp
			flag = True
		else:
			temp = A[l]
			Alice.append(A[l])
			l += 1
			while temp <= Bob_sum and l <= r:
				Alice.append(A[l])
				temp += A[l]
				l += 1
			Alice_sum = temp
			flag = False
	print(str(moves) + ' ' + str(sum(Alice)) + ' ' + str(sum(Bob)))
	tt -= 1


from collections import deque
t = int(input())
for i in range(t):
	n = int(input())
	dq = deque(map(int, input().split()))
	total_moves = 1
	sum_A = dq[0]
	p = dq[0]
	dq.popleft()
	sum_B = 0
	r = 0
	fl = 0
	while dq:
		while dq and r <= p:
			sum_B += dq[-1]
			r += dq[-1]
			dq.pop()
			fl = 1
		if fl:
			total_moves += 1
		p = r
		r = 0
		fl = 0
		while dq and r <= p:
			sum_A += dq[0]
			r += dq[0]
			dq.popleft()
			fl = 1
		p = r
		r = 0
		if fl:
			total_moves += 1
		fl = 0
	print(total_moves, sum_A, sum_B)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(a, b) = (0, 0)
	(l_a, l_b) = ([0], [0])
	(i, j) = (0, len(l) - 1)
	move = 0
	while True:
		while a <= l_b[-1] and i <= j:
			a += l[i]
			i += 1
		if a > l_b[-1]:
			l_a.append(a)
			a = 0
			move += 1
		else:
			if a != 0:
				l_a.append(a)
				move += 1
			break
		while b <= l_a[-1] and j >= i:
			b += l[j]
			j -= 1
		if b > l_b[-1]:
			l_b.append(b)
			b = 0
			move += 1
		else:
			if b != 0:
				l_b.append(b)
				move += 1
			break
	print(move, sum(l_a), sum(l_b))


for _ in range(int(input())):
	n = int(input())
	A = [int(x) for x in input().split()]
	i = 1
	j = n - 1
	a = A[0]
	b = 0
	aprev = a
	bprev = b
	move = 1
	while i <= j:
		temp = 0
		if i <= j:
			move += 1
		while i <= j and temp <= aprev:
			temp += A[j]
			j -= 1
		b += temp
		bprev = temp
		temp = 0
		if i <= j:
			move += 1
		while i <= j and temp <= bprev:
			temp += A[i]
			i += 1
		a += temp
		aprev = temp
	print(move, a, b)


t = int(input())
for test in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	hod = 1
	alice = a[0]
	bob = 0
	predHod = a[0]
	tekHod = 0
	al_in = 1
	bob_in = n - 1
	endGame = False
	while not endGame:
		if hod % 2 == 0:
			if al_in > bob_in:
				break
			tekHod = 0
			hod += 1
			while tekHod <= predHod and al_in <= bob_in:
				tekHod += a[al_in]
				al_in += 1
			alice += tekHod
			if tekHod <= predHod:
				break
			predHod = tekHod
		else:
			if al_in > bob_in:
				break
			hod += 1
			tekHod = 0
			while tekHod <= predHod and al_in <= bob_in:
				tekHod += a[bob_in]
				bob_in -= 1
			bob += tekHod
			if tekHod <= predHod:
				break
			predHod = tekHod
	print(hod, alice, bob)


from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = map(int, input().split())
	d = deque(a)
	total_count = 1
	left_total = d.popleft()
	i = 1
	right_total = 0
	prev_total = left_total
	while len(d) > 0:
		total_count += 1
		current_total = 0
		if i % 2 == 0:
			while len(d) and current_total <= prev_total:
				current_total += d.popleft()
			left_total += current_total
			prev_total = current_total
		else:
			while len(d) and current_total <= prev_total:
				current_total += d.pop()
			right_total += current_total
			prev_total = current_total
		i += 1
	print(total_count, end=' ')
	print(left_total, end=' ')
	print(right_total)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1:
		print(1, arr[0], 0)
		continue
	start = 1
	end = n - 1
	Bob = 1
	Alice_start = arr[0]
	Bob_end = 0
	no_of_moves = 1
	Alice_sweets = Alice_start
	Bob_sweets = 0
	while start <= end:
		flag = 1
		if Bob:
			Bob_end += arr[end]
			Bob_sweets += arr[end]
			if Bob_end > Alice_start:
				Bob = 0
				no_of_moves += 1
				Alice_start = 0
				flag = 0
			end -= 1
		else:
			Alice_start += arr[start]
			Alice_sweets += arr[start]
			if Bob_end < Alice_start:
				Bob = 1
				no_of_moves += 1
				Bob_end = 0
				flag = 0
			start += 1
	if flag:
		no_of_moves += 1
	print(no_of_moves, Alice_sweets, Bob_sweets)


t = int(input())
for R in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	bob = 0
	alice = 0
	prev = 0
	count = 0
	flag = 1
	while i <= j:
		temp = 0
		if flag:
			while i <= j and temp <= prev:
				temp += a[i]
				i += 1
			alice += temp
			flag = 0
		else:
			while i <= j and temp <= prev:
				temp += a[j]
				j -= 1
			bob += temp
			flag = 1
		prev = temp
		count += 1
	print(count, alice, bob)


t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	alice = arr[0]
	a = arr[0]
	arr.pop(0)
	bob = 0
	moves = 1
	while True and len(arr) > 0:
		try:
			b = 0
			i = 1
			while b <= a and len(arr) > 0:
				b += arr[-1]
				bob += arr[-1]
				arr.pop(-1)
				moves += i
				i = 0
			a = 0
			i = 1
			while a <= b and len(arr) > 0:
				a += arr[0]
				alice += arr[0]
				arr.pop(0)
				moves += i
				i = 0
		except:
			break
	print(moves, alice, bob)


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):
	i = 0
	j = N - 1
	last = 0
	numMoves = 0
	a = 0
	b = 0
	while i <= j:
		curr = 0
		while curr <= last and i <= j:
			curr += A[i]
			i += 1
		a += curr
		numMoves += 1
		last = curr
		if i <= j:
			curr = 0
			while curr <= last and i <= j:
				curr += A[j]
				j -= 1
			b += curr
			numMoves += 1
			last = curr
	return str(numMoves) + ' ' + str(a) + ' ' + str(b)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	l = 0
	r = n
	a = 0
	b = 0
	ta = 0
	tb = 0
	t = 0
	while l != r:
		if a == 0:
			while a <= b and l != r:
				a += arr[l]
				ta += arr[l]
				l += 1
			b = 0
		else:
			while b <= a and l != r:
				b += arr[r - 1]
				tb += arr[r - 1]
				r -= 1
			a = 0
		t += 1
	print(t, ta, tb)


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	totala = arr[0]
	totalb = 0
	curra = arr.pop(0)
	cnt = 1
	while len(arr):
		currb = 0
		while len(arr):
			currb += arr.pop()
			if currb > curra:
				cnt += 1
				totalb += currb
				break
			if len(arr) == 0:
				totalb += currb
				cnt += 1
		curra = 0
		while len(arr):
			curra += arr.pop(0)
			if curra > currb:
				cnt += 1
				totala += curra
				break
			if len(arr) == 0:
				totala += curra
				cnt += 1
	print(cnt, totala, totalb)
	t = t - 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections
testcases = int(input())
for j in range(testcases):
	n = int(input())
	candies = collections.deque(list(map(int, input().split())))
	moves = 0
	prevmove = 0
	parity = 0
	tota = 0
	totb = 0
	while len(candies) > 0:
		candsofar = 0
		while len(candies) > 0 and candsofar <= prevmove:
			if parity == 0:
				candsofar += candies.popleft()
			else:
				candsofar += candies.pop()
		if parity == 0:
			tota += candsofar
		else:
			totb += candsofar
		prevmove = candsofar
		parity = (parity + 1) % 2
		moves += 1
	print(str(moves) + ' ' + str(tota) + ' ' + str(totb))


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	I = 1
	J = N - 1
	E = A[0]
	F = 0
	X = E
	Y = F
	Z = 1
	C = 1
	while I <= J:
		if Z:
			F = 0
			while F <= E:
				F += A[J]
				J -= 1
				if I > J:
					break
			Y += F
			Z = 0
		else:
			E = 0
			while E <= F:
				E += A[I]
				I += 1
				if I > J:
					break
			X += E
			Z = 1
		C += 1
	print(C, X, Y)


t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	l = len(a)
	pa = 0
	pb = 0
	sa = 0
	sb = 0
	c = 0
	while l > 0:
		x = a[0]
		a.pop(0)
		while x <= pb and len(a) > 0:
			x += a[0]
			a.pop(0)
		pa = x
		sa += x
		c += 1
		l = len(a)
		if l > 0:
			y = a[l - 1]
			a.pop(l - 1)
			while y <= pa and len(a) > 0:
				l = len(a)
				y += a[l - 1]
				a.pop(l - 1)
			l = len(a)
			pb = y
			sb += y
			c += 1
	print(c, end=' ')
	print(sa, end=' ')
	print(sb)


t = int(input())
for i in range(t):
	n = int(input())
	numbers = [int(x) for x in input().split()]
	a = 0
	b = 0
	b_eaten = 0
	a_eaten = 0
	moves = 0
	while len(numbers) > 0:
		while a_eaten <= b_eaten and len(numbers) != 0:
			a_eaten += numbers[0]
			a += numbers[0]
			del numbers[0]
		if a_eaten != 0:
			moves += 1
		b_eaten = 0
		while b_eaten <= a_eaten and len(numbers) != 0:
			b_eaten += numbers[-1]
			b += numbers[-1]
			del numbers[-1]
		if b_eaten != 0:
			moves += 1
		a_eaten = 0
	print(moves, a, b)


from sys import stdin, stdout
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	left = 1
	right = n - 1
	a = arr[0]
	b = 0
	turn = 1
	last = a
	cnt = 2 if n > 1 else 1
	now = 0
	while left <= right:
		if turn:
			if now > last:
				turn = not turn
				cnt += 1
				last = now
				now = 0
				continue
			b += arr[right]
			now += arr[right]
			right -= 1
		else:
			if now > last:
				turn = not turn
				cnt += 1
				last = now
				now = 0
				continue
			a += arr[left]
			now += arr[left]
			left += 1
	print(cnt, a, b)


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a_tot = 0
	b_tot = 0
	a_lstMove = 0
	b_lstMove = 0
	count = 0
	l = 0
	r = n - 1
	while l <= r:
		flag = 0
		curMove_a = 0
		while l <= r and b_lstMove >= curMove_a:
			curMove_a += a[l]
			l += 1
		a_lstMove = curMove_a
		a_tot += a_lstMove
		count += 1
		curMove_b = 0
		while l <= r and a_lstMove >= curMove_b:
			flag = 1
			curMove_b += a[r]
			r -= 1
		b_lstMove = curMove_b
		b_tot += b_lstMove
		if flag == 1:
			count += 1
	print(count, a_tot, b_tot)


def eat(nums, i, j, left, eatMoreThan):
	s = 0
	index = None
	if left:
		index = i
		while s <= eatMoreThan and index <= j:
			s += nums[index]
			index += 1
	else:
		index = j
		while s <= eatMoreThan and i <= index:
			s += nums[index]
			index -= 1
	return (index, s)

def start_game(nums):
	i = 0
	j = len(nums) - 1
	alice = 0
	bob = 0
	left = True
	gAlice = 0
	gBob = 0
	moves = 0
	while i <= j:
		if left:
			(i, alice) = eat(nums, i, j, left, bob)
			gAlice += alice
			left = False
		else:
			(j, bob) = eat(nums, i, j, left, alice)
			gBob += bob
			left = True
		moves += 1
	return (moves, gAlice, gBob)

def main():
	t = int(input())
	global_ans = ''
	left = True
	for _ in range(t):
		n = int(input())
		nums = list(map(int, input().split()))
		ans = start_game(nums)
		for a in ans:
			global_ans += str(a) + ' '
		global_ans += '\n'
	print(global_ans[:-1])
main()


for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	(alice, bob) = (lst[0], 0)
	isAliceTurn = False
	before = lst[0]
	(i, j) = (1, n - 1)
	cnt = 1
	end = False
	while n != 1:
		if isAliceTurn:
			tmp = 0
			while tmp <= before and i <= j:
				tmp += lst[i]
				i += 1
			if i > j or i >= n:
				end = True
			alice += tmp
		else:
			tmp = 0
			while tmp <= before and i <= j:
				tmp += lst[j]
				j -= 1
			if i > j or j < 0:
				end = True
			bob += tmp
		before = tmp
		isAliceTurn = not isAliceTurn
		cnt += 1
		if end:
			break
	print(cnt, alice, bob)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	prevl = 0
	prevr = 0
	suml = 0
	sumr = 0
	moves = 0
	while l <= r:
		if moves % 2 == 0:
			prevl = 0
			while l <= r and prevl <= prevr:
				prevl = prevl + a[l]
				suml = suml + a[l]
				l = l + 1
		else:
			prevr = 0
			while l <= r and prevr <= prevl:
				prevr = prevr + a[r]
				sumr = sumr + a[r]
				r = r - 1
		moves += 1
	print(moves, suml, sumr)
	t -= 1


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
for _ in range(int(input())):
	n = int(input())
	z = list(map(int, input().split()))
	(a, b) = (0, 0)
	count = 0
	l = 0
	r = n - 1
	preva = 0
	prevb = 0
	while l <= r:
		if count % 2 == 0:
			x = 0
			while x <= prevb and l <= r:
				x += z[l]
				l += 1
			if x > prevb:
				preva = x
				a += x
				count += 1
			else:
				a += x
				count += 1
				break
		else:
			x = 0
			while x <= preva and l <= r:
				x += z[r]
				r -= 1
			if x > preva:
				prevb = x
				b += x
				count += 1
			else:
				b += x
				count += 1
				break
	print(count, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	arr = input().split(' ')
	for i in range(n):
		arr[i] = int(arr[i])
	a = 0
	b = 0
	p1 = 0
	p2 = n - 1
	prev1 = 0
	prev2 = 0
	num_moves = 0
	while p1 <= p2:
		curr1 = 0
		curr2 = 0
		while curr1 <= prev2 and p1 <= p2:
			curr1 += arr[p1]
			p1 += 1
		while curr2 <= curr1 and p2 >= p1:
			curr2 += arr[p2]
			p2 -= 1
		a += curr1
		b += curr2
		num_moves += curr1 > 0
		num_moves += curr2 > 0
		prev1 = curr1
		prev2 = curr2
	print(str(num_moves) + ' ' + str(a) + ' ' + str(b))


from collections import deque
for i in range(int(input())):
	n = int(input())
	l = deque(list(map(int, input().split())))
	moves = 1
	a = l.popleft()
	b = 0
	x = 0
	prev = a
	while len(l):
		if x == 0:
			t = 0
			while len(l) and t <= prev:
				t += l.pop()
			prev = t
			b += t
		else:
			t = 0
			while len(l) and t <= prev:
				t += l.popleft()
			prev = t
			a += t
		moves += 1
		x = not x
	print(moves, a, b)


a = input()
t = int(a)
for k in range(0, t, 1):
	a = input()
	n = int(a)
	import array
	arr1 = array.array('l', [])
	arr1 = [int(i) for i in input().split()]
	xx = 0
	yy = 0
	b = 0
	c = 0
	pp = 0
	while len(arr1) > 0:
		kj = 0
		x = 0
		ll = len(arr1)
		for j in range(0, ll, 1):
			x = int(arr1[0])
			del arr1[0]
			kj = kj + x
			if kj > c:
				xx = xx + kj
				b = kj
				pp = pp + 1
				kj = 0
				break
		if (len(arr1) == 0) & (kj <= c) & (kj != 0):
			xx = xx + kj
			pp = pp + 1
			break
		kj = 0
		x = 0
		ll = len(arr1)
		for j in range(0, ll, 1):
			x = int(arr1[-1])
			del arr1[-1]
			kj = kj + x
			if kj > b:
				yy = yy + kj
				c = kj
				pp = pp + 1
				kj = 0
				break
		if (len(arr1) == 0) & (kj <= b) & (kj != 0):
			yy = yy + kj
			pp = pp + 1
			break
	zzz = str(xx)
	rrr = str(yy)
	uuu = str(pp)
	print(uuu + ' ' + zzz + ' ' + rrr)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(ptr1, ptr2) = (1, n - 1)
	(w_a, w_b) = (a[0], 0)
	(p_a, p_b) = (a[0], 0)
	a[0] = 0
	(c_a, c_b) = (0, 0)
	moves = 1
	sig = 1
	while ptr1 <= ptr2:
		(c_a, c_b) = (0, 0)
		if sig == 1:
			while c_b <= p_a:
				if a[ptr2] == 0:
					break
				c_b += a[ptr2]
				a[ptr2] = 0
				ptr2 -= 1
			w_b += c_b
			sig = 0
			moves += 1
			p_b = c_b
		else:
			while c_a <= p_b:
				if a[ptr1] == 0:
					break
				c_a += a[ptr1]
				a[ptr1] = 0
				ptr1 += 1
			w_a += c_a
			sig = 1
			moves += 1
			p_a = c_a
	print(moves, w_a, w_b)


t = int(input())
for i in range(t):
	length = int(input())
	arr = list(map(int, input().split()))
	alice = arr[0]
	bob = 0
	aliceLast = arr[0]
	bobLast = 0
	alicePointer = 1
	bobPointer = length - 1
	counter = 1
	flag = True
	while True:
		if flag:
			bobLast = 0
			while bobPointer >= alicePointer and bobLast <= aliceLast:
				bobLast += arr[bobPointer]
				bobPointer -= 1
				flag = False
			bob += bobLast
			if bobLast > 0:
				counter += 1
		else:
			aliceLast = 0
			while alicePointer <= bobPointer and aliceLast <= bobLast:
				aliceLast += arr[alicePointer]
				alicePointer += 1
				flag = True
			alice += aliceLast
			if aliceLast > 0:
				counter += 1
		if alicePointer > bobPointer:
			break
	print(counter, alice, bob)


t = int(input())
for _ in range(t):
	l = int(input())
	lis = list(map(int, input().split()))
	a = 0
	b = 0
	atot = a
	btot = b
	count = 0
	posa = 0
	posb = l - 1
	while True:
		ate = 0
		if count % 2 == 0:
			while ate <= b and posb >= posa:
				ate += lis[posa]
				posa += 1
			if ate > a:
				a = ate
			atot += ate
		else:
			while ate <= a and posb >= posa:
				ate += lis[posb]
				posb -= 1
			if ate > b:
				b = ate
			btot += ate
		count += 1
		if posb < posa:
			break
	print(count, atot, btot)


t = int(input())
for i in range(t):
	n = int(input())
	candies = [int(s) for s in input().split()]
	a = candies[0]
	candies = candies[1:]
	b = 0
	a_all = a
	b_all = 0
	moves = 1
	while len(candies) != 0:
		while b <= a and len(candies) != 0:
			b += candies[-1]
			b_all += candies[-1]
			candies = candies[:-1]
		moves += 1
		a = 0
		while a <= b and len(candies) != 0:
			a += candies[0]
			a_all += candies[0]
			candies = candies[1:]
		if a > 0:
			moves += 1
		b = 0
	print(moves, a_all, b_all)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, val, ans):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		v = val ** 5 - mid ** 5
		print(v)
		if v == ans:
			print('HOHOHOH')
			return mid
		elif v < ans:
			return binary(mid + 1, r, val, ans)
		else:
			return binary(l, mid - 1, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v

def stairs(n, m, val, c, l):
	if val > n:
		return 100000
	elif val == n:
		if l[val] != -1:
			return l[val]
		elif c % m == 0:
			l[val] = c
			return l[val]
		else:
			l[val] = 100000
			return l[val]
	else:
		l[val] = min(stairs(n, m, val + 1, c + 1, l), stairs(n, m, val + 2, c + 1, l))
		return l[val]

def fact(n):
	if n == 0 or n == 1:
		return 1
	else:
		return n * fact(n - 1)

def some(n):
	s = 0
	while n != 0:
		s += fact(n % 10)
		n //= 10
	return s

def bin(l, r, val, ll):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		print(ll[mid])
		if ll[mid] == val:
			return mid
		elif ll[mid] > val:
			return bin(l, mid - 1, val, ll)
		else:
			return bin(mid + 1, r, val, ll)
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c = 0
	i1 = 0
	i2 = n - 1
	sum1 = 0
	sum2 = 0
	val1 = 0
	val2 = 0
	move = 0
	while i1 <= i2:
		if move == 0:
			val1 = 0
			while i1 <= i2 and val1 <= val2:
				val1 += l[i1]
				i1 += 1
			if val1 <= val2:
				sum1 += val1
				c += 1
				break
			else:
				sum1 += val1
			move = 1
			c += 1
		else:
			val2 = 0
			while i1 <= i2 and val2 <= val1:
				val2 += l[i2]
				i2 -= 1
			if val2 <= val1:
				sum2 += val2
				c += 1
				break
			else:
				sum2 += val2
			move = 0
			c += 1
	print(c, sum1, sum2)


T = int(input())
while T:
	T = T - 1
	N = int(input())
	if N == 0:
		print(0, 0, 0)
		continue
	arr = input().split()
	l = 1
	a = int(arr[0])
	a1 = a
	b1 = 0
	flag = 1
	b = 0
	r = len(arr) - 1
	moves = 1
	while l <= r:
		if flag == 1:
			b1 = 0
			while a1 >= b1:
				b1 = b1 + int(arr[r])
				r = r - 1
				if l > r:
					break
			flag = 0
			b = b + b1
		else:
			a1 = 0
			while b1 >= a1:
				a1 = a1 + int(arr[l])
				l = l + 1
				if l > r:
					break
			flag = 1
			a = a + a1
		moves = moves + 1
	print(moves, a, b)


import math
T = int(input())
for tt in range(T):
	n = int(input())
	arr = [int(i) for i in input().split()]
	if n == 1:
		print(1, arr[0], 0)
		continue
	i1 = 0
	i2 = n - 1
	arr1 = []
	arr2 = []
	count = 0
	psum1 = 0
	psum2 = 0
	csum = 0
	while i1 <= i2:
		csum = 0
		count += 1
		if count % 2:
			while csum <= psum2 and i1 <= i2:
				csum += arr[i1]
				i1 += 1
			psum1 = csum
			arr1.append(csum)
		else:
			while csum <= psum1 and i2 >= i1:
				csum += arr[i2]
				i2 -= 1
			psum2 = csum
			arr2.append(csum)
	print(count, sum(arr1), sum(arr2))


for _ in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	a = data[0]
	apoint = 1
	b = 0
	bpoint = n - 1
	ac = data[0]
	bc = 0
	moves = 1
	achance = True
	i = 1
	while i < n:
		if achance == True:
			b = 0
			f = 0
			while b <= a and i < n:
				b += data[bpoint]
				bpoint -= 1
				f = 1
				i += 1
			bc += b
			if f == 1:
				moves += 1
			achance = not achance
		else:
			a = 0
			f = 0
			while a <= b and i < n:
				a += data[apoint]
				apoint += 1
				f = 1
				i += 1
			ac += a
			if f == 1:
				moves += 1
			achance = not achance
	print(moves, ac, bc)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	alice = 0
	bob = 0
	cnt = 0
	aprev = 0
	bprev = 0
	while i <= j:
		if cnt % 2 == 0:
			aprev = 0
			while aprev <= bprev and i <= j:
				alice += a[i]
				aprev += a[i]
				i += 1
		else:
			bprev = 0
			while bprev <= aprev and i <= j:
				bob += a[j]
				bprev += a[j]
				j -= 1
		cnt += 1
	print(cnt, alice, bob)


import sys
input = sys.stdin.readline
(T,) = map(int, input().split())
for _ in range(T):
	(N,) = map(int, input().split())
	X = list(map(int, input().split()))
	(i, j) = (-1, len(X))
	b = 0
	ta = tb = 0
	m = 0
	while True:
		t = 0
		while b >= t and i + 1 < j:
			i += 1
			t += X[i]
		ta += t
		b = t
		m += 1
		if i + 1 == j:
			break
		t = 0
		while b >= t and i + 1 < j:
			j -= 1
			t += X[j]
		tb += t
		b = t
		m += 1
		if i + 1 == j:
			break
	print(m, ta, tb)


for qq in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	(a, b) = (0, n - 1)
	ans = asum = bsum = 0
	prev = 0
	turn = 0
	while a <= b:
		ans += 1
		cnt = 0
		if turn == 0:
			while prev >= cnt and a <= b:
				asum += A[a]
				cnt += A[a]
				a += 1
			prev = cnt
		else:
			while prev >= cnt and a <= b:
				bsum += A[b]
				cnt += A[b]
				b -= 1
			prev = cnt
		turn ^= 1
	print(ans, asum, bsum)


t = int(input())
for i in range(t):
	n = int(input())
	ls = [int(a) for a in input().split()]
	ls1 = []
	bp = False
	pm1 = 0
	(al, bb) = (0, 0)
	x = 0
	while len(ls) > 0:
		(a, j) = (0, 0)
		cur = len(ls)
		if len(ls) > 0:
			x += 1
			while a <= pm1:
				a += ls[0]
				ls.pop(0)
				if len(ls) == 0:
					bp = True
					break
		pm1 = a
		al += a
		(a, j) = (0, -1)
		if len(ls) > 0:
			x += 1
			while a <= pm1:
				a += ls[-1]
				ls.pop(-1)
				if len(ls) == 0:
					bp = True
					break
		bb += a
		if bp == True:
			break
		pm1 = a
	print(x, al, bb)


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	n = int(I())
	a = list(map(int, I().split()))
	alice = 0
	bob = 0
	i = 0
	j = len(a) - 1
	alice_last = 0
	bob_last = 0
	rou = 0
	while i <= j:
		alice += alice_last
		alice_last = 0
		if i <= j:
			rou += 1
		while alice_last <= bob_last and i <= j:
			alice_last += a[i]
			i += 1
		bob += bob_last
		bob_last = 0
		if i <= j:
			rou += 1
		while bob_last <= alice_last and i <= j:
			bob_last += a[j]
			j -= 1
	alice += alice_last
	bob += bob_last
	ans += f'{rou} {alice} {bob}\n'
print(ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 0
	a = 0
	b = 0
	i = 0
	j = n - 1
	pre_a = 0
	pre_b = 0
	while i <= j:
		if pre_a <= pre_b and i <= j:
			ans += 1
			pre_a = 0
			while pre_a <= pre_b and i <= j:
				pre_a += l[i]
				i += 1
			a += pre_a
		elif pre_b <= pre_a and i <= j:
			ans += 1
			pre_b = 0
			while pre_b <= pre_a and i <= j:
				pre_b += l[j]
				j -= 1
			b += pre_b
	print(ans, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 0
	l = 0
	r = 0
	prev = 0
	c = 0
	while len(a) > 0:
		if a[0] > prev and flag == 0:
			l += a[0]
			prev = a.pop(0)
			flag = 1
			c += 1
		elif a[-1] > prev and flag == 1:
			r += a[-1]
			prev = a.pop(-1)
			flag = 0
			c += 1
		elif a[0] <= prev and flag == 0:
			x = 0
			while x <= prev and len(a) > 0:
				x += a[0]
				a.pop(0)
			prev = x
			l += x
			flag = 1
			c += 1
		elif a[-1] <= prev and flag == 1:
			x = 0
			while x <= prev and len(a) > 0:
				x += a[-1]
				a.pop(-1)
			prev = x
			r += x
			flag = 0
			c += 1
	print(c, l, r, end=' ')


t = int(input())
while t:
	t -= 1
	n = int(input())
	ar = list(map(int, input().split()))
	front = 0
	back = n - 1
	prev = 0
	turn = 1
	backMoves = 0
	frontMoves = 0
	flag = 0
	moves = 0
	frontSum = 0
	backSum = 0
	while flag == 0:
		if turn == 2:
			s = 0
			while s <= prev and flag == 0:
				s += ar[back]
				backSum += ar[back]
				back -= 1
				backMoves += 1
				turn = 1
				if back < front:
					flag = 1
					break
			prev = s
			moves += 1
		else:
			s = 0
			while s <= prev and flag == 0:
				s += ar[front]
				frontSum += ar[front]
				front += 1
				frontMoves += 1
				turn = 2
				if back < front:
					flag = 1
					break
			prev = s
			moves += 1
	print(moves, frontSum, backSum)


import sys
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().strip().split()))
	totala = 0
	totalb = 0
	moves = 0
	lastsum = 0
	indexa = 0
	indexb = len(a) - 1
	while True:
		moves += 1
		aktsum = 0
		a = list(reversed(a))
		while aktsum <= lastsum and a:
			aktsum += a.pop()
		lastsum = aktsum
		if moves % 2:
			totala += aktsum
		else:
			totalb += aktsum
		if not a:
			break
	print(moves, totala, totalb)


t = int(input())
for case in range(t):
	a = 0
	b = 0
	n = int(input())
	moves = 0
	sizes = list(map(int, input().split()))
	new_size = 0
	last_size = 0
	game = True
	while game:
		new_size = 0
		while last_size >= new_size:
			if len(sizes) == 0:
				game = False
				break
			new_size += sizes.pop(0)
		last_size = new_size
		a += new_size
		if len(sizes):
			moves += 1
		else:
			last_move = 1
		new_size = 0
		while last_size >= new_size:
			if len(sizes) == 0:
				game = False
				break
			new_size += sizes.pop()
		last_size = new_size
		b += new_size
		if len(sizes):
			moves += 1
		else:
			last_move = 1
	print(moves + last_move, a, b)


def four(n, c):
	(i, j) = (1, n - 1)
	a = c[0]
	pred = a
	if n == 1:
		b = 0
	elif n == 2:
		b = 0
	else:
		b = 0
	k = 1
	isbob = True
	while i <= j:
		cur = 0
		if isbob:
			for jdx in range(j, i - 1, -1):
				cur += c[jdx]
				if cur > pred or jdx == i:
					b += cur
					pred = cur
					j = jdx - 1
					isbob = False
					break
		else:
			for idx in range(i, j + 1):
				cur += c[idx]
				if cur > pred or idx == j:
					a += cur
					pred = cur
					i = idx + 1
					isbob = True
					break
		k += 1
	return (k, a, b)
t = int(input())
for _ in range(t):
	n = int(input())
	c = list(map(int, input().split()))
	print(*four(n, c))


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

def lcm(a, b):
	return a * b // math.gcd(a, b)

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def solve():
	n = int(input())
	arr = list_input()
	if n == 1:
		print(1, arr[0], 0)
	elif n == 2:
		print(2, arr[0], arr[1])
	else:
		moves = sum1 = sum2 = 0
		alice = bob = 0
		indx1 = -1
		indx2 = n
		while indx1 < indx2:
			moves += 1
			alice = 0
			while alice <= bob:
				indx1 += 1
				if indx1 == indx2:
					break
				alice += arr[indx1]
			sum1 += alice
			if indx1 == indx2 or indx1 + 1 == indx2:
				break
			moves += 1
			bob = 0
			while bob <= alice:
				indx2 -= 1
				if indx2 == indx1:
					break
				bob += arr[indx2]
			sum2 += bob
			if indx1 + 1 == indx2:
				break
		print(moves, sum1, sum2)
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(la, lb) = ([0], [0])
	la[0] = l[0]
	diff = l[0]
	l.pop(0)
	(cnt, sa, sb) = (1, diff, 0)
	while len(l) != 0:
		cnt += 1
		if cnt % 2 == 0:
			su = 0
			while su <= diff:
				if len(l) > 0:
					sb += l[-1]
					su += l[-1]
					l.pop()
				else:
					break
			diff = su
		else:
			su = 0
			while su <= diff:
				if len(l) > 0:
					sa += l[0]
					su += l[0]
					l.pop(0)
				else:
					break
			diff = su
	print(cnt, sa, sb)


n = int(input())
for _ in range(n):
	a = int(input())
	arr = [int(i) for i in input().split()]
	co = 0
	sums = 0
	coun = 0
	prev = 0
	prevs = 0
	while len(arr) > 0:
		if co % 2 == 0:
			prev = 0
			while prev <= prevs:
				if len(arr) > 0:
					p = arr.pop(0)
					sums += p
					prev += p
				else:
					break
		else:
			prevs = 0
			while prevs <= prev:
				if len(arr) > 0:
					pp = arr.pop(len(arr) - 1)
					coun += pp
					prevs += pp
				else:
					break
		co += 1
	print(co, sums, coun)


for _ in range(int(input())):
	n = int(input())
	ar = [int(x) for x in input().split()]
	alice = 0
	bob = 0
	move = 0
	i = -1
	j = n
	prev = 0
	bl = True
	sm = 0
	ins = 0
	while True:
		if bl == True:
			i += 1
			ind = 0
			if i >= j:
				break
			sm += ar[i]
			if sm > prev:
				ind = 1
				alice += sm
				prev = sm
				sm = 0
				move += 1
				bl = False
		else:
			ind = 0
			j -= 1
			if i >= j:
				break
			sm += ar[j]
			if sm > prev:
				ind = 1
				bob += sm
				prev = sm
				sm = 0
				move += 1
				bl = True
	if sm > 0:
		move += 1
	if sm > 0 and ind == 0 and (bl == True):
		alice += sm
	if sm > 0 and ind == 0 and (bl == False):
		bob += sm
	print(move, alice, bob)


k = int(input())
for k0 in range(k):
	ln = int(input())
	sp = list(map(int, input().split()))
	_lf = 0
	_rt = ln
	(sA, sB) = (0, 0)
	time = 1
	(s1b, s1a) = (0, 0)
	while _lf < _rt:
		if time % 2 == 1:
			if time == 1:
				s1a = sp[_lf]
				_lf += 1
				sA += s1a
			else:
				s1a = 0
				while s1a <= s1b:
					if _lf == _rt:
						break
					s1a += sp[_lf]
					_lf += 1
				sA += s1a
		else:
			s1b = 0
			while s1b <= s1a:
				if _lf == _rt:
					break
				s1b += sp[_rt - 1]
				_rt -= 1
			sB += s1b
		time += 1
	print(time - 1, sA, sB)


t = int(input())
for y in range(0, t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	c = 0
	d = 0
	q = 0
	w = 0
	x = 0
	while len(a) > 0:
		if x % 2 == 0:
			r = 0
			while len(a) > 0 and r <= w:
				r += a[0]
				c += a[0]
				g = a.pop(0)
			q = r
		else:
			j = 0
			while len(a) > 0 and j <= q:
				j += a[len(a) - 1]
				d += a[len(a) - 1]
				g = a.pop(len(a) - 1)
			w = j
		x += 1
	print(f'{x} {c} {d}')


for t in range(int(input())):
	n = int(input())
	vs = list(map(int, input().split(' ')))
	(a, b) = (0, 0)
	(l, r) = (0, n - 1)
	steps = 0
	last = vs[0]
	a += vs[0]
	l += 1
	steps += 1
	while l <= r:
		cur = 0
		while l <= r and cur <= last:
			cur += vs[r]
			r -= 1
		steps += 1
		b += cur
		last = cur
		if not l <= r:
			break
		cur = 0
		while l <= r and cur <= last:
			cur += vs[l]
			l += 1
		steps += 1
		a += cur
		last = cur
	print(steps, a, b)


from collections import deque

def ans():
	global c
	print(ans1, ans2, ans3)
	c = 1
	return
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(ans1, ans2, ans3) = (0, 0, 0)
	eatcnt = 0
	q = deque(a)
	c = 0
	while True:
		ans1 += 1
		eatnow = 0
		while True:
			eat = q.popleft()
			eatnow += eat
			ans2 += eat
			if not q:
				ans()
				break
			if eatcnt < eatnow:
				eatcnt = eatnow
				break
		if c == 1:
			break
		ans1 += 1
		eatnow = 0
		while True:
			eat = q.pop()
			eatnow += eat
			ans3 += eat
			if not q:
				ans()
				break
			if eatcnt < eatnow:
				eatcnt = eatnow
				break
		if c == 1:
			break


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = l.pop(0)
	b = 0
	c = 1
	pre_a = a
	pre_b = 0
	while n - 1 > 0:
		if c % 2 == 0:
			if sum(l) > pre_b:
				cur_a = 0
				while pre_b >= cur_a:
					cur_a = cur_a + l.pop(0)
					n -= 1
				a = a + cur_a
				pre_a = cur_a
				c += 1
			else:
				a = a + sum(l)
				c += 1
				n = n - len(l)
		elif sum(l) > pre_a:
			cur_b = 0
			while pre_a >= cur_b:
				cur_b = cur_b + l.pop()
				n -= 1
			b = b + cur_b
			pre_b = cur_b
			c += 1
		else:
			b = b + sum(l)
			c += 1
			n = n - len(l)
	print(c, a, b)


def ans(lis):
	a = lis[0]
	b = 0
	i = 1
	j = len(lis) - 1
	chance = 1
	prev = a
	moves = 1
	while i <= j:
		if chance == 1:
			curr = 0
			while curr <= prev and i <= j:
				b += lis[j]
				curr += lis[j]
				j -= 1
			chance = 0
			prev = curr
			moves += 1
		else:
			curr = 0
			while curr <= prev and i <= j:
				a += lis[i]
				curr += lis[i]
				i += 1
			chance = 1
			prev = curr
			moves += 1
	return [moves, a, b]
n = int(input())
for i in range(n):
	b = input()
	a = input().split()
	lis = []
	for i in a:
		lis.append(int(i))
	x = ans(lis)
	print(str(x[0]) + ' ' + str(x[1]) + ' ' + str(x[2]))


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	n = ii()
	d = li()
	a = 0
	b = n - 1
	resa = resb = pa = pb = turns = 0
	f = 1
	while a <= b:
		turns += 1
		ca = cb = 0
		if f:
			while ca <= pb and a <= b:
				ca += d[a]
				a += 1
			resa += ca
			pa = ca
		else:
			while cb <= pa and a <= b:
				cb += d[b]
				b -= 1
			resb += cb
			pb = cb
		f = 1 - f
	print(turns, resa, resb)


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	prev = 0
	l = 0
	c = 0
	r = n - 1
	a = b = 0
	while l <= r:
		cur = 0
		if c % 2 == 0:
			while l <= r and cur <= prev:
				cur += lis[l]
				l += 1
			a += cur
		else:
			while r >= l and cur <= prev:
				cur += lis[r]
				r -= 1
			b += cur
		c += 1
		prev = cur
	print(c, a, b)


import sys
from collections import deque
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
	n = int(input())
	candy = deque(list(map(int, input().split())))
	move = 1
	alice = [candy.popleft()]
	bob = list()
	pa = alice[0]
	pb = 0
	ca = False
	cb = False
	while candy:
		while pb <= pa:
			if not candy:
				break
			temp = candy.pop()
			pb += temp
			bob.append(temp)
			cb = True
		pa = 0
		while pa <= pb:
			if not candy:
				break
			temp = candy.popleft()
			pa += temp
			alice.append(temp)
			ca = True
		pb = 0
		if ca:
			move += 1
			ca = False
		if cb:
			move += 1
			cb = False
	print(move, sum(alice), sum(bob))


class A:

	def solve(self):
		t = int(input())
		for i in range(t):
			n = list(map(int, input()))
			round_numbers = list(map(lambda x: x[0] * 10 ** x[1], filter(lambda x: x[0] > 0, zip(n, reversed(list(range(len(n))))))))
			print(len(round_numbers))
			print(' '.join(map(str, round_numbers)))

class B:

	def solve(self):
		t = int(input())
		for p in range(t):
			in_list = list(map(int, input().split(' ')))
			(n, k) = (in_list[0], in_list[1])
			if k % 2 == 1:
				if n % 2 == 0:
					first_term = n - (k - 1) * 2
					if first_term <= 0:
						print('NO')
						continue
					print('YES')
					print(' '.join([str(first_term)] + ['2' for x in range(k - 1)]))
				else:
					first_term = n - (k - 1)
					if first_term <= 0:
						print('NO')
						continue
					print('YES')
					print(' '.join([str(first_term)] + ['1' for x in range(k - 1)]))
			elif n % 2 == 0:
				first_term = n - (k - 1)
				if first_term <= 0:
					print('NO')
					continue
				if first_term % 2 == 1:
					print('YES')
					print(' '.join([str(first_term)] + ['1' for x in range(k - 1)]))
					continue
				first_term = n - (k - 1) * 2
				if first_term <= 0:
					print('NO')
					continue
				if first_term % 2 == 0:
					print('YES')
					print(' '.join([str(first_term)] + ['2' for x in range(k - 1)]))
				else:
					print('NO')
			else:
				print('NO')

class C:

	def solve(self):
		t = int(input())
		for p in range(t):
			in_list = list(map(int, input().split(' ')))
			(n, k) = (in_list[0], in_list[1])
			m = k // (n - 1)
			if k % (n - 1) == 0:
				print(m * n - 1)
				continue
			print(m * n + k % (n - 1))

class D:

	def solve(self):
		t = int(input())
		for p in range(t):
			n = int(input())
			candies = [int(x) for x in input().split(' ')]
			if len(candies) == 1:
				print('1 {} 0'.format(candies[0]))
				continue
			(b, a, n) = self.eat_candy(candies[1:], 1, 0, candies[0], 1, candies[0])
			print('{} {} {}'.format(n, a, b))

	def eat_candy(self, candies, turn, b_candy, a_candy, n_turns, previous_candy):
		if turn == 0:
			alice_sum = 0
			index = 0
			while index < len(candies) and alice_sum <= previous_candy:
				alice_sum += candies[index]
				index += 1
			if index == len(candies):
				return (b_candy, a_candy + alice_sum, n_turns + 1)
			else:
				return self.eat_candy(candies[index:], 1, b_candy, a_candy + alice_sum, n_turns + 1, alice_sum)
		else:
			bob_sum = 0
			index = len(candies) - 1
			while index >= 0 and bob_sum <= previous_candy:
				bob_sum += candies[index]
				index -= 1
			if index < 0:
				return (b_candy + bob_sum, a_candy, n_turns + 1)
			else:
				return self.eat_candy(candies[:index + 1], 0, b_candy + bob_sum, a_candy, n_turns + 1, bob_sum)
D().solve()


t = int(input())
for t in range(t):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	A = B = cnt = 0
	A += a[0]
	curr = a[0]
	a.pop(0)
	cnt += 1
	while len(a) > 0:
		prev = curr
		curr = 0
		while curr <= prev:
			B += a[-1]
			curr += a[-1]
			a.pop()
			if len(a) == 0:
				break
		cnt += 1
		prev = curr
		curr = 0
		if len(a) == 0:
			break
		while curr <= prev:
			A += a[0]
			curr += a[0]
			a.pop(0)
			if len(a) == 0:
				break
		cnt += 1
	print(cnt, A, B)


import math as mt
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for i in range(t):
	n = I()
	l = L()
	i = -1
	j = n
	a = 0
	b = 0
	pa = 0
	pb = 0
	r = 0
	while True:
		ca = 0
		cb = 0
		while ca <= pb and i < j - 1:
			i += 1
			ca += l[i]
		if i >= j - 1:
			r += 1
			a += ca
			break
		a += ca
		pa = ca
		r += 1
		while cb <= pa and j > i + 1:
			j -= 1
			cb += l[j]
		if j <= i + 1:
			r += 1
			b += cb
			break
		b += cb
		pb = cb
		r += 1
	print(r, a, b)


t = int(input())
for hh in range(0, t):
	n = int(input())
	a = [int(x) for x in input().split()]
	s = sum(a)
	left = 0
	right = n - 1
	prev = 0
	alice = 0
	bob = 0
	steps = 0
	finalalice = 0
	finalbob = 0
	while left <= right:
		currsum = 0
		alice = 0
		if left <= right:
			steps += 1
		while left <= right and currsum <= bob:
			currsum += a[left]
			alice += a[left]
			finalalice += a[left]
			left += 1
		currsum = 0
		bob = 0
		if left <= right:
			steps += 1
		while left <= right and currsum <= alice:
			currsum += a[right]
			bob += a[right]
			finalbob += a[right]
			right -= 1
	print(steps, finalalice, finalbob)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	y = 0
	x = a[0]
	i = 0
	j = n
	s1 = x
	s2 = 0
	temp = 1
	moves = 1
	while j - i != 1:
		if temp:
			s2 = 0
			while s2 <= s1:
				s2 += a[j - 1]
				j -= 1
				if i + 1 == j:
					break
			y += s2
			temp = 0
		else:
			s1 = 0
			while s1 <= s2:
				s1 += a[i + 1]
				i += 1
				if j == i + 1:
					break
			x += s1
			temp = 1
		moves += 1
	print(moves, x, y)


def f(A):
	counter = A[0]
	alice = A.pop(0)
	bob = 0
	turn = 1
	while len(A) > 0:
		if turn % 2 == 0 and len(A) > 0:
			eat = 0
			while eat <= counter and len(A) > 0:
				eat += A.pop(0)
			alice += eat
			counter = eat
			turn += 1
		if turn % 2 == 1 and len(A) > 0:
			eat = 0
			while eat <= counter and len(A) > 0:
				eat += A.pop(len(A) - 1)
			bob += eat
			counter = eat
			turn += 1
	print(turn, alice, bob)
for i in range(int(input())):
	n = int(input())
	A = input().split(' ')
	for i in range(n):
		A[i] = int(A[i])
	f(A)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	z = 0
	s = 0
	ans1 = 0
	ans2 = 0
	while r - l >= 0:
		if z % 2 == 0:
			c = 0
			while c <= s and r >= l:
				c = c + a[l]
				l = l + 1
			ans1 += c
		else:
			c = 0
			while c <= s and r >= l:
				c = c + a[r]
				r = r - 1
			ans2 += c
		s = c
		z = z + 1
	print(z, ans1, ans2)


T = int(input())
for l in range(T):
	n = int(input())
	l = list(map(int, input().split()))
	A = []
	B = []
	last_a = 0
	last_b = 0
	count = 0
	temp = True
	while temp:
		count = count + 1
		temp1 = True
		sum_A = 0
		while temp1 and count != 1:
			i = l.pop(0)
			if i + sum_A <= last_b:
				A.append(i)
				sum_A = sum_A + i
			else:
				A.append(i)
				sum_A = sum_A + i
				break
			if len(l) == 0:
				temp1 = False
		if count == 1:
			i = l.pop(0)
			A.append(i)
			sum_A = sum_A + i
		last_a = sum_A
		if len(l) == 0:
			temp = False
			break
		temp2 = True
		sum_B = 0
		count = count + 1
		while temp2:
			i = l.pop()
			if i + sum_B <= last_a:
				B.append(i)
				sum_B = sum_B + i
			else:
				B.append(i)
				sum_B = sum_B + i
				break
			if len(l) == 0:
				temp2 = False
		last_b = sum_B
		if len(l) == 0:
			temp = False
			break
	print(count, sum(A), sum(B))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	x = 1
	p = l[i]
	q = 0
	a = p
	b = 0
	i += 1
	f1 = 0
	f2 = 0
	while i <= j:
		q = 0
		while j >= i and q <= p:
			q += l[j]
			j -= 1
			if j < i:
				f1 = 1
				break
		x += 1
		b += q
		if f1 == 1:
			break
		p = 0
		while j >= i and p <= q:
			p += l[i]
			i += 1
			if j < i:
				f2 = 1
				break
		x += 1
		a += p
		if f2 == 1:
			break
	print(x, a, b)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(a_i, b_i) = (1, n - 1)
	(Alice, Bob) = (a[0], 0)
	num_list = [a[0], 0]
	k = 1
	while a_i <= b_i:
		if Bob < Alice:
			while Bob <= Alice and b_i >= a_i:
				Bob += a[b_i]
				b_i -= 1
			else:
				Alice = 0
				num_list[1] += Bob
		else:
			while Bob >= Alice and b_i >= a_i:
				Alice += a[a_i]
				a_i += 1
			else:
				Bob = 0
				num_list[0] += Alice
		k += 1
	print(k, num_list[0], num_list[1])


t = int(input())
for tests in range(t):
	n = int(input())
	A = input().split()
	lenA = len(A)
	for i in range(lenA):
		A[i] = int(A[i])
	l = 1
	r = len(A) - 1
	lasts = A[0]
	player = 1
	a = A[0]
	b = 0
	sums = 0
	move = 1
	endr = True
	while l <= r:
		if player == 1:
			if endr == True:
				endr = False
				move += 1
			sums += A[r]
			b += A[r]
			r -= 1
			if sums > lasts:
				player = 0
				lasts = sums
				sums = 0
				endr = True
		else:
			if endr == True:
				endr = False
				move += 1
			sums += A[l]
			a += A[l]
			l += 1
			if sums > lasts:
				player = 1
				lasts = sums
				sums = 0
				endr = True
	print('%d %d %d' % (move, a, b))


INT_MAX = 10 ** 11 + 7
MOD = 10 ** 9 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
GETA = 123
from collections import deque
q = deque()
for _ in range(int(input())):
	n = int(input())
	A = INPUT()
	for ele in A:
		q.append(ele)
	bobsum = 0
	alicesum = 0
	bobprev = 0
	aliceprev = 0
	moves = 0
	while len(q) != 0:
		if moves % 2 == 0:
			aliceprev = 0
			while len(q) != 0 and bobprev >= aliceprev:
				aliceprev += q[0]
				alicesum += q[0]
				q.popleft()
			moves += 1
		else:
			bobprev = 0
			while len(q) != 0 and bobprev <= aliceprev:
				bobprev += q[-1]
				bobsum += q[-1]
				q.pop()
			moves += 1
	print(moves, alicesum, bobsum)


for case in range(int(input())):
	n = int(input())
	candies = list(map(int, input().split()))
	a = 0
	b = 0
	moves = 0
	prev = 0
	aturn = True
	while candies:
		if aturn:
			newprev = 0
			while newprev <= prev and candies:
				newprev += candies.pop(0)
			prev = newprev
			a += newprev
		else:
			newprev = 0
			while newprev <= prev and candies:
				newprev += candies.pop()
			prev = newprev
			b += newprev
		aturn = not aturn
		moves += 1
	print(moves, a, b)


t = int(input())
for tt in range(t):
	n = int(input())
	lis = input().split()
	for i in range(n):
		lis[i] = int(lis[i])
	moves = 0
	a = 0
	b = 0
	l = 0
	r = n - 1
	curr_a = 0
	curr_b = 0
	curr_move = 0
	while l <= r:
		if moves == 0:
			moves = 1
			a = lis[l]
			curr_a = lis[l]
			l = 1
			curr_move = 1 - curr_move
			continue
		if curr_move == 0:
			if curr_a <= curr_b:
				a += lis[l]
				curr_a += lis[l]
				l += 1
				if l > r:
					moves += 1
			else:
				moves += 1
				curr_b = 0
				curr_move = 1 - curr_move
		elif curr_b <= curr_a:
			b += lis[r]
			curr_b += lis[r]
			r -= 1
			if l > r:
				moves += 1
		else:
			moves += 1
			curr_a = 0
			curr_move = 1 - curr_move
	print(moves, a, b)


for i in range(int(input())):
	input()
	arr = list(map(int, input().split()))
	left = 0
	right = len(arr) - 1
	(a, b) = (0, 0)
	s = 0
	qu = 0
	eat = 0
	while eat != len(arr):
		now = -1
		qu += 1
		if a <= b:
			while now < s and eat != len(arr):
				now += arr[left]
				left += 1
				eat += 1
			a += now + 1
		else:
			while now < s and eat != len(arr):
				now += arr[right]
				right -= 1
				eat += 1
			b += now + 1
		s = now + 1
	print(qu, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(y) for y in input().split()]
	alice = 0
	bob = 0
	alice += a[0]
	a.pop(0)
	turn = 1
	prev_alice = alice
	prev_bob = 0
	ans = 1
	while a != []:
		if turn == 1:
			index = int(len(a)) - 1
			curr = 0
			while index >= 0 and curr <= prev_alice:
				curr += a[index]
				index -= 1
			del a[index + 1:int(len(a))]
			bob += curr
			prev_bob = curr
		else:
			index = 0
			curr = 0
			while index < int(len(a)) and curr <= prev_bob:
				curr += a[index]
				index += 1
			del a[0:index]
			alice += curr
			prev_alice = curr
		turn ^= 1
		ans += 1
	print(ans, alice, bob)


for t in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	al = 0
	bo = 0
	i = 0
	j = n - 1
	f = 0
	c = 0
	d = 0
	while i <= j:
		if f % 2 == 0:
			if c + a[i] > d:
				al += a[i]
				c = c + a[i]
				i += 1
				f += 1
				d = 0
			else:
				al += a[i]
				c += a[i]
				i += 1
				if i > j:
					f += 1
		elif d + a[j] > c:
			bo += a[j]
			d += a[j]
			j -= 1
			f += 1
			c = 0
		else:
			bo += a[j]
			d += a[j]
			j -= 1
			if j < i:
				f += 1
	print(f, al, bo)


test = int(input())
for i in range(test):
	n = int(input())
	arr = [int(i) for i in input().split()]
	i = -1
	j = n
	rem = n
	alice = 0
	bob = 0
	prev = 0
	flag = 1
	cnt = 0
	while rem > 0 and j != i:
		gain = 0
		if flag:
			while gain <= prev and rem > 0 and (i != j):
				i += 1
				gain += arr[i]
				rem -= 1
			flag = 0
			alice += gain
			prev = gain
		else:
			while gain <= prev and rem > 0 and (j != i):
				j -= 1
				gain += arr[j]
				rem -= 1
			flag = 1
			bob += gain
			prev = gain
		cnt += 1
	print(cnt, alice, bob, sep=' ')


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	i = 0
	a = 0
	c = 0
	m = 0
	while i < len(L) or len(L) != 0:
		m = m + 1
		if m % 2 != 0:
			p = 0
			if m == 1:
				p = L[i]
				del L[i]
			elif L[i] > q:
				p = L[i]
				del L[i]
			else:
				while p <= q and len(L) != 0:
					p = p + L[i]
					del L[i]
			a = a + p
		else:
			q = 0
			if L[len(L) - 1] > p:
				q = q + L[len(L) - 1]
				del L[len(L) - 1]
			else:
				while q <= p and len(L) != 0:
					q = q + L[len(L) - 1]
					del L[len(L) - 1]
			c = c + q
	print(m, a, c)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 1
	l = a[0]
	c1 = 1
	r = 0
	c2 = 0
	flag = 1
	x = 0
	z = a[0]
	for i in range(n):
		if c1 + c2 == n:
			flag = 3
			break
		count += 1
		if flag == 1:
			while r <= l:
				if c1 + c2 == n:
					flag = 3
					break
				r += a[n - c2 - 1]
				x += a[n - c2 - 1]
				c2 += 1
			flag = 0
			l = 0
		elif flag == 0:
			while l <= r:
				if c1 + c2 == n:
					flag = 3
					break
				l += a[c1]
				z += a[c1]
				c1 += 1
			flag = 1
			r = 0
		if flag == 3:
			break
	print(count, z, x)


t = int(input())
candies = []
for i in range(t):
	n = int(input())
	rounds = []
	rounds = [int(k) for k in input().split()]
	candies.append(rounds)
turns = 0
for i in range(0, t):
	p = True
	a = 0
	b = 0
	aa = bb = 0
	aaa = bbb = 0
	turns = 0
	while len(candies[i]) != 0:
		if p == True:
			while aa <= bb and len(candies[i]) != 0:
				step = candies[i].pop(0)
				aa = aa + step
				aaa = step
				a += aaa
			bb = 0
			p = not p
		else:
			while bb <= aa and len(candies[i]) != 0:
				step = candies[i].pop(-1)
				bb += step
				bbb = step
				b += bbb
			aa = 0
			p = not p
		turns += 1
	print(turns, a, b)


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]

def solve(arr: list) -> tuple:
	i = 1
	j = len(arr) - 1
	alica = False
	curr_alica = arr[0]
	curr_bob = 0
	total = 1
	total_alica = curr_alica
	total_bob = 0
	while j >= i:
		if alica:
			while curr_alica <= curr_bob and j >= i:
				curr_alica += arr[i]
				total_alica += arr[i]
				i += 1
			curr_bob = 0
		else:
			while curr_bob <= curr_alica and j >= i:
				curr_bob += arr[j]
				total_bob += arr[j]
				j -= 1
			curr_alica = 0
		total += 1
		alica = not alica
	return (total, total_alica, total_bob)
T = int(input())
for test in range(T):
	(n,) = read_ints()
	arr = read_ints()
	(a, b, c) = solve(arr)
	print(f'{a} {b} {c}')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	move = 1
	alice = a[0]
	bob = 0
	s = sum(a)
	a.remove(a[0])
	chance = False
	last = alice
	while s != alice + bob:
		temp = 0
		if chance:
			for i in range(len(a)):
				alice += a[0]
				temp += a[0]
				a.remove(a[0])
				if temp > last:
					last = temp
					break
			chance = False
		else:
			for i in range(len(a)):
				a = a[::-1]
				bob += a[0]
				temp += a[0]
				a.remove(a[0])
				a = a[::-1]
				if temp > last:
					last = temp
					break
			chance = True
		move += 1
	print(move, alice, bob)


input_count = int(input())
cases = []
result = []
for i in range(input_count):
	nvm = input()
	candies = input().split()
	cases.append(candies)
for case in cases:
	alice_prev = int(case[0])
	alice_total = alice_prev
	bob_prev = 0
	bob_total = 0
	a_idx = 1
	b_idx = len(case) - 1
	moves = 1
	while a_idx <= b_idx:
		moves += 1
		if bob_total < alice_total:
			while bob_prev <= alice_prev and b_idx >= a_idx:
				bob_prev += int(case[b_idx])
				b_idx -= 1
			bob_total += bob_prev
			alice_prev = 0
		else:
			while alice_prev <= bob_prev and b_idx >= a_idx:
				alice_prev += int(case[a_idx])
				a_idx += 1
			alice_total += alice_prev
			bob_prev = 0
	result.append((moves, alice_total, bob_total))
for res in result:
	print(res[0], res[1], res[2])


for _ in range(int(input())):
	n = input()
	n = int(n)
	li = list(map(int, input().split()))
	a = 0
	b = 0
	c = 0
	i = 0
	j = n - 1
	pa = 0
	pb = 0
	while i <= j:
		if c == 0:
			pa = li[0]
			i += 1
			c += 1
		else:
			pa = 0
			while pa <= pb and i <= j:
				pa += li[i]
				i += 1
			c += 1
		a += pa
		pb = 0
		while pb <= pa and i <= j:
			pb += li[j]
			j -= 1
		if pb != 0:
			c += 1
		b += pb
	print(c, a, b)


T = int(input())
for t in range(T):
	a_total = b_total = 0
	a = b = 0
	move = 0
	n = int(input())
	A = list(map(int, input().split()))
	cnt = 0
	while len(A) > 0:
		a = 0
		while cnt < n and a <= b:
			a += A.pop(0)
			cnt += 1
		if a > 0:
			a_total += a
			move += 1
		b = 0
		while cnt < n and b <= a:
			b += A.pop(-1)
			cnt += 1
		if b > 0:
			b_total += b
			move += 1
	print('%d %d %d' % (move, a_total, b_total))


from collections import deque
for i in range(int(input())):
	n = int(input())
	a = deque(map(int, input().split()))
	count = 0
	A = 0
	B = 0
	pA = a.popleft()
	A += pA
	count += 1
	while a:
		pB = 0
		while pA >= pB and a:
			pB += a.pop()
		else:
			count += 1
			B += pB
		pA = 0
		while pB >= pA and a:
			pA += a.popleft()
		else:
			count += 1
			A += pA
	if pA == 0:
		count -= 1
	print(count, A, B)


for _ in range(int(input())):
	(l, r) = (0, int(input()) - 1)
	sweets = list(map(int, input().split()))
	lsum = rsum = lcur = rcur = hod = 0
	while l <= r:
		hod += 1
		if hod % 2:
			lcur = 0
			while l <= r and lcur <= rcur:
				lcur += sweets[l]
				l += 1
			lsum += lcur
		else:
			rcur = 0
			while l <= r and rcur <= lcur:
				rcur += sweets[r]
				r -= 1
			rsum += rcur
	print(hod, lsum, rsum)


def countmoves(arr, n):
	i = 0
	j = n - 1
	a = arr[i]
	b = 0
	base = arr[0]
	i += 1
	turn = 1
	move = 1
	while i <= j:
		if turn == 1:
			tmp = 0
			while tmp <= base and j >= i:
				tmp += arr[j]
				j -= 1
			base = tmp
			b += tmp
			turn = 0
		else:
			tmp = 0
			while tmp <= base and i <= j:
				tmp += arr[i]
				i += 1
			base = tmp
			a += tmp
			turn = 1
		move += 1
	out = [move, a, b]
	return out
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	out = countmoves(arr, n)
	print(*out)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	sweets = deque(map(int, input().split()))
	rounds = 1
	result = sweets.popleft()
	a = result
	b = 0
	while sweets:
		result2 = 0
		while sweets and result2 <= result:
			result2 += sweets.pop()
		if result2 > 0:
			rounds += 1
		b += result2
		result = 0
		while sweets and result <= result2:
			result += sweets.popleft()
		if result > 0:
			rounds += 1
		a += result
	print(rounds, a, b)


from builtins import int
till = 0
till = input()
for i in range(int(till)):
	x = input()
	candy = [int(num) for num in input().split()]
	Bob_total = 0
	Alice = candy[0]
	Alice_total = candy[0]
	candy.pop(0)
	step = 1
	Bob = 0
	Bob_active = 0
	go = 0
	while len(candy):
		if go == 0:
			while Bob <= Alice and len(candy):
				Bob += candy[len(candy) - 1]
				candy.pop()
			Bob_total += Bob
			Alice = 0
			go = 1
			step += 1
		else:
			while Bob >= Alice and len(candy):
				Alice += candy[0]
				candy.pop(0)
			Alice_total += Alice
			Bob = 0
			go = 0
			step += 1
	print(str(step) + ' ' + str(Alice_total) + ' ' + str(Bob_total))


tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	(moves, alice, bob) = (0, [0], [0])
	no = 0
	while no == 0:
		now = 0
		while arr and now <= bob[-1]:
			now += arr.pop(0)
		if now > bob[-1]:
			alice.append(now)
			moves += 1
		else:
			alice.append(now)
			if now != 0:
				moves += 1
			no = 1
			break
		now = 0
		while arr and now <= alice[-1]:
			now += arr.pop(-1)
		if now > alice[-1]:
			bob.append(now)
			moves += 1
		else:
			bob.append(now)
			if now != 0:
				moves += 1
			no = 1
			break
	print(' '.join([str(moves), str(sum(alice)), str(sum(bob))]))


from sys import stdout, stdin
import io
import os
from collections import deque
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	n = int(input())
	a = deque(map(int, input().split()))
	b = c = m = tempb = tempc = 0
	while a:
		tempb = 0
		while tempb <= tempc:
			b += a[0]
			tempb += a[0]
			a.popleft()
			if len(a) == 0:
				break
		m += 1
		if len(a) == 0:
			break
		tempc = 0
		while tempc <= tempb:
			c += a[-1]
			tempc += a[-1]
			a.pop()
			if len(a) == 0:
				break
		m += 1
	print(m, b, c)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	left = 0
	right = n - 1
	csum = 0
	psum = 0
	ans = []
	while left <= right:
		while csum <= psum and left <= right:
			csum += l[left]
			left = left + 1
		ans.append(csum)
		psum = csum
		csum = 0
		while csum <= psum and left <= right:
			csum += l[right]
			right = right - 1
		ans.append(csum)
		psum = csum
		csum = 0
	i = 0
	tem = 0
	while i < len(ans):
		tem += ans[i]
		i = i + 2
	m = len(ans)
	if ans[m - 1] == 0:
		m = m - 1
	print(m, tem, sum(ans) - tem)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	a = [0]
	b = [0]
	mo = 0
	while j >= i:
		su1 = 0
		while j >= i and su1 <= b[-1]:
			su1 += l[i]
			i += 1
		mo += 1
		a.append(su1)
		su2 = 0
		if j >= i:
			mo += 1
		while j >= i and su2 <= a[-1]:
			su2 += l[j]
			j -= 1
		b.append(su2)
	print('{} {} {}'.format(mo, sum(a), sum(b)))


for _ in range(int(input())):
	n = int(input())
	c = list(map(int, input().split()))
	a = 1
	sa = c[0]
	b = n - 1
	sb = 0
	last = c[0]
	turn = False
	move = 1
	while a <= b:
		move += 1
		if turn:
			cur = 0
			while a <= b and cur <= last:
				sa += c[a]
				cur += c[a]
				a += 1
		else:
			cur = 0
			while a <= b and cur <= last:
				sb += c[b]
				cur += c[b]
				b -= 1
		last = cur
		turn = not turn
	print(move, sa, sb)


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().strip().split()))[:n]
	a = 0
	b = 0
	s = 0
	r = 0
	count = 0
	c = 0
	for i in range(len(l)):
		if l == []:
			break
		elif c == 0:
			r = 0
			if a == 0:
				a += l.pop(0)
				r = a
			else:
				while r <= s and l != []:
					r += l.pop(0)
				a += r
			count += 1
			c = 1
		elif c == 1:
			s = 0
			while s <= r and l != []:
				s += l.pop()
			b += s
			c = 0
			count += 1
	print(count, a, b)
	t -= 1


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
entries = inp()
for i in range(entries):
	tmp = inp()
	l = inlt()
	a = 0
	b = 0
	prev = 0
	turn = 0
	moves = 0
	while len(l) != 0:
		moves += 1
		t = 0
		if turn == 0:
			while t <= prev and len(l) != 0:
				t += l[0]
				a += l[0]
				l.pop(0)
			prev = t
			turn = 1
		else:
			while t <= prev and len(l) != 0:
				t += l[-1]
				b += l[-1]
				l.pop(-1)
			prev = t
			turn = 0
	res = str(moves) + ' ' + str(a) + ' ' + str(b)
	print(res)


t = int(input())
while t > 0:
	n = int(input())
	lis = list(map(int, input().split()))
	bcount = 0
	acount = 0
	moves = 0
	l = 0
	asum = 0
	bsum = 0
	r = n - 1
	count = 0
	while l <= r:
		if count == 0:
			moves += 1
			asum = lis[l]
			l += 1
			while asum <= bsum and l <= r:
				asum += lis[l]
				l += 1
			acount += asum
			count = 1
		else:
			count = 0
			moves += 1
			bsum = lis[r]
			r -= 1
			while bsum <= asum and l <= r:
				bsum += lis[r]
				r -= 1
			bcount += bsum
			count = 0
	print(moves, ' ', acount, ' ', bcount)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	bobPrev = 0
	alicePrev = 0
	bobTotal = 0
	aliceTotal = 0
	moves = 0
	while len(arr) != 0:
		candiesConsume = 0
		if moves % 2 == 0:
			while candiesConsume <= bobPrev and len(arr) != 0:
				candiesConsume += arr[0]
				arr.pop(0)
			aliceTotal += candiesConsume
			alicePrev = candiesConsume
		else:
			while candiesConsume <= alicePrev and len(arr) != 0:
				candiesConsume += arr[-1]
				arr.pop()
			bobTotal += candiesConsume
			bobPrev = candiesConsume
		moves += 1
	print(moves, aliceTotal, bobTotal)


for _ in range(int(input())):
	N = int(input())
	List = [int(x) for x in input().split()]
	alice = 0
	bob = N - 1
	moves = 0
	Talice = 0
	Tbob = 0
	chance = 0
	Prev = 0
	while bob >= alice:
		temp = 0
		if chance == 0:
			while temp <= Prev:
				temp += List[alice]
				alice += 1
				if alice > bob:
					break
			Talice += temp
			Prev = temp
			chance = 1 - chance
		else:
			while temp <= Prev:
				temp += List[bob]
				bob -= 1
				if alice > bob:
					break
			Tbob += temp
			Prev = temp
			chance = 1 - chance
		moves += 1
	print(moves, Talice, Tbob)


from math import *
from math import factorial as fact, comb as ncr
from bisect import bisect_left as bl
from bisect import bisect_right as br
from collections import Counter as ctr
from collections import deque as dq
from array import array
from re import search
li = lambda : list(map(int, input().split()))
arr = lambda a: array('i', a)
bi = lambda n: bin(n).replace('0b', '')
yn = lambda f: print('NYOE S'[f::2])
sbstr = lambda a, s: search('.*'.join(a), s)

def solve():
	for _ in range(int(input())):
		n = int(input())
		a = li()
		c = 0
		al = bob = 0
		i = 0
		j = n - 1
		ta = 0
		while j >= i:
			c += 1
			if c % 2:
				al = 0
				while bob >= al and i <= j:
					al += a[i]
					i += 1
				ta += al
			else:
				bob = 0
				while al >= bob and i <= j:
					bob += a[j]
					j -= 1
		print(c, ta, sum(a) - ta)
solve()


from collections import deque
import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = deque(list(map(int, input().split())))
	atleast = 0
	turn = True
	done = False
	a_f = 0
	b_f = 0
	c = 0
	while len(a):
		c += 1
		if turn:
			f = a[0]
			a.popleft()
			while f <= atleast and len(a):
				f += a[0]
				a.popleft()
			if f > atleast:
				atleast = f
			else:
				done = True
			a_f += f
		else:
			f = a[-1]
			a.pop()
			while f <= atleast and len(a):
				f += a[-1]
				a.pop()
			if f > atleast:
				atleast = f
			else:
				done = True
			b_f += f
		if done:
			break
		turn = not turn
	print(c, a_f, b_f)


t = int(input())
for _ in range(t):
	n = int(input())
	candies = list(map(int, input().split()))
	alice = candies[0]
	totalalice = candies[0]
	candies.pop(0)
	bob = 0
	totalbob = 0
	moves = 1
	while len(candies) > 0:
		bob = 0
		while bob <= alice:
			if len(candies) == 0:
				break
			bob += candies[-1]
			totalbob += candies[-1]
			candies.pop()
		moves += 1
		if len(candies) == 0:
			break
		alice = 0
		while alice <= bob:
			if len(candies) == 0:
				break
			alice += candies[0]
			totalalice += candies[0]
			candies.pop(0)
		moves += 1
	print(moves, totalalice, totalbob)


from collections import deque
from typing import Deque
import sys

def game(deq: Deque):
	alice_sum = 0
	alice_last = 0
	bob_last = 0
	bob_sum = 0
	turn = True
	count = 0
	while deq:
		if turn:
			alice = 0
			while deq and alice <= bob_last:
				alice += int(deq.popleft())
			alice_last = alice
			alice_sum += alice
			turn = False
		else:
			bob = 0
			while deq and bob <= alice_last:
				bob += int(deq.pop())
			bob_last = bob
			bob_sum += bob
			turn = True
		count += 1
	return (count, alice_sum, bob_sum)
data = [line.strip() for line in sys.stdin]
i = 1
for line in data[1:]:
	if i % 2 != 0:
		i += 1
		continue
	print(*game(deque(line.split())))
	i += 1


t = int(input())
for i in range(t):
	l = int(input())
	c = [int(x) for x in input().split()]
	aTurn = True
	(prev, a, b, m) = (0, 0, 0, 0)
	while len(c) != 0:
		total = 0
		try:
			while total <= prev:
				total += c[0]
				c.remove(c[0])
		except:
			pass
		if aTurn:
			a += total
			aTurn = False
		else:
			b += total
			aTurn = True
		m += 1
		prev = total
		c.reverse()
	print(m, a, b)


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)


s = []
for jjk in range(int(input())):
	n = int(input())
	q = list(map(int, input().split()))
	a = 0
	b = 0
	g = 0
	fa = 0
	fb = 0
	j = 0
	while len(q) != 0:
		if j % 2 == 0:
			while fa <= fb and len(q) != 0:
				fa += q[0]
				a += q[0]
				del q[0]
			g += 1
		else:
			while fa >= fb and len(q) != 0:
				fb += q[-1]
				b += q[-1]
				del q[-1]
			g += 1
		if j % 2 == 0:
			fb = 0
		else:
			fa = 0
		j += 1
	s.append([g, a, b])
for i in s:
	for j in i:
		print(j, end=' ')
	print()


t = int(input())
for a in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	A = B = 0
	ctr = 0
	a = b = 0
	for i in range(n):
		try:
			while a <= b:
				a += l[0]
				A += l[0]
				l.pop(0)
			ctr += 1
			b = 0
			while b <= a:
				b += l[len(l) - 1]
				B += l[len(l) - 1]
				l.pop(len(l) - 1)
			ctr += 1
			a = 0
		except:
			if b > 0 and b <= a or (a > 0 and a <= b):
				ctr += 1
			print(ctr, A, B)
			break


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
t = INT()
while t != 0:
	n = INT()
	a = LIST()
	l = 1
	r = n - 1
	A = a[0]
	prev = A
	curr = 0
	B = 0
	moves = 0
	while l <= r:
		while curr <= prev and l <= r:
			curr += a[r]
			B += a[r]
			r -= 1
		moves += 1
		prev = curr
		curr = 0
		if l > r:
			break
		while curr <= prev and l <= r:
			curr += a[l]
			A += a[l]
			l += 1
		prev = curr
		curr = 0
		moves += 1
	print(moves + 1, A, B)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	s = 0
	c = 0
	m = 0
	nb = 0
	na = 0
	j = n - 1
	r = 0
	while i < n and j > -1 and (i <= j):
		if r == 0:
			if c > s:
				na += c
				s = c
				c = 0
				m += 1
				r += 1
			else:
				c += a[i]
				i += 1
		if r == 1:
			if c > s:
				nb += c
				s = c
				c = 0
				m += 1
				r = 0
			else:
				c += a[j]
				j -= 1
	if r == 0:
		na += c
		m += 1
	else:
		nb += c
		m += 1
	print(m, na, nb)


from collections import deque
from sys import stdin, stdout
for case in range(int(stdin.readline())):
	n = int(stdin.readline())
	candies = deque([int(x) for x in stdin.readline().split()])
	a = 0
	b = 0
	aTurn = True
	moves = 0
	lastSum = 0
	while candies:
		moves += 1
		x = 0
		if aTurn:
			while x <= lastSum and candies:
				x += candies.popleft()
			a += x
		else:
			while x <= lastSum and candies:
				x += candies.pop()
			b += x
		lastSum = x
		aTurn = not aTurn
	print(moves, a, b)


import os
import sys
from io import BytesIO, IOBase

def readvars():
	k = map(int, input().split())
	return k

def readlist():
	li = list(map(int, input().split()))
	return li

def anslist(li):
	ans = ' '.join([str(v) for v in li])
	return ans

def main():
	t = 1
	t = int(input())
	for xx in range(t):
		n = int(input())
		aa = list(map(int, input().split()))
		pi = 0
		pj = n - 1
		mov = 0
		cpr = bpr = a = b = 0
		while pi - pj < 1:
			mov += 1
			if mov % 2 == 1:
				ceat = 0
				while ceat <= bpr and pi - pj < 1:
					ceat += aa[pi]
					pi += 1
				cpr = ceat
				a += ceat
			if mov % 2 == 0:
				beat = 0
				while beat <= cpr and pi - pj < 1:
					beat += aa[pj]
					pj -= 1
				bpr = beat
				b += beat
		if n == 1:
			a = aa[0]
			b = 0
			mov = 1
		print(mov, a, b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	left = 1
	right = len(arr) - 1
	moves = 0
	cur = arr[0]
	flag = 1
	count = 1
	val1 = 0
	val2 = 0
	while left <= right:
		if flag == 1:
			sum1 = 0
			while sum1 <= cur and left <= right:
				sum1 += arr[right]
				right -= 1
			flag = 0
			cur = sum1
			val1 += sum1
			count += 1
			moves += 1
		else:
			sum1 = 0
			while sum1 <= cur and left <= right:
				sum1 += arr[left]
				left += 1
			flag = 1
			cur = sum1
			val2 += sum1
			count += 1
			moves += 1
	print(moves + 1, val2 + arr[0], val1)
	t -= 1


def r(t=int):
	return list(map(t, input().split()))

def ri(t=int):
	return t(input())

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for _ in range(ri()):
	n = ri()
	a = r()
	c = [0, 0]
	ci = [0, 0]
	p = [-1, n]
	steps = 1
	taken = False
	h = 0
	while p[0] < p[1] - 1:
		taken = True
		if h == 0:
			p[h] += 1
		else:
			p[h] -= 1
		c[h] += a[p[h]]
		ci[h] += a[p[h]]
		if ci[0] > ci[1]:
			if h == 0:
				h = 1
				steps += 1
				ci[1] = 0
				taken = False
		elif ci[0] < ci[1]:
			if h == 1:
				h = 0
				steps += 1
				ci[0] = 0
				taken = False
	if not taken:
		steps -= 1
	print(steps, c[0], c[1])


q = int(input())
for _ in range(q):
	n = int(input())
	l = [int(x) for x in input().split()]
	a = l[0]
	b = 0
	prev = a
	present = 0
	ch = 'b'
	st = 1
	end = len(l) - 1
	mov = 1
	if len(l) == 2:
		print(2, l[0], l[1])
		continue
	while st <= end and st != len(l) - 1:
		mov += 1
		present = 0
		if ch == 'b':
			while present <= prev and end >= st:
				present += l[end]
				end -= 1
			prev = present
			b += present
			ch = 'a'
		else:
			while present <= prev and st <= end:
				present += l[st]
				st += 1
			prev = present
			a += present
			ch = 'b'
	print(mov, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	start = 0
	end = n - 1
	chance = 0
	a = 0
	b = 0
	prevb = 0
	preva = 0
	moves = 0
	while start <= end:
		if chance == 0:
			cur = 0
			while cur <= prevb and start <= end:
				a += arr[start]
				cur += arr[start]
				start += 1
			preva = cur
			chance = (chance + 1) % 2
			moves += 1
		else:
			cur = 0
			while cur <= preva and start <= end:
				b += arr[end]
				cur += arr[end]
				end -= 1
			prevb = cur
			chance = (chance + 1) % 2
			moves += 1
	print(moves, a, b)


def main():
	t = int(input())
	for i in range(t):
		solve()

def solve():
	n = int(input())
	sweets = list(map(int, input().split(' ')))
	alice_sweets = 0
	bob_sweets = 0
	turns = 0
	prev_turn = 0
	current = 0
	while len(sweets) > 0:
		if turns == 0:
			alice_sweets += sweets.pop(0)
			prev_turn = alice_sweets
			turns += 1
		if len(sweets) == 0:
			print(turns, alice_sweets, bob_sweets)
			break
		while len(sweets) > 0 and current <= prev_turn:
			sweet = sweets.pop(len(sweets) - 1)
			bob_sweets += sweet
			current += sweet
		prev_turn = current
		current = 0
		turns += 1
		if len(sweets) == 0:
			print(turns, alice_sweets, bob_sweets)
			break
		while len(sweets) > 0 and current <= prev_turn:
			sweet = sweets.pop(0)
			alice_sweets += sweet
			current += sweet
		prev_turn = current
		current = 0
		turns += 1
		if len(sweets) == 0:
			print(turns, alice_sweets, bob_sweets)
			break
main()


t = int(input())
l = []
for i in range(t):
	n = int(input())
	v = list(map(int, input().split()))
	a = 0
	b = 0
	h = 0
	r = 1
	sa = 0
	sb = 0
	k = 0
	j = -1
	while n > 0:
		if r == 1:
			sa = 0
			while sa <= sb:
				sa += v[k]
				a += v[k]
				k += 1
				n -= 1
				if n == 0:
					break
		else:
			sb = 0
			while sb <= sa:
				sb += v[j]
				b += v[j]
				j -= 1
				n -= 1
				if n == 0:
					break
		r *= -1
		h += 1
	l.append([h, a, b])
for i in l:
	print(*i)


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	alice = 0
	bob = 0
	(ac, bc) = (a[0], 0)
	alice += ac
	a.pop(0)
	flag = 1
	moves = 1
	while len(a) != 0:
		moves += 1
		if flag == 1:
			flag = 0
			prev_ac = ac
			bc = 0
			while bc <= prev_ac and len(a) != 0:
				bc += a[len(a) - 1]
				a.pop(len(a) - 1)
			bob += bc
		else:
			flag = 1
			prev_bc = bc
			ac = 0
			while ac <= prev_bc and len(a) != 0:
				ac += a[0]
				a.pop(0)
			alice += ac
	print(moves, alice, bob)


def list_int():
	return list(map(int, input().split()))

def int_in():
	return int(input())

def map_in():
	return map(int, input().split())

def list_in():
	return input().split()
t = int_in()
for _ in range(t):
	n = int_in()
	a = list_int()
	turns = 1
	ai = 0
	a1 = 0
	bi = len(a)
	b1 = len(a)
	As = a[0]
	At = As
	bt = 0
	while ai < bi - 1:
		b1 = bi
		bi -= 1
		b = a[bi]
		while bi > ai + 1 and b <= As:
			b += a[bi - 1]
			bi -= 1
		bt += b
		turns += 1
		if bi != ai + 1:
			a1 = ai
			ai += 1
			As = a[ai]
			while bi != ai + 1 and As <= b:
				As += a[ai + 1]
				ai += 1
			turns += 1
			At += As
	print(turns, At, bt)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	al = -1
	bo = n
	pred_al = 0
	pred_bo = 0
	sum_al = 0
	sum_bo = 0
	turn = 0
	if n == 1:
		print(1, a[0], 0)
		continue
	while bo - al > 1:
		if turn == 0:
			al = 0
			pred_al = a[0]
			sum_al += a[0]
			turn += 1
			continue
		if turn % 2 == 1:
			summ = 0
			while summ <= pred_al and bo - al > 1:
				bo -= 1
				summ += a[bo]
			pred_bo = summ
			sum_bo += pred_bo
			turn += 1
			continue
		else:
			summ = 0
			while summ <= pred_bo and bo - al > 1:
				al += 1
				summ += a[al]
			pred_al = summ
			sum_al += pred_al
			turn += 1
			continue
	print(turn, sum_al, sum_bo)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		candies = list(map(int, input().split()))
		(s, e) = (0, n - 1)
		alice = 0
		aeaten = 0
		bob = 0
		beaten = 0
		roundkap = 0
		temp = 0
		while s <= e:
			if s == e:
				if roundkap % 2 == 0:
					temp += candies[s]
					alice += temp
					roundkap += 1
					break
				else:
					temp += candies[e]
					bob += temp
					roundkap += 1
					break
			elif roundkap % 2 == 0:
				if temp == 0:
					temp = candies[s]
				else:
					temp += candies[s]
				if temp > beaten:
					roundkap += 1
					aeaten = temp
					temp = 0
					alice += aeaten
				s += 1
			else:
				if temp == 0:
					temp = candies[e]
				else:
					temp += candies[e]
				if temp > aeaten:
					roundkap += 1
					beaten = temp
					temp = 0
					bob += beaten
				e -= 1
		yield (str(roundkap) + ' ' + str(alice) + ' ' + str(bob))
t = int(input())
ans = gift()
print(*ans, sep='\n')


t = int(input())
for _ in range(t):
	number_of_candies = int(input())
	candies = list(map(int, input().split()))
	(l, r) = (0, len(candies) - 1)
	(prev_alice, prev_bob) = (0, 0)
	(cur_alice, cur_bob) = (0, 0)
	(total_alice, total_bob) = (0, 0)
	num_of_moves = 0
	total_candies = sum(candies)
	while total_alice + total_bob < total_candies:
		(alice_ate, bob_ate) = (False, False)
		(cur_alice, cur_bob) = (0, 0)
		while cur_alice <= prev_bob and l <= r:
			alice_ate = True
			cur_alice += candies[l]
			total_alice += candies[l]
			l += 1
			prev_alice = cur_alice
		while cur_bob <= prev_alice and l <= r:
			bob_ate = True
			total_bob += candies[r]
			cur_bob += candies[r]
			r -= 1
			prev_bob = cur_bob
		if alice_ate and bob_ate:
			num_of_moves += 2
		else:
			num_of_moves += 1
	print(*[num_of_moves, total_alice, total_bob])


import sys
t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	i = 0
	j = len(A) - 1
	a_tot = 0
	b_tot = 0
	move = 0
	alice = 0
	bob = 0
	while i <= j:
		move += 1
		alice = 0
		while i <= j and alice <= bob:
			alice += A[i]
			i += 1
		if i <= j:
			move += 1
		bob = 0
		while i <= j and alice >= bob:
			bob += A[j]
			j -= 1
		a_tot += alice
		b_tot += bob
	print(move, a_tot, b_tot)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = n - 1
	s_1 = 0
	s_2 = 0
	s1 = 0
	s2 = 0
	c = 0
	x = False
	y = False
	while a <= b:
		while s1 <= s2 and a <= b:
			s1 += l[a]
			s_1 += l[a]
			a += 1
			x = True
		s2 = 0
		while s2 <= s1 and a <= b:
			s2 += l[b]
			s_2 += l[b]
			b -= 1
			y = True
		s1 = 0
		if x:
			c += 1
		if y:
			c += 1
		x = False
		y = False
	print(c, s_1, s_2)


import heapq
from collections import *
import math

def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	(a1, a2) = (a.pop(0), 0)
	(t1, t2) = (a1, a2)
	c = 1
	while len(a) != 0:
		k2 = 0
		if k2 < t1 + 1:
			while k2 < t1 + 1 and len(a) != 0:
				l = a.pop()
				a2 += l
				k2 += l
			if k2 != 0:
				c += 1
			t2 = k2
		k1 = 0
		if k1 < t2 + 1:
			while k1 < t2 + 1 and len(a) != 0:
				l = a.pop(0)
				a1 += l
				k1 += l
			if k1 != 0:
				c += 1
			t1 = k1
	print(c, a1, a2)
t = int(input())
for _ in range(t):
	solve()


def solution(x):
	(idxL, idxR) = (0, len(x) - 1)
	(ansA, ansB, last) = (0, 0, 0)
	moves = 0
	while idxL <= idxR:
		tmp = 0
		moves += 1
		while tmp <= last and idxL <= idxR:
			tmp += x[idxL]
			idxL += 1
		ansA += tmp
		last = tmp
		tmp = 0
		if idxL <= idxR:
			moves += 1
		while tmp <= last and idxL <= idxR:
			tmp += x[idxR]
			idxR -= 1
		ansB += tmp
		last = tmp
	return (moves, ansA, ansB)
N = int(input())
for _ in range(N):
	sz = int(input())
	x = list(map(int, input().split()))
	print(*solution(x))


t = int(input())
while t:
	t += -1
	n = int(input())
	l = list(map(int, input().split()))
	(a, b) = (0, 0)
	ans = 0
	(p1, p2) = (0, n - 1)
	(tmp3, tmp4) = (0, 0)
	ch = 0
	while 1:
		tmp1 = 0
		tmp2 = 0
		while tmp1 <= tmp3:
			if p1 == p2:
				a += l[p1]
				ch = 1
				break
			tmp1 += l[p1]
			a += l[p1]
			p1 -= -1
		ans -= -1
		tmp4 = tmp1
		if p1 == p2:
			if ch:
				break
			else:
				ans -= -1
				b += l[p1]
				break
		while tmp2 <= tmp4:
			if p1 == p2:
				b += l[p2]
				ch = 1
				break
			tmp2 += l[p2]
			b += l[p2]
			p2 += -1
		ans -= -1
		tmp3 = tmp2
		if p1 == p2:
			if ch:
				break
			else:
				ans -= -1
				a += l[p1]
				break
	print(ans, a, b)


import sys

def solve(n, arr):
	(l, r) = (0, n - 1)
	sumr = suml = moves = ansr = ansl = 0
	while l <= r:
		if moves % 2 == 0:
			nsuml = 0
			while nsuml <= sumr:
				nsuml += arr[l]
				l += 1
				if l > r:
					break
			suml = nsuml
			ansl += suml
			moves += 1
		else:
			nsumr = 0
			while nsumr <= suml:
				nsumr += arr[r]
				r -= 1
				if r < l:
					break
			sumr = nsumr
			ansr += sumr
			moves += 1
	return [moves, ansl, ansr]
number_loops = int(input())
for _ in range(number_loops):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*solve(n, arr))


def alice(a, prev_candy):
	sum = 0
	while len(a) > 0:
		sum += a[0]
		a.pop(0)
		if sum > prev_candy:
			break
	return sum

def bob(a, prev_candy):
	sum = 0
	while len(a) > 0:
		sum += a[-1]
		a.pop()
		if sum > prev_candy:
			break
	return sum

def solve(a, n):
	(moves, count) = (0, 1)
	prev_candy = 0
	(alice_counter, bob_counter) = (0, 0)
	while len(a) > 0:
		if count % 2 == 1:
			prev_candy = alice(a, prev_candy)
			alice_counter += prev_candy
		else:
			prev_candy = bob(a, prev_candy)
			bob_counter += prev_candy
		moves += 1
		count += 1
	print(moves, alice_counter, bob_counter)
t = 1
t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	solve(a, n)
	t -= 1


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	(a, b) = (arr[0], 0)
	(i, j) = (1, n - 1)
	(sa, sb) = (arr[0], 0)
	count = 1
	while i <= j:
		if count % 2 != 0:
			while sb <= sa and j >= i:
				sb += arr[j]
				j -= 1
			b += sb
			sa = 0
		else:
			while sa <= sb and i <= j:
				sa += arr[i]
				i += 1
			a += sa
			sb = 0
		count += 1
	print(count, a, b)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = l[0]
	b = 0
	c = 1
	s = 0
	e = n
	cur_a = a
	while n - 1 > 0:
		if c % 2 == 0:
			cur_a = 0
			while cur_a <= cur_b and s + 1 != e:
				s += 1
				cur_a = cur_a + l[s]
				n -= 1
			a = a + cur_a
			c += 1
		else:
			cur_b = 0
			while cur_b <= cur_a and s + 1 != e:
				e -= 1
				cur_b = cur_b + l[e]
				n -= 1
			b = b + cur_b
			c += 1
	print(c, a, b)


testcase = int(input())
for _ in range(testcase):
	n = int(input())
	a = input().split()
	a = [int(i) for i in a]
	(moves, bSum, aSum, req, i, j, left) = (0, 0, 0, 0, 0, len(a) - 1, True)
	while i <= j:
		moves += 1
		if left:
			c = a[i]
			while c < req and i != j:
				i += 1
				c += a[i]
			aSum += c
			req = c + 1
			i += 1
			left = False
		else:
			c = a[j]
			while c < req and j != i:
				j -= 1
				c += a[j]
			bSum += c
			req = c + 1
			j -= 1
			left = True
	print(moves, aSum, bSum)


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = l[0]
	b = 0
	moves = 1
	bob = 0
	alice = l[0]
	l.pop(0)
	turn = 1
	while len(l) > 0:
		if turn % 2 == 0:
			if sum(l) > bob:
				alice = 0
				while alice <= bob:
					temp = l.pop(0)
					alice += temp
					a += temp
			else:
				a += sum(l)
				l = []
		elif sum(l) > alice:
			bob = 0
			while bob <= alice:
				temp = l.pop(-1)
				bob += temp
				b += temp
		else:
			b += sum(l)
			l = []
		turn += 1
		moves += 1
	print(moves, a, b)


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = get_array()
	i = 0
	j = n - 1
	(p, q) = (0, 0)
	(p_sum, q_sum) = ([], [])
	last = 0
	move = 0
	while i <= j:
		if move == 0:
			p += a[i]
			if j == i:
				p_sum.append(p)
				break
			if p > last:
				p_sum.append(p)
				last = p
				p = 0
				move = 1
			i += 1
		elif move == 1:
			q += a[j]
			if j == i:
				q_sum.append(q)
				break
			if q > last:
				q_sum.append(q)
				last = q
				q = 0
				move = 0
			j -= 1
	print(len(q_sum) + len(p_sum), sum(p_sum), sum(q_sum))


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	ap = 0
	bop = 0
	s = 0
	s1 = 0
	m = 0
	while len(a) != 0:
		s = 0
		if len(a) == 0:
			m -= 1
		while s <= s1:
			if len(a) == 0:
				break
			s += a.pop(0)
		ap += s
		m += 1
		s1 = 0
		if len(a) == 0:
			m -= 1
		while s1 <= s:
			if len(a) == 0:
				break
			s1 += a.pop(-1)
		bop += s1
		m += 1
	print(m, ap, bop)


import sys
input = sys.stdin.readline
t = int(input())

def move(P, index, m, a, player, opindex):
	C = 0
	key = 0
	while C <= P:
		if index == opindex:
			key = 1
		C += a[index]
		if player == 'A':
			index += 1
		else:
			index -= 1
		if key == 1:
			break
	m += 1
	return (C, m, index)
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	(A, B, m) = (a[0], 0, 1)
	i = 1
	j = n - 1
	Ap = a[0]
	while i <= j:
		(Bp, m, j) = move(Ap, j, m, a, 'B', i)
		B += Bp
		if i <= j:
			(Ap, m, i) = move(Bp, i, m, a, 'A', j)
			A += Ap
	print(m, A, B)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	(alice, bob) = (0, 0)
	needed = 0
	count = 0
	who = True
	while len(arr) > 0:
		if who:
			tot = 0
			while needed >= tot:
				try:
					tot += arr[0]
					arr.pop(0)
				except:
					break
			alice += tot
			needed = tot
		else:
			tot = 0
			while needed >= tot:
				try:
					tot += arr[-1]
					arr.pop(-1)
				except:
					break
			bob += tot
			needed = tot
		who = not who
		count += 1
	print(str(count) + ' ' + str(alice) + ' ' + str(bob))


from collections import deque
for _ in range(int(input())):
	n = int(input())
	(steps, a, b) = (0, [0], [0])
	(tempa, tempb) = (0, 0)
	flag = 0
	data = [int(x) for x in input().split()]
	data = deque(data)
	while len(data):
		if flag == 0:
			tempa += data.popleft()
			if tempa > b[-1]:
				flag = 1
				a.append(tempa)
				tempa = 0
		else:
			tempb += data.pop()
			if tempb > a[-1]:
				flag = 0
				b.append(tempb)
				tempb = 0
	if flag == 0:
		if tempa != 0:
			a.append(tempa)
	elif tempb != 0:
		b.append(tempb)
	steps = len(a) + len(b) - 2
	print(steps, sum(a), sum(b))


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	A = list(map(int, sys.stdin.readline().split()))
	alice = A[0]
	bob = 0
	i = 1
	j = n - 1
	turn = True
	count = 1
	prev = alice
	while i <= j:
		acc = 0
		if turn:
			while acc <= prev and i <= j:
				acc += A[j]
				j -= 1
			bob += acc
		else:
			while acc <= prev and i <= j:
				acc += A[i]
				i += 1
			alice += acc
		prev = acc
		count += 1
		turn = not turn
	print(count, alice, bob)


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))
	m = 1
	ali = a[0]
	b = 0
	t1 = ali
	t2 = 0
	a.pop(0)
	while len(a) != 0:
		try:
			m += 1
			while t2 <= t1:
				t2 += a[-1]
				b += a[-1]
				a.pop(-1)
			t1 = 0
			if len(a) != 0:
				m += 1
			else:
				break
			while t1 <= t2:
				t1 += a[0]
				ali += a[0]
				a.pop(0)
			t2 = 0
		except IndexError:
			break
	print(m, ali, b, sep=' ')
	t -= 1


def solve():
	n = int(input())
	arr = [int(i) for i in input().split()]
	start = 0
	end = n - 1
	ans = 0
	pr = 0
	a = 0
	b = 0
	nwa = 0
	nwb = 0
	nw = 1
	while start <= end:
		if nw == 1:
			if nwa > pr:
				a += nwa
				pr = nwa
				nwa = 0
				nw = 2
				ans += 1
			else:
				nwa += arr[start]
				start += 1
		elif nwb > pr:
			b += nwb
			pr = nwb
			nwb = 0
			nw = 1
			ans += 1
		else:
			nwb += arr[end]
			end -= 1
	a += nwa
	b += nwb
	if nwa or nwb:
		ans += 1
	print(ans, a, b)
t = int(input())
for i in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	f = 0
	j = 1
	flag = True
	t_size = 0
	a_size = 0
	b_size = 0
	prev_b = 0
	prev_a = 0
	moves = 0
	break_loop = False
	while True:
		if break_loop:
			break
		if flag:
			if f == 0:
				prev_a = arr[i]
				t_size += arr[i]
				a_size += arr[i]
				del arr[i]
				n -= 1
				moves += 1
				f = -1
			else:
				size_a = 0
				i = 0
				while size_a <= prev_b:
					if n == 0:
						break_loop = True
						break
					size_a += arr[i]
					del arr[i]
					n -= 1
				moves += 1
				prev_a = size_a
				t_size += size_a
				a_size += size_a
			if n == 0:
				break_loop = True
			flag = False
		else:
			size_b = 0
			j = 1
			while size_b <= prev_a:
				if n == 0:
					break_loop = True
					break
				size_b += arr[-j]
				del arr[-j]
				n -= 1
			moves += 1
			prev_b = size_b
			t_size += size_b
			b_size += size_b
			flag = True
			if n == 0:
				break_loop = True
	print(moves, a_size, b_size)


t = int(input())
while t > 0:
	n = int(input())
	a = [int(ele) for ele in input().split()]
	i = 0
	j = n - 1
	turn = 'left'
	alice = 0
	bob = 0
	move = 0
	while i <= j:
		if turn == 'left':
			if i == 0:
				prev_i = a[i]
				sumi = prev_i
				i += 1
			else:
				sumi = 0
				while sumi <= prev_j and i <= j:
					sumi += a[i]
					i += 1
			alice += sumi
			prev_i = sumi
			turn = 'right'
		else:
			sumi = 0
			while sumi <= prev_i and j >= i:
				sumi += a[j]
				j -= 1
			bob += sumi
			prev_j = sumi
			turn = 'left'
		move += 1
	print(move, alice, bob)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(move, alice, bob) = (0, 0, 0)
	alice = l[0]
	move += 1
	f = 1
	i = 1
	j = n - 1
	prevSum = l[0]
	temp = [0] * n
	while i <= j:
		if f == 0:
			move += 1
			f = 1
			currSum = 0
			while currSum <= prevSum and i <= j:
				if temp[i] == 0:
					alice = alice + l[i]
					currSum = currSum + l[i]
					temp[i] = 1
				i += 1
			prevSum = currSum
			if i > j:
				break
		if f == 1:
			move += 1
			f = 0
			currSum = 0
			while currSum <= prevSum and i <= j:
				if temp[j] == 0:
					bob = bob + l[j]
					currSum = currSum + l[j]
					temp[j] = 1
				j -= 1
			prevSum = currSum
	print(move, alice, bob)


t = int(input())
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	last = nums.pop(0)
	s = 1
	asum = int(last)
	bsum = 0
	turns = 1
	while nums:
		if s:
			cur = 0
			while nums:
				cur += nums.pop(-1)
				if cur > last:
					break
			bsum += int(cur)
			last = cur
			s = 0
		else:
			cur = 0
			while nums:
				cur += nums.pop(0)
				if cur > last:
					break
			asum += int(cur)
			last = cur
			s = 1
		turns += 1
	print(turns, asum, bsum)


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline().rstrip()
res = ['YES', 'NO']
test_case = ii()
while test_case:
	test_case -= 1
	n = ii()
	a = li()
	tot = al = bob = acur = bcur = 0
	(i, j) = (0, n - 1)
	while i <= j:
		if tot % 2:
			if bcur <= acur:
				bcur += a[j]
				bob += a[j]
				j -= 1
			else:
				tot += 1
				acur = 0
		elif acur <= bcur:
			acur += a[i]
			al += a[i]
			i += 1
		else:
			tot += 1
			bcur = 0
	if acur or bcur:
		tot += 1
	print(tot, al, bob)


from collections import deque
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = deque(a)
	moves = 1
	va = d.popleft()
	vb = 0
	thr = va
	temp = 0
	finished = False
	if len(a) == 1:
		print(moves, va, vb)
	else:
		while d:
			moves += 1
			while temp <= thr:
				temp += d.pop()
				if len(d) == 0:
					vb += temp
					print(moves, va, vb)
					finished = True
					break
			else:
				vb += temp
			if finished:
				break
			thr = temp
			temp = 0
			moves += 1
			while temp <= thr:
				temp += d.popleft()
				if len(d) == 0:
					va += temp
					print(moves, va, vb)
					finished = True
					break
			else:
				va += temp
			if finished:
				break
			thr = temp
			temp = 0


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	(alice, bob) = (0, 0)
	(aPrev, bPrev) = (0, 0)
	seq = deque(a)
	aliceTurn = True
	moves = 0
	while len(seq) > 0:
		if aliceTurn:
			curEaten = 0
			while curEaten <= bPrev and len(seq) > 0:
				curEaten += seq.popleft()
			aPrev = curEaten
			alice += curEaten
			aliceTurn = False
		else:
			curEaten = 0
			while curEaten <= aPrev and len(seq) > 0:
				curEaten += seq.pop()
			bPrev = curEaten
			bob += curEaten
			aliceTurn = True
		moves += 1
	print(moves, alice, bob)


t = int(input())
while t != 0:
	n = int(input())
	S = list(map(int, input().split()))

	def check(arr, b, A, B, tmp):
		a = 0
		while a <= b and len(arr) != 0:
			a += arr.pop(0)
		if a != 0:
			tmp += 1
		A += a
		b = 0
		while b <= a and len(arr) != 0:
			b += arr.pop()
		if b != 0:
			tmp += 1
		B += b
		if len(arr) == 0:
			return (tmp, A, B)
		else:
			return check(arr, b, A, B, tmp)
	(tmp, A, B) = check(S, 0, 0, 0, 0)
	print(tmp, A, B)
	t -= 1


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ap = 0
	aEaten = 0
	bp = n - 1
	bEaten = 0
	lastWeight = 0
	remainingWeight = 0
	for v in a:
		remainingWeight += v
	flag = False
	turn = 0
	eaten = [0] * n
	moves = 0
	while 0 in eaten:
		currentWeight = 0
		if turn == 0:
			while currentWeight <= lastWeight:
				if eaten[ap] != 0:
					break
				currentWeight += a[ap]
				aEaten += a[ap]
				eaten[ap] = a[ap]
				ap += 1
			turn = 1
			lastWeight = currentWeight
		else:
			while currentWeight <= lastWeight:
				if eaten[bp] != 0:
					break
				currentWeight += a[bp]
				bEaten += a[bp]
				eaten[bp] = a[bp]
				bp -= 1
			turn = 0
			lastWeight = currentWeight
		moves += 1
	print(moves, aEaten, bEaten)


t = int(input())
while t > 0:
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	(i, j) = (1, n - 1)
	(pa, pb) = (arr[0], 0)
	(a, b) = (pa, 0)
	moves = 1
	while i <= j:
		if pb == 0:
			while pb <= pa:
				pb += arr[j]
				j -= 1
				if i > j:
					break
			moves += 1
			b += pb
			pa = 0
		elif pa == 0:
			while pa <= pb:
				pa += arr[i]
				i += 1
				if i > j:
					break
			a += pa
			moves += 1
			pb = 0
	print(moves, a, b)
	t -= 1


t = int(input())
for i in range(t):
	a = int(input())
	n = list(map(int, input().split()))
	j = 0
	k = a - 1
	flag = 0
	flag1 = 0
	(at, ac, bt, bc, moves) = (0, 0, 0, 0, 0)
	z = 0
	y = a - 1
	e = 0
	f = 0
	if a == 1:
		print(a, *n, 0)
	else:
		while j <= k:
			for j in range(z, a):
				if j > k:
					break
				elif bc >= ac:
					if e == 0:
						moves = moves + 1
						e = 1
					ac = ac + n[j]
					flag = -1
				else:
					e = 0
					at = at + ac
					flag = 0
					bc = 0
					z = j
					break
			for k in range(y, -1, -1):
				if j > k:
					break
				elif ac >= bc:
					if f == 0:
						moves = moves + 1
						f = 1
					bc = bc + n[k]
					flag1 = -1
				else:
					f = 0
					bt = bt + bc
					flag1 = 0
					ac = 0
					y = k
					break
		if flag == -1:
			at = at + ac
		if flag1 == -1:
			bt = bt + bc
		print(moves, at, bt)


import collections

def solve(n, k):
	(a, b) = ([0, 0], [0, 0])
	dq = collections.deque(n)
	i = 0
	while dq:
		i += 1
		while dq and a[1] <= b[1]:
			c = dq.popleft()
			a[0] += c
			a[1] += c
		b[1] = 0
		if dq:
			i += 1
		while dq and b[1] <= a[1]:
			c = dq.pop()
			b[0] += c
			b[1] += c
		a[1] = 0
	return list(map(str, [i, a[0], b[0]]))
t = int(input())
for i in range(t):
	k = int(input())
	n = list(map(int, input().split()))
	ans = solve(n, k)
	print(' '.join(ans))


from collections import deque
t = int(input())
for _ in range(t):
	_ = input()
	candy = deque(map(int, input().split()))
	a = 0
	b = 0
	turnAlice = True
	cur_amt = 0
	last_amt = 0
	num_turns = 1
	while candy:
		if turnAlice:
			c = candy.popleft()
			a += c
			cur_amt += c
		else:
			c = candy.pop()
			b += c
			cur_amt += c
		if cur_amt > last_amt:
			turnAlice = not turnAlice
			last_amt = cur_amt
			cur_amt = 0
			if candy:
				num_turns += 1
	print(str(num_turns) + ' ' + str(a) + ' ' + str(b))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n == 1:
		print(1, a[0], 0)
		continue
	l = 1
	r = n - 1
	m = a[0]
	now = 0
	g = 0
	ans = 1
	eated = 1
	bob = 0
	keki = 0
	alice = a[0]
	while 1:
		g += 1
		if g % 2 == 0:
			while m >= now:
				now += a[l]
				alice += a[l]
				eated += 1
				l += 1
				if l == r + 1:
					keki = 1
					break
			m = now
		else:
			while m >= now:
				now += a[r]
				bob += a[r]
				eated += 1
				r -= 1
				if l - 1 == r:
					keki = 1
					break
			m = now
		ans += 1
		now = 0
		if keki == 1:
			break
	print(ans, alice, bob)


from sys import stdin
T = int(input())
for _ in range(T):
	N = int(input())
	candies = list(map(int, stdin.readline().split()))
	(A, B) = (0, 0)
	(prev_A, prev_B) = (0, 0)
	turn = 0
	while candies:
		if turn % 2 == 0:
			while prev_A <= prev_B and candies:
				prev_A += candies.pop(0)
			A += prev_A
			prev_B = 0
		else:
			while prev_B <= prev_A and candies:
				prev_B += candies.pop()
			B += prev_B
			prev_A = 0
		turn += 1
	print(turn, A, B)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = 0
	l = 0
	r = n - 1
	ansl = 0
	ansr = 0
	suml = 0
	sumr = 0
	while l <= r:
		if cnt % 2 == 0:
			nsuml = 0
			while l <= r and nsuml <= sumr:
				nsuml += arr[l]
				l += 1
			ansl += nsuml
			suml = nsuml
		else:
			nsumr = 0
			while l <= r and nsumr <= suml:
				nsumr += arr[r]
				r -= 1
			ansr += nsumr
			sumr = nsumr
		cnt += 1
	print(cnt, ansl, ansr)


import sys, math, cmath, time
start_time = time.time()
tt = 0

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def solve():
	n = inp()
	a = inlt()
	qq = 1
	ww = 0
	qw = 1
	q = a[0]
	qq = a[0]
	i = 1
	j = len(a) - 1
	s = sum(a)
	if j <= i - 1:
		print(1, a[0], 0)
	qwqw = 0
	while j > i - 1 and qq + ww <= s:
		if qw % 2 == 1:
			w = 0
			while j > i - 1 and w <= q:
				w = w + a[j]
				ww = ww + a[j]
				j = j - 1
				if qq + ww >= s or j <= i - 1:
					qw = qw + 1
					print(qw, qq, ww)
					qwqw = 1
					break
			if qwqw == 1:
				break
			qw = qw + 1
		else:
			q = 0
			while j > i - 1 and q <= w:
				q = q + a[i]
				qq = qq + a[i]
				i = i + 1
				if qq + ww >= s or j <= i - 1:
					qw = qw + 1
					print(qw, qq, ww)
					qwqw = 1
					break
			if qwqw == 1:
				break
			qw = qw + 1

def main():
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
	sys.stdout.close()

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


import collections
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	candy = collections.deque(arr, n)
	for i in arr:
		candy.append(i)
	(a, b, hod, hoda, hodb) = (0, 0, 0, 0, 0)
	while len(candy) != 0:
		if hod % 2 == 0:
			while True:
				if candy[0] > hodb or hoda <= hodb:
					popleft = candy.popleft()
					hoda += popleft
					a += popleft
					if hoda > hodb:
						break
					if len(candy) == 0:
						break
			hodb = 0
		if hod % 2 == 1:
			while True:
				if candy[len(candy) - 1] > hoda or hodb <= hoda:
					pop = candy.pop()
					b += pop
					hodb += pop
					if hodb > hoda:
						break
					if len(candy) == 0:
						break
			hoda = 0
		hod += 1
	print(hod, a, b)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	flag = 0
	(alice1, bob1, prev, count) = (0, 0, 0, 0)
	while i <= j:
		if flag == 0:
			alice = l[i]
			i += 1
			while alice <= prev and i <= j:
				alice += l[i]
				i += 1
			prev = alice
			flag = 1
			alice1 += alice
		else:
			bob = l[j]
			j -= 1
			while bob <= prev and i <= j:
				bob += l[j]
				j -= 1
			prev = bob
			flag = 0
			bob1 += bob
		count += 1
	print(count, alice1, bob1)


from math import *
from copy import *
from heapq import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	n = len(l)
	(left, right) = (0, n - 1)
	(a, b) = (0, 0)
	moves = 0
	prev = 0
	while left <= right:
		curr = 0
		if not moves & 1:
			while left <= right and curr <= prev:
				a += l[left]
				curr += l[left]
				left += 1
				print
			prev = curr
		else:
			while left <= right and curr <= prev:
				b += l[right]
				curr += l[right]
				right -= 1
			prev = curr
		moves += 1
	return [moves, a, b]
T = int(input())
for _ in range(T):
	N = int(stdin.readline())
	l = list(map(int, stdin.readline().rstrip().split()))
	print(*solve(l))


import math, sys
import heapq
from fractions import Fraction
from collections import Counter, defaultdict

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())

def dic(x):
	return defaultdict(lambda : x)

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def LCM(a, b):
	return a * b / gcd(a, b)
t = int(input())
for _ in range(t):
	n = ii()
	a = li()
	b = a[::1]
	totala = a[0]
	totalb = b[n - 1]
	c = a[0]
	d = 0
	flag = 0
	k = 0
	i = 0
	j = n - 1
	while i < j:
		if flag == 0:
			if totalb > totala:
				d += totalb
				totala = 0
				flag = 1
				k = k + 1
			else:
				j -= 1
				if i >= j:
					k = k + 1
					if totalb > 0:
						k = k + 1
					d += totalb
					break
				totalb += b[j]
		elif totala > totalb:
			c += totala
			totalb = 0
			flag = 0
			k = k + 1
		else:
			i += 1
			if i >= j:
				k = k + 1
				if totala > 0:
					k = k + 1
				c += totala
				break
			totala += a[i]
	if n == 1:
		k += 1
	print(k, c, d)


from sys import stdin, stdout
t = int(stdin.readline())
while t > 0:
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	(alice, bob) = (0, 0)
	(sa, sb) = (0, 0)
	(l, r) = (0, n - 1)
	move = 0
	while True:
		if move % 2 == 0:
			while alice <= bob:
				if len(a):
					alice += a.pop(0)
				else:
					break
			sa += alice
			bob = 0
		else:
			while bob <= alice:
				if len(a):
					bob += a.pop(-1)
				else:
					break
			sb += bob
			alice = 0
		move += 1
		if not len(a):
			break
	print(move, sa, sb)
	t -= 1


for lq in range(int(input())):
	musor = int(input())
	arr = list(map(int, input().split()))
	bob = 0
	ali = arr[0]
	hod = 1
	gali = ali
	gbob = 0
	arr.pop(0)
	flag = 1
	while arr != []:
		hod += 1
		while ali <= bob and flag == 0 and (arr != []):
			ali += arr[0]
			gali += arr[0]
			arr.pop(0)
		while bob <= ali and flag == 1 and (arr != []):
			bob += arr[len(arr) - 1]
			gbob += arr[len(arr) - 1]
			arr.pop(len(arr) - 1)
		flag = (flag + 1) % 2
		if bob > ali:
			ali = 0
		else:
			bob = 0
	print(hod, gali, gbob)


import math
t = int(input())
while t:
	t = t - 1
	n = int(input())
	arr = list(map(int, input().split()))
	a = 1
	b = n - 1
	asum = arr[0]
	bsum = 0
	asum1 = asum
	bsum1 = 0
	count = 1
	while a <= b:
		while bsum <= asum and a <= b:
			bsum += arr[b]
			b -= 1
		if bsum:
			count += 1
		bsum1 += bsum
		asum = 0
		while asum <= bsum and a <= b:
			asum += arr[a]
			a += 1
		if asum:
			count += 1
		asum1 += asum
		bsum = 0
	print(count, asum1, bsum1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = [l[0]]
	a = l[0]
	b = 0
	f = 1
	bin = n
	ain = 0
	prev = l[0]
	ans = 1
	while len(x) != n:
		ans += 1
		if f == 1:
			y = 0
			while y <= prev:
				if len(x) == n:
					break
				bin = bin - 1
				x.append(l[bin])
				y += l[bin]
				if y > prev:
					break
			prev = y
			b += y
			f = 0
		else:
			y = 0
			while y <= prev:
				if len(x) == n:
					break
				ain = ain + 1
				x.append(l[ain])
				y += l[ain]
				if y > prev:
					break
			prev = y
			a += y
			f = 1
	print(ans, end=' ')
	print(a, end=' ')
	print(b)


t = int(input())
for _ in range(t):
	n = int(input())
	C = list(map(int, input().split()))
	moves = 1
	last_eat = 'a'
	last_eaten = C[0]
	(a, b) = (C.pop(0), 0)
	while C != []:
		if last_eat == 'a':
			curr_eat = 0
			while curr_eat <= last_eaten:
				try:
					curr_eat += C.pop(-1)
				except IndexError:
					break
			if curr_eat > 0:
				moves += 1
			last_eat = 'b'
			last_eaten = curr_eat
			b += curr_eat
		if last_eat == 'b':
			curr_eat = 0
			while curr_eat <= last_eaten:
				try:
					curr_eat += C.pop(0)
				except IndexError:
					break
			if curr_eat > 0:
				moves += 1
			last_eat = 'a'
			last_eaten = curr_eat
			a += curr_eat
	print(moves, a, b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	i = 0
	j = n - 1
	a = True
	s = 0
	c = 0
	al = 0
	bo = 0
	l = [False] * n
	if n == 1:
		print(1, arr[0], 0)
		continue
	while i <= j:
		if a:
			cur = 0
			while i <= j and cur <= s:
				l[i] = True
				cur += arr[i]
				i += 1
			al += cur
			s = cur
			a = False
		else:
			cur = 0
			while i <= j and cur <= s:
				l[j] = True
				cur += arr[j]
				j -= 1
			bo += cur
			s = cur
			a = True
		c += 1
	print(c, al, bo)


t = int(input())
while t:
	n = int(input())
	a = [int(x) for x in input().split()]
	i = 0
	flag = 1
	c = q = 0
	prevB = prevA = 0
	allA = allB = 0
	while len(a):
		if flag:
			if i == 0:
				k = a.pop(i)
				prevA = k
				i = 1
			else:
				k = 0
				while k <= prevB:
					if len(a) == 0:
						q = 1
						break
					k += a.pop(0)
				prevA = k
			allA += prevA
			flag = 0
			if q == 1:
				c += 1
				break
		else:
			k = 0
			while k <= prevA:
				if len(a) == 0:
					q = 1
					break
				k += a.pop()
			prevB = k
			allB += prevB
			flag = 1
			if q == 1:
				c += 1
				break
		c += 1
	print(c, allA, allB)
	t -= 1


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = len(a) - 1
	p = 0
	move = 0
	cur = 0
	ans = [0, 0]
	while l <= r:
		tot = 0
		while tot <= p and l <= r:
			if cur:
				tot += a[r]
				r -= 1
			else:
				tot += a[l]
				l += 1
		ans[cur] += tot
		move += 1
		p = tot
		cur = 1 - cur
	print(move, ans[0], ans[1])
	t -= 1


for _ in range(int(input())):
	N = int(input())
	A = list(map(int, input().split()))
	a = A[0]
	eatcount = A[0]
	curra = A[0]
	games = 1
	b = 0
	currb = 0
	i = 1
	j = N - 1
	while i <= j:
		temp1 = 0
		temp2 = 0
		while currb <= eatcount and i <= j:
			temp1 = 1
			currb += A[j]
			j -= 1
		if temp1 == 1:
			eatcount = currb
			b += eatcount
			curra = 0
			games += 1
		else:
			break
		while curra <= eatcount and i <= j:
			temp2 = 1
			curra += A[i]
			i += 1
		if temp2 == 1:
			eatcount = curra
			a += eatcount
			currb = 0
			games += 1
		else:
			break
	print(games, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	mas = [int(i) for i in input().split()]
	a = mas[0]
	b = 0
	mas.pop(0)
	deq = 1
	eat_a = a
	eat_b = 0
	count = 1
	while len(mas) > 0:
		count += 1
		if deq % 2 != 0:
			eat_b = 0
			while eat_b <= eat_a and len(mas) > 0:
				b += mas[-1]
				eat_b += mas[-1]
				mas.pop()
		else:
			eat_a = 0
			while eat_a <= eat_b and len(mas) > 0:
				a += mas[0]
				eat_a += mas[0]
				mas.pop(0)
		deq += 1
	print(count, a, b)


t = int(input())
for i in range(t):
	n = int(input())
	d = list(map(int, input().split()))[:n]
	(a, b, c, l1, l2) = (0, 0, 0, -1, n)
	(f1, f2) = (0, 0)
	while l2 - l1 > 1:
		if f1 == 0 or a < b:
			c += 1
			for j in range(l1 + 1, l2):
				a += d[j]
				if a > b:
					b = 0
					(l1, f1) = (j, f1 + d[j])
					break
				(l1, f1) = (j, f1 + d[j])
		elif f2 == 0 or b < a:
			c += 1
			for j in range(l2 - 1, l1, -1):
				b += d[j]
				if b > a:
					a = 0
					(l2, f2) = (j, f2 + d[j])
					break
				(l2, f2) = (j, f2 + d[j])
	print(c, f1, f2)


import sys
import collections
input = sys.stdin.readline

def solve(d):
	move = 0
	alice = 0
	bob = 0
	befalice = 0
	befbob = 0
	while 1:
		if not d:
			return (move, alice, bob)
		tmpalice = 0
		tmpbob = 0
		if alice <= bob:
			if alice == 0:
				alice += d.popleft()
				befalice = alice
				move += 1
			else:
				while 1:
					if tmpalice > befbob:
						break
					if not d:
						return (move + 1, alice + tmpalice, bob)
					tmpalice += d.popleft()
				befalice = tmpalice
				alice += tmpalice
				move += 1
		else:
			while 1:
				if tmpbob > befalice:
					break
				if not d:
					return (move + 1, alice, bob + tmpbob)
				tmpbob += d.pop()
			befbob = tmpbob
			bob += tmpbob
			move += 1
T = int(input())
for _ in range(0, T):
	N = int(input())
	d = collections.deque(list(map(int, input().split(' '))))
	(m, a, b) = solve(d)
	print(m, a, b)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	l = deque(map(int, input().split()))
	alice = 0
	bob = 0
	moves = 0
	prev = 0
	while sum(l) > prev:
		thismove = 0
		if moves % 2 == 0:
			while thismove <= prev:
				thismove += l.popleft()
			alice += thismove
		else:
			while thismove <= prev:
				thismove += l.pop()
			bob += thismove
		prev = thismove
		moves += 1
	if l:
		if moves % 2 == 0:
			alice += sum(l)
		else:
			bob += sum(l)
		moves += 1
	print(moves, alice, bob)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = a.copy()
	tot_alic = inst_alic = a[0]
	tot_bob = inst_bob = 0
	ib = len(a) - 1
	ia = 1
	b.pop(0)
	alic_chance = False
	moves = 1
	while b:
		if ia == ib:
			moves += 1
			if alic_chance:
				tot_alic = tot_alic + a[ia]
			else:
				tot_bob = tot_bob + a[ib]
			break
		if not alic_chance:
			inst_bob = inst_bob + a[ib]
			b.pop()
			tot_bob = tot_bob + a[ib]
			ib = ib - 1
			if inst_bob > inst_alic:
				alic_chance = True
				moves = moves + 1
				inst_alic = 0
		else:
			inst_alic = inst_alic + a[ia]
			b.pop(0)
			tot_alic = tot_alic + a[ia]
			ia = ia + 1
			if inst_alic > inst_bob:
				alic_chance = False
				moves = moves + 1
				inst_bob = 0
	print(moves, tot_alic, tot_bob)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	c = l[0]
	del l[0]
	k = 0
	t = 0
	tt = c
	z = 1
	while len(l) != 0:
		if k == 0:
			for i in range(len(l) - 1, -1, -1):
				k += l[i]
				if k > c:
					break
			del l[i:len(l)]
			z += 1
			t += k
			if len(l) != 0 and sum(l) <= k:
				tt += sum(l)
				z += 1
				break
			c = 0
			continue
		if c == 0:
			for i in range(len(l)):
				c += l[i]
				if c > k:
					break
			del l[0:i + 1]
			z += 1
			tt += c
			if len(l) != 0 and sum(l) <= c:
				t += sum(l)
				z += 1
				break
			k = 0
			continue
	print(z, tt, t)


def resolve():
	from collections import deque
	t = int(input())
	for _ in range(t):
		n = int(input())
		q = deque(map(int, input().split()))
		i = 0
		a = b = 0
		before = 0
		while q:
			i += 1
			if i % 2 == 1:
				now = 0
				while now <= before and q:
					p = q.popleft()
					now += p
					a += p
				before = now
			else:
				now = 0
				while now <= before and q:
					p = q.pop()
					now += p
					b += p
				before = now
		print(i, a, b)
resolve()


from collections import deque
t = int(input())
for times in range(t):
	n = int(input())
	candy = deque(list(map(int, input().split())))
	pre = 0
	alice = 0
	bob = 0
	a_turn = True
	this = 0
	check = True
	turn = 0
	while True:
		this = 0
		if a_turn:
			while this <= pre and len(candy) != 0:
				x = candy.popleft()
				this += x
			alice += this
			pre = this
			this = 0
			a_turn = False
			turn += 1
			if len(candy) == 0:
				break
		else:
			while this <= pre and len(candy) != 0:
				x = candy.pop()
				this += x
			bob += this
			pre = this
			this = 0
			turn += 1
			a_turn = True
			if len(candy) == 0:
				break
	print(turn, alice, bob)


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
for _ in range(int(f_input())):
	amount = int(f_input())
	candies = [int(_) for _ in f_input().split()]
	(totalA, totalB) = (candies[0], 0)
	(posA, posB) = (1, 0)
	(prevA, prevB) = (candies[0], 0)
	candiesTotal = sum(candies)
	turns = 1
	candies[0] = 0
	while candiesTotal > totalA + totalB:
		current = 0
		if turns % 2:
			while current <= prevA and posB < amount:
				if candies[amount - posB - 1]:
					current += candies[amount - posB - 1]
					candies[amount - posB - 1] = 0
				posB += 1
			prevB = current
			totalB += current
		else:
			while current <= prevB and posA < amount:
				if candies[posA]:
					current += candies[posA]
					candies[posA] = 0
				posA += 1
			prevA = current
			totalA += current
		turns += 1
	f_print(str(turns) + ' ' + str(totalA) + ' ' + str(totalB) + '\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	move = 0
	pre = list(a)
	suf = list(a)
	for i in range(1, n):
		pre[i] += pre[i - 1]
	for j in range(n - 2, -1, -1):
		suf[j] += suf[j + 1]
	(l, r) = (-1, n)
	(ca, cb) = (0, 0)
	(pa, pb) = (0, 0)
	t = 1
	while ca + cb < pre[-1]:
		if t:
			fl = False
			for i in range(l + 1, r):
				if pre[i] - ca > pb:
					fl = True
					pa = pre[i] - ca
					ca = pre[i]
					l = i
					break
			if not fl:
				l = r - 1
				ca = pre[l]
		else:
			fl = False
			for j in range(r - 1, l, -1):
				if suf[j] - cb > pa:
					fl = True
					pb = suf[j] - cb
					cb = suf[j]
					r = j
					break
			if not fl:
				r = l + 1
				cb = suf[r]
		move += 1
		t ^= 1
	print(move, ca, cb)


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	a = 0
	b = 0
	check = 0
	sa = 0
	res = 0
	zz = 0
	while len(l) != 0:
		if sa % 2 == 0:
			sums = 0
			while len(l) != 0 and sums <= check:
				sums += l[0]
				l.pop(0)
			if sums < check:
				zz = 1
			a += sums
			check = sums
			sa += 1
		else:
			sums = 0
			while len(l) != 0 and sums <= check:
				sums += l[-1]
				l.pop(-1)
			if sums < check:
				zz = 1
			b += sums
			check = sums
			sa += 1
		res += 1
	print(res, a, b)


from math import *
from collections import *
from functools import *
from bisect import *
from itertools import *
from heapq import *
from statistics import *
inf = float('inf')
ninf = -float('inf')
ip = input
alphal = 'abcdefghijklmnopqrstuvwxyz'
alphau = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def ipl():
	return list(map(int, input().split()))

def ipn():
	return int(input())

def ipf():
	return float(input())

def solve():
	(n, l) = (ipn(), ipl())
	f = i = a = b = at = bt = m = 0
	j = n - 1
	while i <= j:
		if not f:
			a = 0
			while i <= j:
				at += l[i]
				a += l[i]
				i += 1
				if a > b:
					break
			f = 1
		else:
			b = 0
			while i <= j:
				b += l[j]
				bt += l[j]
				j -= 1
				if b > a:
					break
			f = 0
		m += 1
	print(m, at, bt)
for _ in range(ipn()):
	solve()


for n in range(int(input())):
	x = int(input())
	s = list(map(int, input().split()))
	sm1 = s[0]
	pr1 = sm1
	pr2 = 0
	sm2 = 0
	a = 1
	b = x - 1
	res = 1
	while a <= b:
		if res % 2 == 1:
			pr2 = 0
			while pr2 <= pr1 and a <= b:
				sm2 += s[b]
				pr2 += s[b]
				b -= 1
		else:
			pr1 = 0
			while pr1 <= pr2 and a <= b:
				sm1 += s[a]
				pr1 += s[a]
				a += 1
		res += 1
	print(res, sm1, sm2)


t = int(input())
for i in range(t):
	n = int(input())
	sweets = [int(x) for x in input().split()]
	atot = 0
	btot = 0
	atot += sweets[0]
	del sweets[0]
	last = atot
	cnt = 1
	while len(sweets) > 0:
		a = 0
		b = 0
		while b <= last and len(sweets) > 0:
			b += sweets.pop()
		btot += b
		if b > 0:
			cnt += 1
		last = b
		while a <= last and len(sweets) > 0:
			a += sweets.pop(0)
		if a > 0:
			cnt += 1
		last = a
		atot += a
	print(cnt, atot, btot)


t = int(input())
for test in range(0, t):
	n = int(input())
	arr = list(map(int, input().split()))
	n_mov = 0
	count_a = 0
	count_b = 0
	idx_a = 0
	idx_b = n - 1
	prev = 0
	flag = True
	aux_a = 0
	aux_b = 0
	flag_end = False
	while True:
		n_mov += 1
		if flag:
			while prev >= aux_a:
				aux_a += arr[idx_a]
				idx_a += 1
				if idx_a == idx_b + 1:
					flag_end = True
					break
			count_a += aux_a
			prev = aux_a
			aux_a = 0
			flag = False
		else:
			while prev >= aux_b:
				aux_b += arr[idx_b]
				idx_b -= 1
				if idx_b == idx_a - 1:
					flag_end = True
					break
			count_b += aux_b
			prev = aux_b
			aux_b = 0
			flag = True
		if flag_end:
			break
	print(n_mov, count_a, count_b)


t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(ans, ans1, ans2) = (0, 0, 0)
	(i, j) = (-1, n)
	(s1, s2) = (0, 0)
	while i < j - 1:
		ans += 1
		s1 = 0
		while s1 <= s2 and i < j - 1:
			i += 1
			s1 += a[i]
		ans1 += s1
		s2 = 0
		if i < j - 1 and s2 <= s1:
			ans += 1
			while s2 <= s1 and i < j - 1:
				j -= 1
				s2 += a[j]
		ans2 += s2
	print(ans, ans1, ans2)