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 long long N = 5100;
long long te, n, k, phi[N], a[N], d[20][N];
long long c(long long l, long long r) {
  if (l > r) return long long(2e12);
  long long ans = 0;
  for (long long i = l; i <= r; i++) ans += a[r / i];
  return ans;
}
void dnc(long long lvl, long long l, long long r, long long x, long long y) {
  if (l > r) return;
  long long mid = (l + r) / 2, opt = x, calc = c(min(mid, y) + 1, mid), cur;
  d[lvl][mid] = long long(2e12);
  for (long long j = min(mid, y); j >= x; j--) {
    if (calc == long long(2e12))
      calc = a[mid / j];
    else
      calc += a[mid / j];
    cur = d[lvl - 1][j - 1] + calc;
    if (d[lvl][mid] > cur) d[lvl][mid] = cur, opt = j;
  }
  dnc(lvl, l, mid - 1, x, opt);
  dnc(lvl, mid + 1, r, opt, y);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (long long i = 1; i < N; i++) phi[i] = i;
  for (long long i = 2; i < N; i++)
    if (phi[i] == i)
      for (long long j = i; j < N; j += i) phi[j] -= phi[j] / i;
  for (long long i = 1; i < N; i++) a[i] = a[i - 1] + phi[i];
  for (long long i = 1; i < N; i++) d[1][i] = c(1, i);
  for (long long i = 1; i <= 17; i++) d[i][0] = long long(2e12);
  for (long long i = 2; i <= 17; i++) dnc(i, 1, N - 1, 1, N - 1);
  cin >> te;
  for (; te--;) {
    cin >> n >> k;
    if (k > 17)
      cout << n << "\n";
    else
      cout << d[k][n] << "\n";
  }
}
