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 ith friend is given ai sweets. He wants to make sure that there should not be any positive integer x > 1, which divides every ai.

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 (109 + 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 (109 + 7).

Input

The first line contains an integer q representing the number of queries (1 ≤ q ≤ 105). Each of the next q lines contains two space space-separated integers n, f (1 ≤ f ≤ n ≤ 105).

Output

For each query, output a single integer in a line corresponding to the answer of each query.

Examples

Input

5
6 2
7 2
6 3
6 4
7 4


Output

2
6
9
10
20

Note

For first query: n = 6, f = 2. Possible partitions are [1, 5] and [5, 1].

For second query: n = 7, f = 2. Possible partitions are [1, 6] and [2, 5] and [3, 4] and [4, 3] and [5, 3] and [6, 1]. So in total there are 6 possible ways of partitioning.
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &v) {
  os << "(";
  os << v.first << "," << v.second << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  long long sz = v.size();
  for (long long i = 0; i < sz; ++i) {
    os << v[i];
    if (i != sz - 1) os << ",";
  }
  os << "]\n";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  T last = *v.rbegin();
  os << "[";
  for (auto it : v) {
    os << it;
    if (it != last) os << ",";
  }
  os << "]\n";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const map<T, S> &v) {
  for (auto it : v) {
    os << it.first << " : " << it.second << "\n";
  }
  return os;
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % 1000000007;
    }
    b /= 2;
    a = (a * a) % 1000000007;
  }
  return res;
}
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long maxn = 1e5 + 6;
long long mu[maxn], pr[maxn], cnt[maxn], dp[maxn];
long long fact[maxn], inv[maxn];
long long get(long long n, long long r) {
  if (n < r) return 0;
  long long ans = fact[n];
  ans *= inv[r];
  ans %= 1000000007;
  ans *= inv[n - r];
  return ans % 1000000007;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  mu[1] = fact[0] = fact[1] = inv[0] = 1;
  for (long long i = 2; i < maxn; ++i) pr[i] = 1, mu[i] = 1;
  for (long long i = 2; i < maxn; ++i) {
    if (pr[i]) {
      mu[i] = -1;
      for (long long j = 2; (i * j) < maxn; ++j) {
        if (j % i == 0)
          mu[i * j] = 0;
        else
          mu[i * j] *= -1;
        pr[i * j] = 0;
      }
    }
    fact[i] = fact[i - 1] * i;
    fact[i] %= 1000000007;
  }
  inv[maxn - 1] = power(fact[maxn - 1], 1000000007 - 2);
  for (long long i = maxn - 2; i > 0; --i) {
    inv[i] = inv[i + 1] * (i + 1);
    inv[i] %= 1000000007;
  }
  long long q;
  cin >> q;
  while (q--) {
    long long n, ans = 0, f;
    cin >> n >> f;
    for (long long i = 1; i * i <= n; ++i) {
      if (n % i == 0) {
        ans += mu[i] * get(n / i - 1, f - 1);
        while (ans < 1000000007) ans += 1000000007;
        ans %= 1000000007;
        if (i * i != n) {
          ans += mu[n / i] * get(i - 1, f - 1);
          while (ans < 1000000007) ans += 1000000007;
          ans %= 1000000007;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
