#K35672. Sum of Squares Sequence

    ID: 25584 Type: Default 1000ms 256MiB

Sum of Squares Sequence

Sum of Squares Sequence

You are given a positive integer n. Your task is to calculate the nth number in a sequence where each number is defined as the sum of the squares of the first n natural numbers. Formally, for a given n, you need to compute:

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

For example, when n = 3, the output is 14 because \(1^2 + 2^2 + 3^2 = 1 + 4 + 9 = 14\).

inputFormat

The input consists of a single line containing an integer n (1 ≤ n ≤ 106).

outputFormat

Output a single integer which is the nth term of the sequence, i.e. the sum of squares of the first n natural numbers.

## sample
1
1