You are given N 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=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.