8552: Yet Another Easy Function Sum Problem

内存限制:128 MB 时间限制:20 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:0

题目描述

Two years ago, Silver187 learned Mobius inversion and knew how to calculate 

nj=1ni=1gcd(i,j)

One year ago, Silver187 learned how to calculate 

nj=1ni=1φ(ij)

But he tried to solve this problem when 1n109. Finally, he failed to solve it. But he didn't completely fail, he solved a similar problem:

Silver187 defines that if

n=i=1kpiαi(piprime,αi>0,i=j,pi!=pj) ,

 then H(n)=i=1kpi. In particular, H(1)=1.

Silver187 likes gcd, so he wants to ask you to calculate the result of the following formula.

(i=1nj=1nH(ij)[gcd(i,j)=1])mod109+7

Now, Silver187 asks you to solve this problem.

输入格式

First line has one integer T(1T5), indicating there are TT test cases. In each case:

Only one line contains an integer n(1n109).

Input guarantee n2×109.

输出格式

In each case, output an integer on a line.

输入样例 复制

5
3
5
1000
10000
1000000

输出样例 复制

23
119
181591410
452132610
74649566