Skip to content
UPEEC

Sum of Squares

Medium#math#formulas· solved by 0 · time limit 2.0 s

Print 12+22+⋯+n21^2 + 2^2 + \dots + n^2 modulo 109+710^9+7.

Input

A single integer nn.

Output

The sum modulo 1000000007.

Constraints

1≤n≤10181 \le n \le 10^{18} — careful with overflow: reduce modulo as you go (or use big integers).

Sample 1

Input

3

Output

14

Sample 2

Input

10

Output

385

Sign in or join free to run and submit your solution.