Today is Devu's birthday. For celebrating the occasion, he bought *n* sweets from the nearby market. He has invited his *f* friends. He would like to distribute the sweets among them. As he is a nice guy and the occasion is great, he doesn't want any friend to be sad, so he would ensure to give at least one sweet to each friend. 

He wants to celebrate it in a unique style, so he would like to ensure following condition for the distribution of sweets. Assume that he has distributed *n* sweets to his friends such that *i*<sup class="upper-index">*th*</sup> friend is given *a*<sub class="lower-index">*i*</sub> sweets. He wants to make sure that there should not be any positive integer *x* &gt; 1, which divides every *a*<sub class="lower-index">*i*</sub>.

Please find the number of ways he can distribute sweets to his friends in the required way. Note that the order of distribution is important, for example [1, 2] and [2, 1] are distinct distributions. As the answer could be very large, output answer modulo 1000000007 (10<sup class="upper-index">9</sup> + 7).

To make the problem more interesting, you are given *q* queries. Each query contains an *n*, *f* pair. For each query please output the required number of ways modulo 1000000007 (10<sup class="upper-index">9</sup> + 7).
The first line contains an integer *q* representing the number of queries (1 ≤ *q* ≤ 10<sup class="upper-index">5</sup>). Each of the next *q* lines contains two space space-separated integers *n*, *f* (1 ≤ *f* ≤ *n* ≤ 10<sup class="upper-index">5</sup>).
import sys
input = lambda : sys.stdin.readline().rstrip()

# sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))

ans = []
### 素数の逆元とCombination

M = 10**9+7 # 出力の制限
# M = 998244353
N = 2 * 10**5 + 10 # 必要なテーブルサイズ
g1 = [0] * (N+1) # 元テーブル
g2 = [0] * (N+1) #逆元テーブル
inverse = [0] * (N+1) #逆元テーブル計算用テーブル
g1[0] = g1[1] = g2[0] = g2[1] = 1
inverse[0], inverse[1] = [0, 1] 
for i in range( 2, N + 1 ):
    g1[i] = ( g1[i-1] * i ) % M 
    inverse[i] = ( -inverse[M % i] * (M//i) ) % M # ai+b==0 mod M <=> i==-b*a^(-1) <=> i^(-1)==-b^(-1)*aより
    g2[i] = (g2[i-1] * inverse[i]) % M 
def cmb(n, r, M=M):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return ((g1[n] * g2[r] % M) * g2[n-r]) % M
def perm(n, r, M=M):
    if (r<0 or r>n):
        return 0
    return (g1[n] * g2[n-r]) % M
### 約数列挙
def hurui(n):
    """線形篩
    pl: 素数のリスト
    mpf: iを割り切る最小の素因数
    """
    pl = []
    mpf = [None]*(n+1)
    for d in range(2,n+1):
        if mpf[d] is None:
            mpf[d] = d
            pl.append(d)
        for p in pl:
            if p*d>n or p>mpf[d]:
                break
            mpf[p*d] = p
    return pl, mpf
from collections import defaultdict
def factor(num):
    d = defaultdict(int)
    if num==1:
        d.update({1:1})
        return d
    while num>1:
        d[mpf[num]] += 1
        num //= mpf[num]
    return d
pl, mpf = hurui(100100)

q = int(input())
for i in range(q):
    n,f = list(map(int, input().split()))
    fs = factor(n)
    ks = list(fs.keys())
    vs = list(fs.values())
    res = 0
    for b in range(1<<(len(ks))):
        v = 1
        s = 1
        for i in range(len(ks)):
            if b>>i&1:
                v *= ks[i]
                s *= -1
        res += s * cmb(n//v-1, f-1) % M
        res %= M
    ans.append(res)
write("\n".join(map(str, ans)))