| BioCode 2024 |
|---|
| Finished |
A Neural Network is a powerful Machine Learning technique that is inspired by the human brain. A Neural Network consists of several layers of nodes where information is passed through edges connecting the nodes.
More specifically, Akash is working with a Neural Network with $$$n$$$ layers, where the $$$i$$$-th layer has $$$a_i$$$ nodes. For every two adjacent layers, there is an edge connecting all pairs of nodes between one layer to the other layer. In other words, if two layers have $$$x$$$ and $$$y$$$ nodes, respectively, then a total of $$$x \cdot y$$$ edges will connect those layers.
Given the structure of his Neural Network, find the total number of edges needed to connect each pair of adjacent layers.
The first line of the input will contain $$$n$$$ ($$$1 \leq n \leq 1000$$$), the number of layers in the Neural Network.
The next line will contain the $$$n$$$ integers $$$a_1 \dots a_n$$$ ($$$1 \leq a_i \leq 1000$$$) representing the number of nodes in each layer.
Print a single integer, the total number of edges needed.
43 5 2 7
39
In the sample test case, a total of $$$39$$$ edges are needed.
So the total number of edges needed is $$$15 + 10 + 14 = 39$$$.
| Name |
|---|


