A Creative Cutout

题目描述

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. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF933D/fba66fdeec16664c87daa27f59929551b565a742.png)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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF933D/f2545ba51c140bc44922a670a0d4e8502561a2ce.png) 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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF933D/42aed05e24327c5ba0418b29dac5d6f560b757dc.png).

输入输出格式

输入格式


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

输出格式


In the first line print one integer representing ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF933D/42aed05e24327c5ba0418b29dac5d6f560b757dc.png).

输入输出样例

输入样例 #1

5

输出样例 #1

387

输入样例 #2

233

输出样例 #2

788243189

说明

A piece of paper with $ 5 $ circles is shown in the following. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF933D/65a79d77425901c2fc1a4e4f5cdee759591ef50f.png)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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF933D/e417b5a75ba12c36c31dd616d86cc711bf7c6e0a.png).