# JavaScript (ES6), 35 bytes Expects an array of prices. <!-- language-all: lang-javascript --> 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")