8523: Jo loves counting

内存限制:128 MB 时间限制:3 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

Jo loves his teammate Ky's rick and roll! But he more than loves counting.

Jo thinks, for two numbers n and d ( d is a factor of n ), dGoodn if and only if the prime factor set of d equals to that of n. That is, 

Goodn={dnmodd=0pPrime(dmodp=0nmodp=0)}.

For example,Good12={6,12} , since the factors of 12 are {1,2,3,4,6,12}{2,3} are prime factors of 12, so all its factors of their good factors must contain prime factors 2, 3. Therefore, only 6, 12 satisfy the condition.

For a number n, Jo will select a factor d randomly from Goodn with equal possibility. if d=n, then the rich Jo will pay you n yuan as reward. Otherwise, you will gain nothing.

Ky, the man who treats money as dirt, wants to choose an integer from [1, M] randomly for Jo's game. Help Ky calculate the expectation of money he can get.

输入格式

The first line contains an integer T(T≤12) . Then T test cases follow.

For each test case, there is only one integer M(1M1012).

It's guaranteed that there are at most 6 cases such that M>106 .

输出格式

For each test case, output one integer in a single line --- the expectation of the money Ky can get.

Since it can be too large, print it modulo 4179340454199820289(=29*257+1).

输入样例 复制

1
4

输出样例 复制

2

数据范围与提示

Good1={1}

Good2={2}

Good3={3}

Good4={2,4}

Therefore, the answer is (Good11+Good22+Good33+Good44)=1/4(1/1+1/2+1/3+2/4)=2