AT_abc405_c [ABC405C] Sum of Product

Description

You are given a length- $ N $ integer sequence $ A = (A_1, A_2, \dots, A_N) $ . Compute the value of $ \displaystyle \sum_{1\leq i< j\leq N} A_iA_j $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ A_1 $ $ A_2 $ $ \dots $ $ A_N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 We have $ \displaystyle \sum_{1\leq i< j\leq N} A_iA_j=A_1A_2+A_1A_3+A_2A_3=4\cdot 2+4\cdot 3+2\cdot 3=26 $ . ### Constraints - $ 2 \le N \le 3 \times 10^5 $ - $ 1 \le A_i \le 10^4 $ - All input values are integers.