#P7540. Sum over Non-negative Integer Pairs

    ID: 20735 Type: Default 1000ms 256MiB

Sum over Non-negative Integer Pairs

Sum over Non-negative Integer Pairs

Given a non-negative integer N, consider all pairs of non-negative integers \((x, y)\) satisfying \(0 \leq x \leq y \leq N\). For each pair, compute the sum \(x+y\). Your task is to calculate the total sum over all valid pairs.

In other words, you need to compute:

[ S = \sum_{0 \leq x \leq y \leq N} (x+y) ]

Simplify the expression and output the result, which can be shown to be:

[ S = \frac{N(N+1)(N+2)}{2} ]

</p>

inputFormat

The input consists of a single non-negative integer N (where \(0 \leq N \leq 10^9\)).

outputFormat

Output a single integer representing the computed sum \(S\) over all valid pairs \((x,y)\).

sample

0
0