Sum of Pairwise Products

Given N integers, sum the products of every pair of distinct positions.

Easy3MathArrayPrefix sumImplementationInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

You are given NN integers. Consider every way to pick two distinct positions and multiply the two integers at those positions. Print the sum of all of those products.

For example, with N=3N = 3 and the integers 2, 3, 4, the ways to pick two numbers are (2, 3), (2, 4), and (3, 4), and the products are 6, 8, and 12. The total is 26.

The same value can appear more than once. Two picks at different positions count separately.

Input

The first line contains the number of integers NN (2N100,0002 \le N \le 100{,}000).

The second line contains NN integers separated by spaces. Each integer is at least 00 and at most 10,00010{,}000.

Output

Print the sum of the products over all of the picks on one line.