For two positive integers l and r (l ≤ r) let c(l, r) denote the number of integer pairs (i, j) such that l ≤ i ≤ j ≤ r and \operatorname{gcd}(i, j) ≥ l. Here, \operatorname{gcd}(i, j) is the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers i and j.

YouKn0wWho has two integers n and k where 1 ≤ k ≤ n. Let f(n, k) denote the minimum of ∑_{i=1}^{k}{c(x_i+1,x_{i+1})} over all integer sequences 0=x_1 < x_2 < … < x_{k} < x_{k+1}=n.

Help YouKn0wWho find f(n, k). 

Input

The first line contains a single integer t (1 ≤ t ≤ 3 ⋅ 10^5) — the number of test cases.

The first and only line of each test case contains two integers n and k (1 ≤ k ≤ n ≤ 10^5). 

Output

For each test case, print a single integer — f(n, k).

Example

Input


4
6 2
4 4
3 1
10 3


Output


8
4
6
11

Note

In the first test case, YouKn0wWho can select the sequence [0, 2, 6]. So f(6, 2) = c(1, 2) + c(3, 6) = 3 + 5 = 8 which is the minimum possible.
#include <bits/stdc++.h>
using namespace std;
long long dp[19][100010];
const int n = 100000;
int ntp[100010], phi[100010], p[100010], pn;
long long G[100010];
vector<int> d[100010];
void init(int n) {
  ntp[1] = true, phi[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!ntp[i]) p[++pn] = i, phi[i] = i - 1;
    for (int j = 1; j <= pn && p[j] * i <= n; ++j) {
      ntp[p[j] * i] = true;
      if (i % p[j] == 0) {
        phi[p[j] * i] = phi[i] * p[j];
        break;
      }
      phi[p[j] * i] = phi[i] * (p[j] - 1);
    }
  }
  G[1] = 1;
  for (int i = 2; i <= n; ++i) {
    G[i] = G[i - 1] + phi[i];
  }
}
long long now;
inline int Get(int x, int lim) {
  int tot = 0;
  for (auto t : d[x]) {
    if (t >= lim) {
      tot += phi[x / t];
    }
  }
  return tot;
}
long long calc(int ql, int qr) {
  static int l = 1, r = 0;
  while (r < qr) ++r, now += Get(r, l);
  while (l > ql) --l, now += G[r / l];
  while (l < ql) now -= G[r / l], ++l;
  while (r > qr) now -= Get(r, l), --r;
  return now;
}
void Solve(int l, int r, int ql, int qr, long long *f, long long *g) {
  if (l > r) return;
  int mid = (l + r) >> 1;
  int p = ql;
  for (int i = ql; i <= min(mid - 1, qr); ++i) {
    long long tp = g[i] + calc(i + 1, mid);
    if (tp < f[mid]) {
      f[mid] = tp, p = i;
    }
  }
  Solve(l, mid - 1, ql, p, f, g);
  Solve(mid + 1, r, p, qr, f, g);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  init(n);
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0] = 0;
  for (int j = 1; j <= n; ++j) {
    for (int i = j; i <= n; i += j) {
      d[i].push_back(j);
    }
  }
  for (int i = 0; i <= 18; ++i) {
    Solve(1, n, 0, n - 1, dp[i], dp[i - 1]);
  }
  int Q;
  cin >> Q;
  while (Q--) {
    int n, k;
    cin >> n >> k;
    if (k > 18) {
      cout << n << '\n';
    } else {
      cout << dp[k][n] << '\n';
    }
  }
  return 0;
}
