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>
#pragma GCC optimize(2)
using namespace std;
long long dp[17][100005];
int pri[100005], tl, tr, B;
int get(int l, int r) {
  B = sqrt(r);
  int re = 0;
  for (int i = l; i <= B; i++) {
    re += 1 + 1ll * pri[r / i] * (pri[r / i] + 1) / 2;
  }
  l = max(l, B + 1);
  for (int i = 1; i <= B; i++) {
    tr = r / i, tl = r / (i + 1) + 1;
    tl = max(tl, l);
    if (tl <= tr) {
      re += (1 + 1ll * pri[i] * (pri[i] + 1) / 2) * (tr - tl + 1);
    }
  }
  return re;
}
void solve(int x, int l, int r, int tl, int tr) {
  if (l > r) return;
  int mid = (l + r) >> 1, tm = -1;
  long long now = get(tl, mid);
  dp[x][mid] = 1e18;
  for (int i = tl; i <= min(tr, mid); i++) {
    long long to = dp[x - 1][i - 1] + now;
    if (to < dp[x][mid]) {
      dp[x][mid] = to;
      tm = i;
    }
    now -= 1 + (1 + pri[mid / i]) * (1ll * pri[mid / i]) / 2;
  }
  solve(x, l, mid - 1, tl, tm);
  solve(x, mid + 1, r, tm, tr);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 2; i <= 100000; i++) pri[i] = 1;
  for (int i = 2; i <= 100000; i++)
    if (pri[i]) {
      for (int j = i + i; j <= 100000; j += i) pri[j] = 0;
    }
  for (int i = 2; i <= 100000; i++) pri[i] = pri[i - 1] + pri[i];
  for (int i = 1; i <= 100000; i++) {
    dp[0][i] = 1e18;
  }
  for (int i = 1; i <= 16; i++) {
    solve(i, 1, 100000, 1, 100000);
  }
  int q;
  cin >> q;
  for (int i = 1; i <= q; i++) {
    int x, y;
    cin >> x >> y;
    if (y > 16) {
      cout << x << '\n';
    } else
      cout << dp[y][x] << '\n';
  }
  return 0;
}
