Sum of all pairwise products

Given n integers, compute the sum of x_a * x_b over all pairs with a < b.

Medium4MathPrefix sumArrayHash mapInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given nn integers x1,x2,,xnx_1, x_2, \dots, x_n. For every way of choosing two indices with a<ba < b, add up xaxbx_a x_b.

1a<bnxaxb\sum_{1 \le a < b \le n} x_a x_b

Input

The first line contains the integer nn. The integers x1,x2,,xnx_1, x_2, \dots, x_n follow, separated by spaces or line breaks.

1n1000001 \le n \le 100000, xi100|x_i| \le 100

Output

Print the sum of the products over all pairs on one line. The absolute value of the answer is at most 5×10135 \times 10^{13}.