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[100005][17], t, n, k, phi[100005], cost[200005], total, tc;
vector<int> divs[100005];
vector<int> sol;
long long aib[100005], s[100005];
void solve() {
  tc++;
  cin >> n >> k;
  if (k == 1) {
    cout << n * (n + 1) / 2 << '\n';
    return;
  }
  if ((1 << k) > n)
    cout << n << '\n';
  else
    cout << dp[n][k] << '\n';
}
int lsb(int x) { return x & (-x); }
void update(int poz, long long val) {
  for (int i = poz; i <= 1e5; i += lsb(i)) aib[i] += val;
}
long long suma(int poz) {
  long long rez = 0;
  for (int i = poz; i >= 1; i -= lsb(i)) rez += aib[i];
  return rez;
}
int main() {
  for (int i = 1; i <= 1e5; i++) {
    phi[i] = i;
    divs[i].push_back(1);
  }
  for (int i = 2; i <= 1e5; i++) {
    bool prim = (phi[i] == i);
    for (int j = i; j <= 1e5; j += i) {
      divs[j].push_back(i);
      if (prim) {
        phi[j] /= i;
        phi[j] *= (i - 1);
      }
    }
  }
  for (long long i = 1; i <= 100000; i++) {
    for (int p = 0; p < divs[i].size(); p++) {
      int j = divs[i][p];
      int nr = i / j;
      update(1, phi[nr]);
      update(j + 1, -phi[nr]);
      total += phi[nr];
    }
    dp[i][1] = i * (i + 1) / 2;
    if (i <= 3000) {
      for (int p = 2; p <= i; p++) s[p] = suma(p);
      for (int l = 2; l <= 16; l++) {
        dp[i][l] = 1e18;
        for (int p = 2; p <= i; p++) {
          dp[i][l] = min(dp[i][l], dp[p - 1][l - 1] + s[p]);
          if (i == 14 && l == 3) cout << dp[p - 1][l - 1] + s[p] << ' ';
        }
      }
    }
    for (int l = 2; l <= 16; l++) {
      int poz = 0;
      int st = 2;
      int dr = i;
      long long ans = dp[i][l - 1];
      if ((1 << l) > i) {
        dp[i][l] = i;
        continue;
      }
      while (st <= dr) {
        int lg = dr - st + 1;
        int mij1 = st + lg / 3;
        int mij2 = mij1 + lg / 3;
        if (lg == 2) {
          mij1 = st;
          mij2 = dr;
        }
        if (lg < 2) break;
        long long val1 = dp[mij1 - 1][l - 1] + suma(mij1);
        long long val2 = dp[mij2 - 1][l - 1] + suma(mij2);
        ans = min(ans, val1);
        if (ans == val1) poz = mij1;
        ans = min(ans, val2);
        if (ans == val2) poz = mij2;
        if (val1 < val2) dr = mij2 - 1;
        if (val1 >= val2) st = mij1 + 1;
      }
      dp[i][l] = ans;
    }
  }
  cin >> t;
  while (t--) solve();
  return 0;
}
