[Question]
  [
# Introduction
I have decided that this Christmas, as a "present" to a friend, I wish to purchase the things described in the classic song "The 12 Days of Christmas". The only problem is, I don't know how to calculate the total price!
# Your Task
Given a list of prices (in order from first to last), calculate the total price of all the items if they were ordered as described by the song.
Remember, each item is ordered once more than the one before it, and this repeats for as many days as there are items!
## Example
The first few lines of the song:
> 
> On the 1st day of Christmas, my true love gave to me  
> 
> A partridge in a pear tree
> 
> 
> On the 2nd day of Christmas, my true love gave to me  
> 
> Two turtle doves,  
> 
> And a partridge in a pear tree.
> 
> 
> On the 3rd day of Christmas, my true love gave to me  
> 
> Three French hens,  
> 
> Two turtle doves,  
> 
> And a partridge in a pear tree.
> 
> 
> \$\vdots\$
> 
> 
> 
The song then continues, each day adding in a new present, with the number increasing each time (e.g. "4 calling birds", "5 gold rings", etc.). up to a total of 12 days.
Therefore, the total number of each item as the song continues for 12 days goes: 1 partridge on day 1, 2 partridges and 2 doves on day 2, 3 partridges, 4 doves, and 3 French hens on day 3, etc.
# Rules and Scoring
Your program should take as input a list of prices (which can be of any length), and calculate the total price in the manner described above. Programs which give me the wrong answer for their inputs will be disqualified. Shortest size in bytes wins!
# Examples
```
[20, 20, 20]: 200
[25, 10]: 70
[10, 25, 10, 75]: 550
```
# Example price table
Feel free to use this table to test your program. The correct output should be 51765.02.
| Item | Price |
| --- | --- |
| A partridge in a pear tree | 27.50 |
| A turtle dove | 25.00 |
| One French hen | 5.00 |
| One calling bird | 70.00 |
| A gold ring | 65.00 |
| One goose a-laying | 25.00 |
| One swimming swan | 500.00 |
| A milkmaid hired for 1hr | 4.25 |
| One lady dancing | 289.65 |
| One lord leaping | 318.26 |
| One piper piping | 100.83 |
| One drummer drumming | 100.13 |
Or, as a single list of prices:
```
[27.50, 25.00, 5.00, 70.00, 65.00, 25.00, 500.00, 4.25, 289.65, 318.26, 100.83, 100.13]
```
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~4~~ 3 bytes
```
Œ˜O
```
[Try it online!](https://tio.run/##yy9OTMpM/f//6KTTc/z//482MtczNdBRMDLVMwBSENLcAEyZQXgwKQOIqImekSlQ0MJSzwxIGxta6BmZ6SgYAmUtjCG0oXEsAA "05AB1E – Try It Online")
sublists, flatten, sum.
I actually found this approach as I was trying writing an APL solution which ended up being almost identical to [my answer](https://codegolf.stackexchange.com/questions/237700/even-sum-subarrays/237720#237720) for even-sum-subarrays.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~5~~ 4 bytes
```
JƤSḋ
```
[Try it online!](https://tio.run/##y0rNyan8/9/r2JLghzu6////b2SuZ2qgo2BkqmcApCCkuQGYMoPwYFIGEFETPSNToKCFpZ4ZkDY2tNAzMtNRMATKWhhDaENjAA "Jelly – Try It Online")
-1 byte thanks to [pxeger](https://codegolf.stackexchange.com/users/97857/pxeger)!
Ignores the strings as input, just takes a list of 12 prices
## How it works
Basically, the number of each item is given as
```
Day  1:  1
Day  2:  1  2
Day  3:  1  2  3
Day  4:  1  2  3  4
...
Day 12:  1  2  3  4  5  6  7  8  9 10 11 12
Total : 12 22 30 36 40 42 42 40 36 30 22 12
```
Which is just the prefixes of the range `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]`, summed down the columns. We then multiply each price by the quantity and take the total
```
JƤSḋ - Main link. Takes a list of 12 prices P on the left
 Ƥ   - Over the prefixes of P:
J    -   Convert to a length range
  S  - Sums of the columns
   ḋ - Dot product with P
```
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
ẆFS
```
[Try it online!](https://tio.run/##y0rNyan8///hrja34P///xuZ65ka6CgYmeoZACkIaW4ApswgPJiUAUTURM/IFChoYalnBqSNDS30jMx0FAyBshbGENrQGAA "Jelly – Try It Online")
A port of [ovs' answer](https://codegolf.stackexchange.com/a/237977/66833) - sublists, flatten, sum
[Answer]
# JavaScript (ES6), 35 bytes
Expects an array of prices.
```
a=>a.map(v=>t+=p+=v*++i,i=t=p=0)&&t
```
[Try it online!](https://tio.run/##XY1BDoIwEEX3noIVaS1O2kILLoaLGBcNgoEgbaTh@nVi48bNvMx/fzKLO9w@vOcQL5t/jGnC5LB38HKBHdhHgUHgcRZirmaMGFDysoxp8Nvu1xFW/2QTu@kWjKwKbUAS8mzlFzZvPyVz2oA2FHZXsMRadaBtVSiyXZ2p6jvnp78/DXXpjBok0wc "JavaScript (Node.js) – Try It Online")
[Answer]
# [Julia 1.0](http://julialang.org/), 26 bytes
```
!x=sum(cumsum(x.*keys(x)))
```
[Try it online!](https://tio.run/##NclLCoAgGATgq9ROI3585KNFJ4kWES0sk6gEO71Z0mY@Zmbx1ow0xFiG7vQbmvz2EqBa5/tEAWMc98O4yzpU9kyBIHXBBJBETkU@ZG7/RfLaABNp1C3IJKcamKwLml7Ns5QPOD4 "Julia 1.0 – Try It Online")
[Answer]
# Excel, ~~52~~ ~~69~~ 59 bytes
Saved 10 bytes thanks to [MarcMush](https://codegolf.stackexchange.com/questions/237965/total-cost-of-the-12-days-of-christmas/238050?noredirect=1#comment539902_238050) pointing out how Excel interprets empty cells when doing math.
```
=SUM(LET(n,COUNT(A:A)+1,s,SEQUENCE(n),IFNA(A:A*s*(n-s),0)))
```
Input is in the range `A:A`.
* `LET(n,COUNT(A:A)+1` defines `n` to be one more than the number of cells in the range `A:A` that are a number. Why we need it to be one *more* will be clear later.
* `LET(~,s,SEQUENCE(n)` defines `s` to be a vertical array of numbers 1 to the value of `n` we just defined. This is a list of how many of each gift is given at a time. 1 partridge, 2 doves, 3 hens, etc. (Lots of birds...)
* `(n-s)` is best explained with an example. If there are 12 entries, this is `(13-[1-13])` which becomes `([12-0])` which is how many days each gift is given. IE, the first gift is given on all 12 days and the 13th gift is given on 0 days because the list isn't that long.
* `A:A*s*(n-s)`, then, is `(Value of each gift) * (number of times that gift is given on each day) * (number of days a gift is given)` which is, therefore, a list of the total value of each gift item over all the days.
* `IFNA(~,0)` accounts for the fact that the calculation above fails when the cell is empty because a number times an empty string is an error for Excel. This turns those errors into zeros.
* `SUM(LET(~,IFNA(~)))` sums up all the values.
The screenshot below shows the last three steps in columns `C:E`.
[![LastSteps](https://i.stack.imgur.com/LHM32.png)](https://i.stack.imgur.com/LHM32.png)
[Answer]
# [R](https://www.r-project.org/), 33 bytes
Or **[R](https://www.r-project.org/)>=4.1, 26 bytes** by replacing the word `function` with `\`.
```
function(p)(rev(n<-seq(p))*n)%*%p
```
[Try it online!](https://tio.run/##NYlJCoAwEATvvsKLMCM6ZDExir5GDHiJu9@Pg8FLF111RD9Gf4fpWtYAG8IxPxCG@px3flgGLMpiix4mUC0ZUeXKkGCkbcUHm96fRLINKcPSdWSZWjpStsolV6cTpUbMPDS9xPgC "R – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 4 bytes
```
ss.:
```
[Try it online!](https://tio.run/##K6gsyfj/v7hYz@r//2gjcz1TAx0FI1M9AyAFIc0NwJQZhAeTMoCImugZmQIFLSz1zIC0saGFnpGZjoIhUNbCGEIbGscCAA "Pyth – Try It Online")
[15 bytes](https://tio.run/##K6gsyfj/3ydXyy3FOam4Uqcy3ik45///aCNzPVMDHQUjUz0DIAUhzQ3AlBmEB5MygIia6BmZAgUtLPXMgLSxoYWekZmOgiFQ1sIYQhsaxwIA "Pyth - Try It Online") (ungolfed) to avoid floating point precision errors.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~36~~ 30 bytes
```
->g{r=w=0;g.sum{|x|r+=x*w+=1}}
```
[Try it online!](https://tio.run/##LYlBDkAwEEWvYs2YTKdaFRkXERsLVhKpCIKzF43Nez/v@7U/wiAhb8bTyyZUj7is03ntl89kT7dM1H2HORnalks0BGyQCCJK@mjj/jPFVCAbYFehNaCVQ7ag3sfpKKW7Ljw "Ruby – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 5 bytes
```
żḂ*Þ•
```
[Try It Online!](https://vyxapedia.hyper-neutrino.xyz/tio#WyIiLCLFvOG4girDnuKAoiIsIiIsIiIsIlsyNy41MCwgMjUuMDAsIDUuMDAsIDcwLjAwLCA2NS4wMCwgMjUuMDAsIDUwMC4wMCwgNC4yNSwgMjg5LjY1LCAzMTguMjYsIDEwMC44MywgMTAwLjEzXSJd)
Vyxal is able to do the times-reverse thing more efficiently than Jelly (because you need the `$` for chaining in Jelly, and Vyxal has a bifurcate command), but unfortunately it does not have 1-byte dot product like Jelly does, so the byte save gets canceled out.
Unfortunately (for me), caird+pxeger have found a 4-byter. I mean, I could pretty trivially get one by cheating:
# [Vyxal](https://github.com/Vyxal/Vyxal) `s`, 4 bytes
```
żḂ**
```
[Try It Online!](https://vyxapedia.hyper-neutrino.xyz/tio#WyIiLCLFvOG4gioqIiwiIiwicyIsIlsyNy41MCwgMjUuMDAsIDUuMDAsIDcwLjAwLCA2NS4wMCwgMjUuMDAsIDUwMC4wMCwgNC4yNSwgMjg5LjY1LCAzMTguMjYsIDEwMC44MywgMTAwLjEzXSJd)
but I'll try to figure something out.
# [Vyxal](https://github.com/Vyxal/Vyxal), 4 bytes
```
ÞSf∑
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLDnlNm4oiRIiwiIiwiWzI3LjUwLCAyNS4wMCwgNS4wMCwgNzAuMDAsIDY1LjAwLCAyNS4wMCwgNTAwLjAwLCA0LjI1LCAyODkuNjUsIDMxOC4yNiwgMTAwLjgzLCAxMDAuMTNdIl0=)
4 bytes by porting the same solution (ovs's) that everyone else is. Thanks to lyxal for finding this.
# [Vyxal](https://github.com/Vyxal/Vyxal) `d`, 2 bytes
```
ÞS
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJkIiwiIiwiw55TIiwiIiwiWzI3LjUwLCAyNS4wMCwgNS4wMCwgNzAuMDAsIDY1LjAwLCAyNS4wMCwgNTAwLjAwLCA0LjI1LCAyODkuNjUsIDMxOC4yNiwgMTAwLjgzLCAxMDAuMTNdIl0=)
Flag abuse for the win. Credit to Aaroneous Miller.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jellylanguage), 4 bytes
```
ḋƤJS
```
[Try It Online!](https://jht.hyper-neutrino.xyz/tio#WyIiLCLhuIvGpEpTIiwiIiwiIixbIjI3LjUwLCAyNS4wMCwgNS4wMCwgNzAuMDAsIDY1LjAwLCAyNS4wMCwgNTAwLjAwLCA0LjI1LCAyODkuNjUsIDMxOC4yNiwgMTAwLjgzLCAxMDAuMTMiXV0=)
-1 byte thanks to caird coinheringaahing
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~54~~ 53 bytes
```
d;f(x,n)float*x;{for(*x*=d=n;--d;)*x+=~d*(d-n)*x[d];}
```
[Try it online!](https://tio.run/##ZVHbboMwDH3fV1hIlQIFxmX0soztYdpXtGhiSejQulARpKFV7NPHHG5FHRJ24mP7HDvMOTDWtpxmpLalmR2LtLJqes6Kkli1FfNYUsfh1LTqZfzDLcIdiecdT2jT5rKCzzSXxITzDeDXlUMlVLVLIIZzsHYjz4Ygcj10vV17nVv1txHy@uidG0QY3GzdFfrQ37jBygYf0U3Yez9saMelyTXTq@y5/GAAehGiPglWCd6Dkb/WhGMKK6SqgL2npYVWsA9R9nnGvn4J9vX2Gf/IsGF@D42RoCiBaPpcclFjmUeH4wOo/FsUGRnZzdshYE0RCstllz0ubRxGYqdhoA5P6ASfSkzIiLEzzEvwImOQgPSy6z7vPC9fqIUbZDhW/qRnuzfQdo@VJ7O@zYWBaNQGOWfttquQ0tLgNSAQmFZ/PYYWe0qVLs7SN0UEOKBMlO0LZ/t/2gScR9CKYaH2ErUqe3ot3WYU3dw07S/LjulBtc7XHw "C (gcc) – Try It Online")
*Saved a bytes thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!!*
Inputs the list of prices as a pointer to an array along with its length (because pointers in C carry no length info).  
Returns the total cost in the first element of the array.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 3 bytes
```
ΣΣQ
```
[Try it online!](https://tio.run/##yygtzv7//9zic4sD////H21krmdqoGNkqmdgoAMmzA1ApBmYDRU2AAuZ6BmZ6hhZWOqZmeoYG1roGZnpGAJlLIzBlKFxLAA "Husk – Try It Online")
Uninventive port of [ovs's O5AB1E answer](https://codegolf.stackexchange.com/a/237977/95126): upvote that one instead.
[Answer]
# APL+WIN, 16 bytes
Prompts for prices.
```
+/(n×⌽n←⍳⍴v)×v←⎕
```
[Try it online! Thanks to Dyalog Classic.](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcQJanP5BlyPWooz3tv7a@Rt7h6Y969uYBxR71bn7Uu6VM8/D0MhCvb@p/oBqu/2lcRuZ6pgpGpgqmCuYGCmYQpoGBgokekGFkYakHFDI2tNAzMlMwNDDQszAGU4bGAA "APL (Dyalog Classic) – Try It Online")
[Answer]
# x86 32-bit machine code, 23 bytes
```
d9 ee 31 c0 dd 04 c2 40 50 0f af c1 50 da 0c 24 de c1 58 58 e2 ee c3
```
Following the `fastcall` calling convention, takes the length in ECX and the address of an array of double-precision floating-point numbers in EDX, and returns the result on the FPU register stack.
[Try it online!](https://tio.run/##fVJdT4MwFH3vr7jBmAAyZLAPdM6nPZqoi4kP20JKKYykUELBzC3762KBjQ0f7MO9nNNTzr23JYOIkKq6iVPCyoDCkyiCmJvbZ9SjWOzXHPI8XBR57JcF9TxVDbEoCGZM04DxNIKAlz6jEOBvQbgo1DgtIDXOtI61GcIiARUp69SMGPcx68RKTZ7BY4NArpAF@w7seA4U74w6NGROM4r7anj/fF0u4O1jCSsa7O5cXYo3nUJ21Z2ucVaKbY@Ik5KdTMg/srDRLa68RHZxCXEQZJfDPOt7/sGMS6JtpeNyKr/lvFA9wwTHaTNMnEfEALLFOei6BF8aOqBafhpxPTux2sAcDvbUHFsG2GPTkqmNU6tJkxadt6yWHZn2WJLugzmR2Rm6pj0xYCh3XafNQ@c4a9yyXBYTqsqtaY9ewnWqGJc7F/Ge8lBtKtHur9HK2mhGW6KmtT@SXZZ5CtYMHVFV/ZCQ4UhUg8SxZZBPZS59KPsF)
Assembly:
```
.text
.global dayscost
.intel_syntax noprefix
dayscost:
    fldz                         # Push 0 onto the FPU register stack, for a running total.
    xor eax, eax                 # EAX = 0, for the current day number.
repeat:
    fld QWORD PTR [edx+8*eax]    # Push the new item's price onto the FPU register stack.
    inc eax                      # Add 1 to EAX. It is now the 1-indexed day number.
    push eax                     # Push EAX onto the regular stack.
    imul eax, ecx                # Multiply EAX by the number of remaining days.
    push eax                     # Push the product onto the regular stack.
    fimul DWORD PTR [esp]        # Multiply the price by that product.
    faddp                        # Add the full product to the running total.
    pop eax                      # Pop the product from the regular stack.
    pop eax                      # Pop to restore the day number in EAX.
    loop repeat                  # Repeat, counting down the number of remaining days in ECX.
    ret                          # Return.
```
[Answer]
# [Perl 5](https://www.perl.org/) + `-p`, 15 bytes
Using the insight from [@Arnauld's answer](https://codegolf.stackexchange.com/a/237971/9365).
```
$\+=$x+=$_*$.}{
```
[Try it online!](https://tio.run/##K0gtyjH9/18lRttWpQKI47VU9Gqr//83MtczNeAyMtUzMOACE@YGINIMzIYKG4CFTPSMTLmMLCz1zEy5jA0t9IzMuAyBMhbGYMrQ@F9@QUlmfl7xf90CAA "Perl 5 – Try It Online")
---
# [Perl 5](https://www.perl.org/) + `-pa`, 26 bytes
```
$\+=(@F-$-++)*$_*$-for@F}{
```
[Try it online!](https://tio.run/##K0gtyjH9/18lRttWw8FNV0VXW1tTSyVeS0U3Lb/Iwa22@v9/I3M9UwMFI1M9AwMFMGFuACLNwGyosAFYyETPyFTByMJSz8xUwdjQQs/ITMEQKGNhDKYMjf/lF5Rk5ucV/9ctSAQA "Perl 5 – Try It Online")
[Answer]
# Fortran, 116 bytes
[Try it Online.](https://tio.run/##LYlBDoMgAATvvIKbYCkBLGolHngKLdhoCDTo/ylSL7uTmSWmI5lw/yx/yDk544nxPr7NYV7eTZNGEya7KsG2JICrOaRRwPjSGtgI15mToApsBVa1z/tNow23G3DB2qjqgm9aw9GghVGBG7KfLWcugBioZFBIyhisM7Bz@8qXZlU9qJBQjE/aS9jxkYoe8lLGrh7vfg)
```
real,allocatable::A(:),s;read*,n
allocate(A(n));read*,A
do i=1,n;do j=1,i;s=s+A(j)*j
enddo;enddo
print'(f0.2)',s
end
```
Another demo of our old friend, Fortran (emphasis on old). Elegance, simplicity and flexibility are not words that spring to mind. The requirement to allow `n` inputs forced me to write those chunky `allocate` statements.
[Answer]
# Python 3, ~~69~~ ~~64~~ ~~61~~ 55 bytes
Takes a list of floats as input.
```
lambda l:sum(o*-~c*(len(l)-c)for c,o in enumerate(l))
```
[Try it here!](https://tio.run/##JYpLDsIgFADX3uKlq/dqS/jYj17FuKgVIgkFQmHh6bHR1UwmEz/5HbyqL23AoKNbPSWdS/Kwlw3vxoUlY6B2bZfnjmuPTvtjOwsiMCHB2gWwHrQvm05L1ug6QQ@qMVmf0aD1sWQktkdnMzbQEFGVExtADjDAxGH8K@dwYYfI@cqOpMTM5AiCczarH4T6Ag)
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 27 bytes
```
a->Pol((x*Ser(a))'/y=1-x)%y
```
[Try it online!](https://tio.run/##K0gsytRNL/ifpmD7P1HXLiA/R0OjQis4tUgjUVNTXb/S1lC3QlO18n9BUWZeiUaaRrSRuZ6pgY6CkameAZCCkOYGYMoMwoNJGUBETfSMTIGCFpZ6ZkDa2NBCz8hMR8EQKGthDKENjWM1Nf8DAA "Pari/GP – Try It Online")
See the input as a polynomial \$A=\sum\_{i=0}^{n-1}a\_ix^i\$. The derivative of \$A\ x\$ is \$(A\ x)'=\sum\_{i=0}^{n-1}(i+1)\ a\_ix^i\$. So \$(A\ x)'/(1-x)=\sum\_{i=0}^{n-1}(\sum\_{j=0}^{i}(j+1)\ a\_j)x^i+O(x^n)\$. Then we only need to take the first \$n\$ terms and evaluate it at \$x=1\$.
[Answer]
# [SimpleTemplate](https://github.com/ismael-miguel/SimpleTemplate) 0.84, 86 bytes
This full program expects a variable number of arguments passed to the `render()` method. [Argument unpacking](https://www.php.net/manual/en/functions.arguments.php#example-159) can be used for convenience. Each argument is 1 gift.
```
{@eachargv}{@inc__}{@set*__ __,argc}{@set*_ __,_}{@incby_ T}{@incby-1argc}{@/}{@echoT}
```
The result is displayed on standard output, by default.
This works the same way as [@caird coinheringaahing](https://codegolf.stackexchange.com/users/66833/caird-coinheringaahing) [answer in Jelly](https://codegolf.stackexchange.com/questions/237965/total-cost-of-the-12-days-of-christmas/237968#237968).  
However, everything is done manually, to obtain the `Total` row on the table.
---
## Ungolfed:
The code above looks like gibberish, so, bellow is an ungolfed version of it:
```
{@set total 0}
{@each argv as value key key}
    {@inc by 1 key}
    
    {@set* key key, argc}
    {@set* value key, value}
    
    {@inc by value total}
    {@inc by -1 argc}
{@/}
{@echo total}
```
Yeah ... It still looks like gibberish...
---
## About the language:
There are a few important things to notice here:
* Plenty of whitespace isn't mandatory.  
`{@eachargv}` and `{@each argv}` do the same.
* The line `{@set total 0}` isn't golfed to `{setT 0}`: it was removed because the `{@incby_ T}` will define the variable `T`.
* The line `{@each argv as value key key}` is golfed into `{@eachargv}`.  
By default, the `{@each}` loop uses the variable `_` for the value and `__` for the key, if none were provided.  
This allows skipping all the "fluff" after `argv`.
* `{@inc by 1 key}` and `{@inc__}` increment the `key` (or `__`) variable by 1.
Due to rubbish math support, this has to be done.
* `{@set*__ __,argc}` and `{@set* key key, argc}` both multiply the `key` variable by `argc`.  
The variable `argc` contains the length of the `argv` variable.  
This will calculate the number of times that the current gift was gifted on all 12 days.  
This should be `1 * 12`, `2 * 11`, `3 * 10` ... (`(key + 1) * argc`).
* `{@set*_ __,_}` and `{@set* value key, value}` will multiply the `key` variable by the `value`, and save it into the `value` variable.
* `{@incby_ T}` and `{@inc by value total}` will increment the `total` by the `value` calculated before.
* `{@incby-1argc}` and `{@inc by -1 argc}` will decrement the `argc` variable by 1.  
This variable, initially, has the length of the `argv` array.  
At the end, the value will be `0`.
* `{@echoT}` and `{@echo total}` will display the total.
Yeah ... Very confusing...
---
## Running the code:
You can run the code on: <http://sandbox.onlinephpfunctions.com/code/b775fddea1ae9c869962f893ac915c8087cb779a>
Please pick a version between 5.6 and 7.4.13. Can't fix the 8.0.0 compatibility issue without invalidating this answer.
[Answer]
# IBM/Lotus Notes Formula Language, 102 bytes
```
Z:=L:=@Elements(i);T:=0;C:=1;@For(X:=1;X<=L;X:=X+1;@Set("T";T+i[X]*Z*C);@Set("Z";Z-1);@Set("C";C+1));T
```
There is no online interpreter for Notes so here is a screenshot of the expected output:
[![enter image description here](https://i.stack.imgur.com/QbWCZ.png)](https://i.stack.imgur.com/QbWCZ.png)
After more years than I can remember working with Lotus Notes and several posts on here, this will probably be my last Formula Language post as our company has just decommissioned the last Notes application that I was responsible for and my designer client will most likely soon be removed.
The end of an era. RIP, LN.
[Answer]
# TI-Basic, 9 bytes
```
sum(cumSum(AnscumSum(1 or Ans
```
Takes input in `Ans`. Output is stored in `Ans` and displayed. Does not work for empty lists as TI-Basic does not support them.
[Answer]
# Zsh, 65 bytes
[Try It Online.](https://tio.run/##LYnBDsIgEETvfMUmYsJqsoGtUDyQ2O8wXolw0KZ4suHb0ZJeZua9@ZZniwpXUUKbgpI3FPG9QAK1GiJ5qLhh3jFVVKqcw3TPj1NGFPOSXp8IR@IIsrQqIvBIVgNb0hp6jHpL1/eudVcXYgvsr@QsDMYTOzD/xw@9zNB@)
```
A=($@)
for i ({1..$#})for j ({1..$i})((s+=A[j]*j))
printf %.2f $s
```
Had to use `printf` to fix the output - Zsh arithmetic gives a funky result of `51765.019999999982` otherwise
[Answer]
# [convey](http://xn--wxa.land/convey/), 33 bytes
Dude, i love convey
```
v<-1
12"0<
{**+@}
1">>^
^"=12
^+1
```
[Try it online!](https://xn--wxa.land/convey/run.html#eyJjIjoidjwtMVxuMTJcIjA8XG57KiorQH1cbjFcIj4+XlxuXlwiPTEyXG5eKzEiLCJ2IjoxLCJpIjoiWzI3LjUwLCAyNS4wMCwgNS4wMCwgNzAuMDAsIDY1LjAwLCAyNS4wMCwgNTAwLjAwLCA0LjI1LCAyODkuNjUsIDMxOC4yNiwgMTAwLjgzLCAxMDAuMTNdIn0=)
The start of the process:
[![enter image description here](https://i.stack.imgur.com/lDmpY.gif)](https://i.stack.imgur.com/lDmpY.gif)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 13 bytes
```
ＩΣＥθ×ι×⊕κ⁻Ｌθκ
```
[Try it online!](https://tio.run/##NYnBCsMgEER/xeMGrKhpjKHHngoNFNpbyEGsNJLENsb0961UMod5u2/0oLx@qynGm7cuwFmtAe7bDK36wILRw85mBbsfF6e9mY0L5gljgVFr3bbC1bhXGGBJYixyTjF2Ha9JRTHiFaEJuWv6h8jfPtFsj4RXScqGiMSSScIFRiytssxkZd/Hw3f6AQ "Charcoal – Try It Online") Link is to verbose version of code. Explanation: Port of my golf to @GingerIndustries' Python answer.
```
   θ            Input list
  Ｅ             Map over prices
     ι          Current price
    ×           Multiplied by
        κ       Current index
       ⊕        Incremented
      ×         Multiplied by
           θ    Input list
          Ｌ     Length
         ⁻      Minus
            κ   Current index
 Σ              Take the sum
Ｉ               Cast to string
                Implicitly print
```
[Answer]
# [Rust](https://www.rust-lang.org/) 137 Bytes
```
fn r(v: Vec<f64>)->f64{let mut c=0.;let k=v.len()as f64;let s=v.iter().map(|x|{c+=1.;x*c*(k-c+1.)}).collect::<Vec<f64>>();s.iter().sum()}
```
[Try it out!](https://tio.run/##NY7BroJADEX3fkV1NVVsZkCQB8JnuHl5CzIZE@LAM8xgTJBvxyKhi57ce9u0Xe/8NN1a6MQzg6vRl1tyKvFYMgZrPDS9B11IymdxL55kTSuwcsADX8@xV3vTCaSmeoj36z3oQ6Eof@31XtyP@qAIRyT9b63RPssu65VSYO7WXdc3Asf5k6aq@QIMG@B6dHXrbbsVu2HcBfOXRm9/wzPFMoAwJslY@ll@kSxqjeTiniiM2Ux/KGFGKqUwCUBxmkYLVfSHuBmnDw)
[Answer]
# Python 3, ~~145~~ 137 bytes
```
p=list(map(eval,input().split()))
n=len(p)
d=1
t=0
for x in range(12):
 t=t+p[d-1]*d*(12-(d-1))
 d+=1
print(t)
```
[Try it online!](https://tio.run/##LYvLCsIwFET3@Yq7TKoNediHQr5EXBRSNRDTS3sV/foYg5szwxkGP3Rfks0ZXQwb8ceEfH5NcR8SPokLuWEMJYVgycU5cRTMO83IKXZdVnhDSLBO6TZzbcSJATna4dm3@tL4priWl17e4HflhmtIxEnkbAbZKTCdVAoqBvVjX/tfq6oO0nRgxqPsO7B6lKYHXZbR1tA2fwE)
[Answer]
# [Python 2](https://docs.python.org/2/), 64 bytes
```
i=input()
t,c,l=0,1,len(i)
for x in i:t+=x*l*c;l-=1;c+=1
print t
```
[Try it online!](https://tio.run/##NYnNCgIhFEb3PsVdzo@JV9OxBp8kWkmRII4MN5ie3iRp8x2@c8qHXltWtUYfc3nTMDLigScvOfL0yEMc2XPb4YCYIV5p9seUprCmk8c1zB5Z2WMmoFpvahFGclBGyIa@i/zB9vdPstuzUKZJdxG2UaMTynLAVp3uRH3/Ag "Python 2 – Try It Online")
Python 2 because it will directly take the list as input and saves 1 byte by not needing the brackets for `print`.
[Answer]
# [Scratch](https://scratch.mit.edu/), 223 bytes
[Try it online!](https://scratch.mit.edu/projects/608676129/)  
Alternatively, 23 blocks
```
when gf clicked
delete all of[S v
repeat until<(answer)=[F
add(answer)to[S v
ask[]and wait
end
set[I v]to[-1
set[T v]to[
repeat(length of[S v
change[I v]by(1
repeat((length of[S v])-(I
change[T v]by((I)*(item((I)+(1))of[S v
```
## Explanation
```
when gf clicked         Initiates code
delete all of[S v        Clears the "Shopping" list
repeat until<(answer)=[F  Loops code until the user inputs "F"
add(answer)to[S v          Adds user's input to the "Shopping" list
ask[]and wait               Prompts the user to give input
end                           Marks the end of code to be looped
set[I v]to[-1                   Resets the Item being accounted for
set[T v]to[                       Resets the Total cost of the items
repeat(length of[S v                Loops code for each item on the list
change[I v]by(1                       Increments the Item to be checked
repeat((length of[S v])-(I              Loops code for each day the item is purchased
change[T v]by((I)*(item((I)+(1))of[S v    Adds (item cost * quantity) to the total
```
[Answer]
# [APOL](https://esolangs.org/wiki/APOL), 63 bytes
```
v(1 s(i));v(2 []);f(⌬(¹) a(2 x(x(+(∈ 1) I(∋)) -(l(¹) ∈))));⊕(²)
```
[Answer]
# [Haskell](https://www.haskell.org/), 69 bytes
```
f x=sum$map sum[(map$uncurry(*))$zip x[1..n]|n<-[1..genericLength x]]
```
[Try it online!](https://tio.run/##NclNDsIgEAXgq7BgYU2dALU/JnbnsjdoWJCGtsSChNKkGu@OKHEz35v3ZrHe5bIEpe3DeXQTXkCnVh9GtLfrprEWFkX7Qwx4M8Pm3PNwzDL8UhbtPQUw/G2up2@apJFODZ00k5/RznnQQpnWOmU8HntWQ0lyxEogkXRr8qNK338iqT0DK2PZXKCKFrQBVuWIxrUpkrTg4QM "Haskell – Try It Online")
]