#C7279. Sum of Squares of Natural Numbers

    ID: 51132 Type: Default 1000ms 256MiB

Sum of Squares of Natural Numbers

Sum of Squares of Natural Numbers

Given a positive integer \(N\), compute the sum of the squares of the first \(N\) natural numbers. The mathematical formula for the sum is given by:

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

Your task is to read an integer from standard input, compute the value of \(S\) using the formula above, and write the result to standard output.

inputFormat

A single line containing one integer (N) where (1 \le N \le 10^7).

outputFormat

A single integer representing the sum of squares of the first (N) natural numbers.## sample

3
14