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;
int T, n, k, cnt, p[110000], phi[110000];
long long f[20][110000], pre[110000];
bool vis[110000];
void init(int n) {
  vis[1] = 1;
  phi[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!vis[i]) {
      p[++cnt] = i;
      phi[i] = i - 1;
    }
    for (int j = 1; j <= cnt && i * p[j] <= n; j++) {
      vis[i * p[j]] = true;
      if (i % p[j] == 0) {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
      phi[i * p[j]] = phi[i] * (p[j] - 1);
    }
  }
  for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + phi[i];
}
long long calc(int l, int r) {
  long long res = 0;
  for (int i = l, j; i <= r; i = j + 1) {
    j = r / (r / i);
    res += pre[r / i] * max(min(j, r) - i + 1, 0);
  }
  return res;
}
void solve(int l, int r, int x, int y) {
  if (l > r) return;
  int mid = (l + r) >> 1;
  f[k][mid] = f[k - 1][mid];
  long long val = calc(x + 1, mid);
  int pos = mid;
  for (int i = x; i <= y && i < mid; i++) {
    if (f[k - 1][i] + val < f[k][mid]) {
      f[k][mid] = f[k - 1][i] + val;
      pos = i;
    }
    val -= pre[mid / (i + 1)];
  }
  solve(l, mid - 1, x, pos);
  solve(mid + 1, r, pos, y);
}
int main() {
  init(100000);
  memset(f[0], 0x3f, sizeof(f[0]));
  f[0][0] = 0;
  for (k = 1; k <= 17; k++) solve(1, 100000, 0, 99999);
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &n, &k);
    if (k > 17) {
      printf("%d\n", n);
      continue;
    }
    printf("%lld\n", f[k][n]);
  }
  return 0;
}
