7500: A Very Easy Math Problem

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

题目描述

Given you n,x,k , find the value of the following formula:
a1=1na2=1n…∑ax=1n⎛⎝j=1xakj⎞⎠f(gcd(a1,a2,…,ax))⋅gcd(a1,a2,…,ax)

gcd(a1,a2,…,an) is the greatest common divisor of a1,a2,...,an .
The function f(x) is defined as follows:
If there exists an ingeter k (k>1) , and k2 is a divisor of x ,
then f(x)=0 , else f(x)=1 .

输入格式

The first line contains three integers t,k,x (1≤t≤104,1≤k≤109,1≤x≤109)
Then ttest cases follow. Each test case contains an integer n (1≤n≤2×105)
 

输出格式

For each test case, print one integer — the value of the formula.

Because the answer may be very large, please output the answer modulo 109+7.

输入样例 复制

3 1 3
56
5
20

输出样例 复制

139615686
4017
11554723