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;
const int N = 1e5 + 10;
int n, T, p[N], pcnt, f[N];
long long phi[N], dp[20][N];
inline void init(int n) {
  phi[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!f[i]) p[++pcnt] = i, phi[i] = i - 1;
    for (int j = 1; j <= pcnt && i * p[j] <= n; ++j) {
      int num = i * p[j];
      f[num] = 1;
      if (i % p[j])
        phi[num] = phi[i] * phi[p[j]];
      else {
        phi[num] = phi[i] * p[j];
        break;
      }
    }
  }
  for (int i = 2; i <= n; ++i) phi[i] += phi[i - 1];
}
inline long long calc(int l, int r) {
  long long ret = 0;
  for (int x = l, y = 0; x <= r; x = y + 1) {
    y = r / (r / x);
    ret += phi[r / x] * (y - x + 1);
  }
  return ret;
}
inline void solve(int x, int l, int r, int ql, int qr) {
  if (l > r) return;
  int mid = (l + r) >> 1, now = calc(min(qr + 1, mid), mid), pos = ql;
  dp[x][mid] = 1e15;
  for (int i = min(qr, mid - 1); i >= ql; --i) {
    if (dp[x - 1][i] + now < dp[x][mid])
      dp[x][mid] = dp[x - 1][i] + now, pos = i;
    now += phi[mid / i];
  }
  solve(x, l, mid - 1, ql, pos);
  solve(x, mid + 1, r, pos, qr);
}
int main() {
  n = 100000;
  init(n);
  for (int i = 1; i <= n; ++i) dp[1][i] = 1ll * i * (i + 1) / 2;
  for (int i = 2; (1 << i) <= n; ++i) solve(i, i, n, 1, n);
  scanf("%d", &T);
  while (T--) {
    int k;
    scanf("%d%d", &n, &k);
    if (k >= 20 || (1 << k) > n) {
      printf("%d\n", n);
      continue;
    } else
      printf("%d\n", dp[k][n]);
  }
  return 0;
}
