Euler totient function (denoted by phi(N)) for a positive integer N is defined as number of positive integers less than or equal N that are coprime to N.
Let's generalize this concept of Euler totient function. For positive integer N let's write out the integers that are less than or equal to N and are coprime to N. We'll get a list of integers of the form A1, A2, ..., AM, where M = phi(N). Let's denote EK(N) = A1K + A2K+...+AMK. This way we obtain something more general version of Euler totient function, in particular, E0(N) = phi(N) for every positive integer N. Task is to calculate EK(N). As answer could be large, print the answer modulo 109+7
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains two space separated integers N and K.
For each test case, output a single line containing the answer to the problem i.e. the value of EK(N) modulo 109+7.
1 ≤ T ≤ 128
1 ≤ N ≤ 10^4
0 ≤ K ≤ 10^4
1 ≤ N ≤ 10^12
K = 0
1 ≤ N ≤ 10^12
K = 1
1 ≤ N ≤ 10^12
0 ≤ K ≤ 256