Binary Reduce a List By Addition With a Right Bias Given a list of 2 or more strictly positive integers, sum the first and last half of the list, with the middle element being counted only in the right half if the list has an odd number of elements

Some examples of the middle element being counted in the right half:

[1, 2, 3, 4]       -&gt; Left: [1, 2];    Right: [3, 4]
[1, 2, 3]          -&gt; Left: [1];       Right: [2, 3]
[1, 2, 3, 4, 5]    -&gt; Left: [1, 2];    Right: [3, 4, 5]
[1, 2, 3, 4, 5, 6] -&gt; Left: [1, 2, 3]; Right: [4, 5, 6]


Test Cases

Input

[1, 9]
[9, 5, 5, 7]
[6, 7, 5, 1, 3, 9, 7, 1, 6]
[2, 8, 10, 9, 9, 3, 7, 8, 9, 8, 6, 1, 2, 9, 8, 3, 8, 9, 5]
[2, 3, 1, 8, 6, 2, 10, 6, 7, 6]


Output

[1, 9]
[14, 12]
[19, 26]
[65, 59]
[20, 31]


Reference Program With Two Output Methods

Rules


Input/Output can be Taken/Given in any convenient and reasonable format.
Functions and full programs are both acceptable.
Python 2, 40 bytes

Takes as input a list \$ l \$, and outputs the two sums in reverse order ([right, left]).



lambda l:[sum(l.pop()for x in l),sum(l)]


Explanation

In sum(l.pop()for x in l), we pop the last element, in each iteration, and sum the popped elements. Surprisingly, the loop only runs \$ \lceil{\frac{|l|}{2}}\rceil \$ times, since for every element we iterate from the left, we are removing an element from the right, resulting in the loop terminating somewhere in the middle. Therefore it gives us the sum of the right portion of the list. The sum of the remaining elements make up the left portion.

Try it online!