#C10317. Sum of Squares

    ID: 39509 Type: Default 1000ms 256MiB

Sum of Squares

Sum of Squares

Given a non-negative integer \(N\), your task is to compute the sum of squares of the first \(N\) natural numbers. In mathematical terms, you need to calculate:

\( S = \sum_{i=1}^{N} i^2 = \frac{N(N+1)(2N+1)}{6} \)

For example, if \(N = 3\), then \(S = 1^2 + 2^2 + 3^2 = 14\). Ensure your program can handle edge cases such as \(N = 0\).

inputFormat

The input consists of a single integer \(N\) (where \(0 \leq N \leq 10^5\)) provided via standard input (stdin).

outputFormat

Output a single integer which is the sum of the squares of the first \(N\) natural numbers. The result should be written to standard output (stdout).

## sample
3
14