066. Neural Network Weight Count
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

As computers have become more and more powerful, the use of artificial intelligence has become ever more prominent in modern computing. As a result, a mechanism called a neural network has become a very commonly used tool for replicating the basic biological processes that result in the function of the brain. Neural Networks are composed of a series of "layers" of nodes, where each node of layer $$$i$$$ will connect with every node of layer $$$i+1$$$.

The structure of the network is not very important for the problem, and you do not need to know any more specifics about neural networks or their usage. Instead, you will need to calculate the total number of weights(connections between two nodes) in a given network. Weights can be seen in the image as the crossing lines between nodes. The input will provide the number of layers(including the input and output layers), as well as the number of nodes in each layer respectively.
Input

The first line contains a single integer $$$N$$$ that represents the number of layers. The next line contains $$$N$$$ space-separated integers that represent the number of nodes in each layer respectively.

Output

A single integer that represents the total number of weights in the network.

Example
Input
3
5 10 5
Output
100