#P2561. Sum of Squares of Natural Numbers

    ID: 15830 Type: Default 1000ms 256MiB

Sum of Squares of Natural Numbers

Sum of Squares of Natural Numbers

Given a positive integer n, calculate the sum of the squares of all natural numbers from 1 to n.

You are required to compute the sum:

$$ S = \frac{n(n+1)(2n+1)}{6} $$

where n is a positive integer.

inputFormat

The input consists of a single line containing one positive integer n (1 ≤ n ≤ 105).

outputFormat

Output the value of S, which is the sum of the squares of the first n natural numbers.

sample

1
1