链接:https://www.nowcoder.com/acm/contest/124/K
来源:牛客网
题目描述
定义S(n) = 12 + 22 + … + n2,输出S(n) % 1000000007。
注意:1 < n < 1e18。
输入描述:
多组输入,输入直到遇到EOF为止;
第一行输入一个正整数n。
输出描述:
输出S(n) % 1000000007的结果。
示例1
输入
1
2
1000
输出
1
5
333833500
[分析]
python骚操作哈哈哈
[代码]
while True:
try:
n=int(input())
print (n*(n+1)*(2*n+1)/6)%1000000007;
except:
break`