[Question]
  [
To check whether a list of non-negative integers is *balanced*, one can imagine putting respective weights on a board and then try to balance the board on a pivot such that the summarized *relative* weights left and right of the pivot are the same. The relative weight is given by multiplying the weight with its distance to the pivot (see [law of the lever](https://en.wikipedia.org/wiki/Lever#Force_and_levers)).
[![wikipedia lever](https://i.stack.imgur.com/DcuPO.jpg)](https://i.stack.imgur.com/DcuPO.jpg)
(Source: [wikipedia](https://en.wikipedia.org/wiki/File:Palanca-ejemplo.jpg))
This image corresponds to a list `[100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5]`. This list is balanced because the `5` has a distance of 20 to the pivot, the `100` a distance of 1 and `5*20 = 100 = 100*1`.
## Examples
```
 3 1 5 7
#########
     ^
```
In this case the pivot is directly under the `5`, the `3` has distance 2 and the `1` and `7` have distance 1. So both sides left and right of the pivot sum up to `7` (`3*2 + 1*1` on the left and `7*1` on the right) and therefore the list `[3, 1, 5, 7]` is balanced.
Note, however, that the pivot does not have to be placed under one of the list elements, but might also be placed in-between two list elements:
```
 6 3 1
#######
  ^
```
In this case the distances become `0.5, 1.5, 2.5, ...` and so on. This list is also balanced because `6*0.5 = 3 = 3*0.5 + 1*1.5`.
The pivot can only be placed exactly below one number or exactly in the middle between two numbers, and **not** e.g. at two-thirds between two numbers.
## Task
Given a list of non-negative integers in any reasonable format, output a `truthy` value if the list can be *balanced* and a `falsy` value otherwise. 
You can assume that the input list contains at least two elements and that at least one element is non-zero.
This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") challenge, so the answer with the fewest amount of bytes in each language wins.
## Truthy Testcases
```
[1, 0]
[3, 1, 5, 7]
[6, 3, 1]
[100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5]
[10, 4, 3, 0, 2, 0, 5]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
[7, 7, 7, 7]
```
## Falsy Testcases
```
[1, 2]
[3, 6, 5, 1, 12]
[0, 0, 2, 0, 1, 0]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[6, 3, 2, 4, 0, 1, 2, 3]
[4, 0, 0, 2, 3, 5, 2, 0, 1, 2, 3, 0, 0, 1, 2, 4, 3, 1, 3, 0, 0, 2]
[100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5]
```
---
A lot of related challenges where found while this challenge was [sand-boxed](https://codegolf.meta.stackexchange.com/a/10521/56433):
[Is it a balanced number?](https://codegolf.stackexchange.com/questions/94291/is-it-a-balanced-number), [Equilibrium index of a sequence](https://codegolf.stackexchange.com/questions/2438/equilibrium-index-of-a-sequence), [Balance a set of weights on a seesaw](http://codegolf.stackexchange.com/questions/54311/balance-a-set-of-weights-on-a-seesaw), [Balancing Words](https://codegolf.stackexchange.com/questions/52754/balancing-words), [Will I tip over?](https://codegolf.stackexchange.com/questions/129693/will-i-tip-over) and [Where does the pivot belong?](https://codegolf.stackexchange.com/questions/132512/where-does-the-pivot-belong)
  
[Answer]
# Pyth, ~~12~~ 10 bytes
```
!%ys*VQUQs
```
[Try it online](http://pyth.herokuapp.com/?code=%21%25ys%2aVQUQs&input=%5B100%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+0%2C+5%5D&debug=0)
Saved 2 bytes thanks to Mr. Xcoder and Erik the Outgolfer.
### Explanation
```
!%ys*VQUQs
    *VQUQ    Multiply each input by its index.
  ys         Take twice the sum (to handle half-integer positions).
!%       sQ  Check if that's a multiple of the total weight.
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 36 bytes
```
IntegerQ[2#.Range[t=Tr[1^#]]/(t-1)]&
```
This is a center of mass problem in a coordinate system with the origin at one of the points and then you determine if the CM falls on a lattice point where the lattice width = 1/2.
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b73zOvJDU9tSgw2khZLygxLz01usQ2pCjaME45NlZfo0TXUDNW7X9AUWZeiUOaQ7WhgYGOAiXItJYLyTAdBRMdBWOwhBGmNFjQGKzGVEfBTEfBXEfBQkfBEkmNCcxciEpTmDlwvQZIXIhdhkjiRrX/AQ "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 6 bytes
```
ƶO·IOÖ
```
[Try it online!](https://tio.run/##MzBNTDJM/f//2Db/Q9s9/Q9P@/8/2tDAQEeBEmQaCwA "05AB1E – Try It Online")
### How?
```
ƶO·IOÖ ~ Full program. I = input.
ƶ      ~ Lift I. Multiply each element with its 1-based index.
 O     ~ Sum.
  ·    ~ Double. 
     Ö ~ Is a multiple of?
   IO  ~ The sum of I.
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
×JSḤọS
```
[Try it online!](https://tio.run/##y0rNyan8///wdK/ghzuWPNzdG/z///9oEx0FAzAy0lEw1lEwBTOAXEOYiAES1wQsYogkbhQLAA "Jelly – Try It Online")
Well, looks like [Leaky Nun](https://codegolf.stackexchange.com/users/48934/leaky-nun) pointed the pointless out.
Using Mnemonic's Pyth approach.
Returns a positive integer (truthy) or zero (falsy).
[Answer]
# [R](https://www.r-project.org/), 34 bytes
```
function(n)!(n%*%seq(n)*2)%%sum(n)
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/TyNPU1EjT1VLtTi1EMjWMtJUVS0uzQUy/6dpJGuY6CgYgJGRjoKxjoIpmAHkGsJEDJC4JmARQyRxI01NLpAxhgYGMCHykKmm5n8A "R – Try It Online")
Takes input as a vector. Ports [mnemonic's answer](https://codegolf.stackexchange.com/a/151322/67312). Returns a `1x1` matrix.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 10 bytes
```
í* x*2 vUx
```
[Try it online!](https://tio.run/##y0osKPn///BaLYUKLSOFstCK//@jjXUUDHUUTHUUzGMB "Japt – Try It Online")
## Explanation:
```
 í* x*2 vUx
U            // Implicit Input                 [3, 1, 5, 7]
 í           // Pair the input with its index  [[3,0],[1,1],[5,2],[7,3]]
  *          // Multiply each item             [0,1,10,21]
    x        // Sum                            32
     *2      // Double                         64
        v    // Divisible by:
         Ux  //   Sum of Input                 16
             // Explicit Output                1
```
Returns `1` for truthy, `0` for falsy.
[Answer]
# [Python 2](https://docs.python.org/2/), 41 bytes
```
S=s=0
for n in input():S-=s;s-=n
1>>2*S%s
```
Output is via exit code, so **0** is truthy and **1** is falsy.
[Try it online!](https://tio.run/##pVCxboMwEJ3hK26paCtHsp0QWiqy0bUDVZcoA6KuYik1yDYqfD092w2hUjtFstC9e@/evaMb7bFVfPo6ypOAV92LPI6sHvEbiUE0kCTJVBWmoPFHq0GBdK/r7e1dXq0K82RWhYrZbsfvqxszoRoHOy2VhaQcpIWmfRc5UGyLoRGdhbf61ItS61bnf0rZRVqNytbDb@1Mli/PM6NraQTKjRWfziqKpj0jQA/xfk0Aq5RAhmBLwGGsGKXIX/FSb0Jg4y2x4Je2B2vP4WJcmhF4IPCIq12kzDcyHymoQ86tlyNmrkEXrj@3/Gs8n8Y9FyacFInNOXEYTRee/Jx9huEatujz635WevgG "Python 2 – Try It Online")
[Answer]
# [Julia](http://julialang.org/), ~~31~~ 27 bytes
*4 bytes saved thanks to @Dennis*
```
!n=2n[i=1:end]⋅i%sum(n)<1
```
[Try it online!](https://tio.run/##pVFBDsIgELzzivVg0iYcgJaixr6EcDBRE0xFU23SD3jyl34EF7DKxVMJh93Z3dkZOA2d3TXeL1wrnLYt3xzc3ryeD7u8DefClVvuj5ceRmhBE80pMEOJrihgKCmokDUUAhBCzhi2zLgysVCoIykGIsNjVsUiLse9isKKwhq3R10qIirpSv0fuU2cQIBHhGXUk6m/7D@PIhbTTOgNlXqSnoZlRismD980ueIZLmY@mzTEEMBz7a27d65YjCXBT/Rv "Julia 0.6 – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 47 bytes
*Saved 2 bytes thanks to Mr. Xcoder*
```
->k{(k.map.with_index{|x,i|x*i*2}.sum%k.sum)<1}
```
[Try it online!](https://tio.run/##pVDLboMwEDzDV2wOFRAZB5MQWqn0RwBFeTjB4hFUQKECvp2uTZNyaE@RLGtnZj0768/m8DWKomxqCODC64oek2te6rdEZByUsAgMmxm6lomCY5Pi6KVqDgtzFUZhFMcrAoZh0arMRG0aBMt8X0IHfdtDS@vrTsCga@cgGu2PtDNTKdObqJOdKE687fqWiL5diqU70KrJX1J5W@9sGDWcVcGZHvdZZsoAlq79kZYXpzFkBJxYD9cEsPII@Ai2BCTGijkO6k8cT5kQ2ChLLNxfWoG10nAwDvUJvBJ4w9Eykq8If4okm6eYW9WNmEnCmZn@rPKv72MzV2nTC9mKwuYeeHrqzTzde/QHnJZhM9597q/wO2z2DQ "Ruby – Try It Online")
[Answer]
# C, ~~140~~ 137 bytes
```
float l,r;i,j,t;f(L,n)int*L;{for(i=t=-1;++i<2*n;t*=l-r)for(l=r=j=0;j<n;++j)l+=j<i/2.?L[j]*(i/2.-j):0,r+=j>i/2.?L[j]*(j-i/2.):0;return!t;}
```
[Try it online!](https://tio.run/##pZPfbsIgFMbvfQpmsqStdAP61yHbC/gGzgvj7FLS1YWxK@OzdweqrgZDL2x6AXycH@ccPrbx53bbdVWz32jUYMVrLLHmVbDEbVi3OlryQ7VXQS20iCmfzeoFi1quI9HEKjRKI5SQgnC5aEGWYTMTclE/s6e35Uquo8AMYxm@EKxAeR0oMjYTULja6V/VPmh@7OBM9LWp2yCcHCYIPrOgdz@artZIoAPFiBy5Vb4VaFUwffx4b6cYVYHdhhELQz65imV9bIIRyBlGhY/AMEodQtITcowMxBcOeuKEp6fkCYH07/gz38kplO7Wnp2PhrJs9jBg4zDTJYeVX@6AWVRquwlNKTAqMZpDa7yXk5sNDrXoqYXFFCO3U9y6nfI/L19secsb84s3clsNQKiXAlVmDoWSHkMG/R21KuzJXRIdabIXCVFzF8mG7mUW2ednTvDyYEPp8k6vIT3bsk80GxTOzla7THvz0cG6t8s0uelmev9L8tqemkdkLXrs/gA)
[Answer]
# [Python 3](https://docs.python.org/3/), 51 bytes
```
lambda k:sum(i*e*2for i,e in enumerate(k))%sum(k)<1
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHbqrg0VyNTK1XLKC2/SCFTJ1UhM08hNa80N7UosSRVI1tTUxWkIlvTxvB/QVFmXolGmka0oYGBjgIlyDRWU/M/AA "Python 3 – Try It Online")
[Answer]
# [Perl 6](https://perl6.org), 23 bytes
```
{sum(1..*Z*$_)*2%%.sum}
```
[Test it](https://tio.run/##pVJRS8MwEH7Pr7gHJ23NQpOtrVImffIX7EmRUWeEQjdLswoy9tvrJZfOKAjCIA@57758d9/lOt23@TgYDR@52JZs9wnXjZm/1G293@pXWI1HM@wiKUTymFxt4kTNZgKR04jMat0PGlYQMYAnySF95va24IBBxqGgOOdgIQpkmiLxgpNNOhyWThgv6kfGxQuXxiawesHhlsMd9uA7LBxWUIexc1091K0JzaizmdzpICQ9lgZFv23/WTecgnJpemfZlFtO5kggC8TV5PEckmsZ4Ori0WY0B7sHa20OJevw//3/3vjZlOztvffY/B6qZt8NBzhi5cZAsDMRZWIOlso9UXS4aSU7kQgN@38qjvtbZvwC "Perl 6 – Try It Online")
Uses the algorithm from various other entries.
## Expanded:
```
{  # bare block lambda with implicit parameter ｢$_｣
    sum(
        1 .. *  # Range starting from 1
      Z*        # Zip using &infix:«*»
        $_      # the input
    ) * 2
  %%            # is divisible by
    .sum        # the sum of the input (implicit method call on ｢$_｣)
}
```
[Answer]
# Japt, ~~11~~ ~~10~~ 8 bytes
Originally inspired by [Mnemonic's solution](https://codegolf.stackexchange.com/a/151322/58974)
```
x* vUx*½
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=eCogdlV4Kr0=&input=WzMsMSw1LDdd)
~~1~~ 3 bytes saved thanks to ETHproductions.
---
## Explanation
Implicit input of array `U`. Reduce by addition (`x`), multiplying each element by its 0-based index (`*`) in the process. Check if the result is evenly divisible (`v`) by the sum of the original input (`Ux`) with each element being multiplied by 0.5 (`*½`).
[Answer]
## [C#](http://csharppad.com/gist/449df3f2fc21811edf4541d6d44654c5), 71 bytes
---
**Golfed**
```
a=>{int i,s,S=s=i=0;while(i<a.Length){S-=s;s-=a[i++];}return 2*S%s<1;};
```
---
**Ungolfed**
```
a => {
    int
        i, s, S = s = i = 0;
    
    while( i < a.Length ) {
        S -= s;
        s -= a[ i++ ];
    }
    
    return 2 * S % s < 1;
};
```
---
**Full code**
```
using System;
namespace Namespace {
    class Program {
        static void Main( String[] args ) {
            Func<Int32[], Boolean> f = a => {
                int
                    i, s, S = s = i = 0;
                while( i < a.Length ) {
                    S -= s;
                    s -= a[ i++ ];
                }
                return 2 * S % s < 1;
            };
            List<Int32[]>
                testCases = new List<Int32[]>() {
                    new Int32[] {1, 0},
                    new Int32[] {3, 1, 5, 7},
                    new Int32[] {6, 3, 1},
                    new Int32[] {100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5},
                    new Int32[] {10, 4, 3, 0, 2, 0, 5},
                    new Int32[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
                    new Int32[] {7, 7, 7, 7},
                    new Int32[] {1, 2},
                    new Int32[] {3, 6, 5, 1, 12},
                    new Int32[] {0, 0, 2, 0, 1, 0},
                    new Int32[] {1, 2, 3, 4, 5, 6, 7, 8, 9},
                    new Int32[] {6, 3, 2, 4, 0, 1, 2, 3},
                    new Int32[] {4, 0, 0, 2, 3, 5, 2, 0, 1, 2, 3, 0, 0, 1, 2, 4, 3, 1, 3, 0, 0, 2},
                    new Int32[] {100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5},
                };
            foreach( Int32[] testCase in testCases ) {
                Console.WriteLine( $"{{ {String.Join(", ", testCase)} }}\n{f( testCase )}" );
            }
            Console.ReadLine();
        }
    }
}
```
---
**Releases**
* **v1.0** - `71 bytes` - Initial solution.
---
**Notes**
I might have, or might have not, blatantly "borrowed" [Dennis Python 2 solution](https://codegolf.stackexchange.com/a/151355/52814)...
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 7 bytes
```
ż*∑d?∑Ḋ
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCLilqE6xpsiLCLFvCriiJFkP+KIkeG4iiIsIjtaxpvDtyRgLCBgasO4QlwiYCA8PSBgajvigYsiLCJbMSwgMF1cblszLCAxLCA1LCA3XVxuWzYsIDMsIDFdXG5bMTAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCAwLCA1XVxuWzEwLCA0LCAzLCAwLCAyLCAwLCA1XVxuWzEsIDIsIDMsIDQsIDUsIDYsIDcsIDgsIDksIDEwXVxuWzcsIDcsIDcsIDddXG5bMSwgMl1cblszLCA2LCA1LCAxLCAxMl1cblswLCAwLCAyLCAwLCAxLCAwXVxuWzEsIDIsIDMsIDQsIDUsIDYsIDcsIDgsIDldXG5bNiwgMywgMiwgNCwgMCwgMSwgMiwgM11cbls0LCAwLCAwLCAyLCAzLCA1LCAyLCAwLCAxLCAyLCAzLCAwLCAwLCAxLCAyLCA0LCAzLCAxLCAzLCAwLCAwLCAyXVxuWzEwMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgMCwgNV0iXQ==)
## How?
```
ż*∑d?∑Ḋ
ż*      # Multiply each by its 1-based index
  ∑     # Sum this
   d    # Double
      Ḋ # Is it divisible by...
    ?∑  # ...the sum of the input?
```
[Answer]
# [Haskell](https://www.haskell.org/), 39 bytes
```
f l=2*sum(zipWith(*)l[0..])`mod`sum l<1
```
[Try it online!](https://tio.run/##rVDLDoIwELz7FXME0pC2vDSRT/DsgZBAogRiQSJ48edxKQEqiSdteujMdnZntsy721WpYSigYul0z9p6Ve256kvLsVXCXTe1s/p@yagCdRRDnVcNYtR5e4LVPqqmh4vC3oFOgkQw8FQDhsRjIBwwRAsVMozsggXnpPjhBkYrBl@3p4fcFjXl6R9kiGxEDHuGA5lZDUeajkzDo9AMFGo9sWKluTHyYwFfp272IfWPST0KlrI/x5zaBMYUOUdd4BReGLz8x56DFOnwBg "Haskell – Try It Online")
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), 15 bytes
```
0≡+⌿|(+⌿+⍨×⍳∘≢)
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wSDR50LtR/17K/RAJHaj3pXHJ7@qHfzo44ZjzoXaf7//6h3rkJIUWlJRqVCSWpxiUJyYnFqMRdXmoKhggGQNAbSpgrmQJYZiA0SNzBQIBaagtUrmAC1GigYwQSALGOgmCnQSHMFCwVLoBKgsDkEcnE96psKdLe6OpAFdJtbYk4xptOMwE4zA5phqGAI4hhALYC4GsMKqPuNgGIGEFmgiAlUlzFQnRFMHCxmCFYJ8juEb0SCv00B "APL (Dyalog Unicode) – Try It Online")
Looks very ungolfy to me...
[Answer]
# [Python 2](https://docs.python.org/2/), ~~78~~ 75 bytes
thanks to [Mr. Xcoder](https://codegolf.stackexchange.com/users/59487/mr-xcoder) for -3 bytes
```
lambda l:0in[sum(v*(i-y*2)for y,v in enumerate(l))for i in range(len(l)*2)]
```
[Try it online!](https://tio.run/##pZDBDoIwDIbvPEWPYGoypoia@CTIASPoEhgGBwlPj20RRRNPJju039/1379b76611UNxOA5lVp3OGZR7ZWxybyu/W/hm2S90UNQN9NiBsZDbtsqbzOV@GQg3TJvMXojklijNpwMrjpUkRFApQrJCoDJCiLnbIDDgMlSKRv440bgFYS1LqdAzLt1KRDIn3xhhi7Ajd3lXLIRPuvcAbo2xDgrfBZ6U3kcS/UyykWUEQiFq5jrl/Wn8jq9FHO/wLCvrKdV4OZqt1VO8VzsGDmdc//mj0dcnDA8 "Python 2 – Try It Online")
[Answer]
# [Julia 0.6](http://julialang.org/), 25 bytes
```
~=sum
!x=~cumsum(2x)%~x<1
```
[Try it online!](https://tio.run/##pVHLCsIwEDwnX7EKQgt7aKJpFdTvEKQH8QGVtopayEH663GzsSUXT0IOs7Ovmey1q6tD7ly/eXaNnNhNf@wagom26ay3a@UutwfsoGohSaTYK4SsRAJzBMIGoeAwR/AMY5VlVPXHM98xCAseS0DHCQ7nnCUBtLpAWCKsSEAQVzDlXylT/OrWg@6c24hRgcqiDaO/n0siu5qzocsXc2oxuAjtJpqsBzdjGPypiNf/fqEhy6kU/mzWn20nhZhYeG/h/qjaV91KcW5PUorpNCaJcx8 "Julia 0.6 – Try It Online")
[Answer]
# [PHP](https://php.net/), 139 128 bytes
```
<?php $a=explode(',',fgets(STDIN));for($i=0;$i<count($a)-.5;$i+=.5){$z=0;foreach($a as $k=>$v)$z+=($k-$i)*$v;if($z==0)die(1);}?>
```
[Try it online!](https://tio.run/##DcpNDoIwEEDhq8xiEjoyEFDxJ6WwcePGjV6AQJEGI40gMRjPXrt8@Z7trHN5aTsLWCn9sY@h0SLggNu7nkZxvZ3OFyLZDi@BRiUSTV4P7@cksKIoznyHKs7oi4tHf@mq7rxBNQL2qsCZcAmVwD5CQyucpWmFf1VCjdEiJfkrC@dShjXDhmHLkDHsGPYMB4YjQ5r8AQ "PHP – Try It Online")
* -2 bytes for removing quotes around `die` thanks to manassehkatz
* -9 bytes thanks to [Learning the community standard](https://codegolf.meta.stackexchange.com/a/5330/72477)
[Answer]
# [Swift](https://swift.org), 76 bytes
```
{var i=0,t=0;print($0.reduce(0){$0+($1*i,t+=$1,i+=1).0}*2%t<1)}as([Int])->()
```
[Try it online!](https://tio.run/##pVAxDsIwDNx5hYciJdQgJ7QUBGHnDYgBQStFQhUqAQbE24ub0FIGJqQMvnN8vvPlbguX1KfcQQEG6sdtX4E1hM7Q8lzZ0omIJlV@vB5yQfIRUSwiNbLoYhMptLFRckLPkR66lZLP/UVsN6XbyfFayLoQW4VAOzngaorAIEXIAp4hNFQAiog//vHSVgch8cJc6K@Ox1PfZhO8PUOYIyzYw9th5rmsc9iMdN5nfowp9eaot@OT8ueafmjt22Gu@R16SZslCKQ9cd1G6mAIqXq8/vuSfKn6BQ)
[Answer]
# [Perl 5](https://www.perl.org/), 55 + 1 (`a`) = 56 bytes
```
$.=0;map$.+=$p++*$_,@F;$#F+($p=$i-=.5)&&$.&&redo;say!$.
```
[Try it online!](https://tio.run/##BcFBCoAgEAXQqxR9pDIHC1yJ0KpdZwihFkHlkG26fNN7vN2HEwEF68/IIB3AWrdYunHyqCZdgwN2E8g1SoGUurc1@RzfEiTSF8OX@NnTlcXMjmxvxcQf "Perl 5 – Try It Online")
]