Codeforces Round 462 (Div. 1)
D
A Creative Cutout
Codeforces
2900
原题
← CE →
翻译中…

Everything red frightens Nian the monster. So do red paper and... you, red on Codeforces, potential or real.

翻译中…

Big Banban has got a piece of paper with endless lattice points, where lattice points form squares with the same area. His most favorite closed shape is the circle because of its beauty and simplicity. Once he had obtained this piece of paper, he prepares it for paper-cutting.

翻译中…

image

翻译中…

He drew $*n*$ concentric circles on it and numbered these circles from $1$ to $*n*$ such that the center of each circle is the same lattice point and the radius of the $*k*$-th circle is image times the length of a lattice edge.

翻译中…

Define the degree of beauty of a lattice point as the summation of the indices of circles such that this lattice point is inside them, or on their bounds. Banban wanted to ask you the total degree of beauty of all the lattice points, but changed his mind.

翻译中…

Defining the total degree of beauty of all the lattice points on a piece of paper with $*n*$ circles as $*f*(*n*)$, you are asked to figure out image.

翻译中…

Input

翻译中…

The first line contains one integer $*m*$ $(1 ≤ *m* ≤ 10^{12})$.

翻译中…

Output

翻译中…

In the first line print one integer representing image.

翻译中…

Note

翻译中…

A piece of paper with $5$ circles is shown in the following.

翻译中…

image

翻译中…

There are $5$ types of lattice points where the degree of beauty of each red point is $1 + 2 + 3 + 4 + 5 = 15$, the degree of beauty of each orange point is $2 + 3 + 4 + 5 = 14$, the degree of beauty of each green point is $4 + 5 = 9$, the degree of beauty of each blue point is $5$ and the degree of beauty of each gray point is $0$. Therefore, $*f*(5) = 5·15 + 4·14 + 4·9 + 8·5 = 207$.

翻译中…

Similarly, $*f*(1) = 5, *f*(2) = 23, *f*(3) = 50, *f*(4) = 102$ and consequently image.

翻译中…

样例

Input #1
5
Output #1
387
InputCopy OutputCopy
Input #2
233
Output #2
788243189
InputCopy OutputCopy
题目信息
题号
933D
时间限制
2 s
内存限制
256 MB
标签
暴力
组合数学
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。