#C726. Sum of Product of All Unique Pairs

    ID: 51111 Type: Default 1000ms 256MiB

Sum of Product of All Unique Pairs

Sum of Product of All Unique Pairs

Given a positive integer \(n\), your task is to calculate the sum of the products of all unique pairs \((i, j)\) where \(1 \le i < j \le n\). In other words, compute the sum:

\(\displaystyle S = \sum_{1 \le i < j \le n} i \cdot j\)

For example, if \(n=3\), the unique pairs are \((1,2)\), \((1,3)\), and \((2,3)\) and the answer is \(1\times2 + 1\times3 + 2\times3 = 11\).

inputFormat

The input consists of a single integer \(n\) (where \(n \ge 1\)), provided via standard input.

outputFormat

Output a single integer which is the sum of the products of all unique pairs from \(1\) to \(n\), printed to standard output.

## sample
1
0

</p>