#P2315. Sum of Squares
Sum of Squares
Sum of Squares
Given a positive integer n, compute the sum of squares of the first n natural numbers. In other words, calculate
\( S = \frac{n(n+1)(2n+1)}{6} \)
and output the result.
inputFormat
The input consists of a single line containing one integer n (1 ≤ n ≤ 105).
outputFormat
Output a single integer representing the sum of squares of the first n natural numbers.
sample
1
1