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 ksm(long long a, long long x) {
  long long ret = 1;
  for (; x; x >>= 1, a = a * a)
    if (x & 1) ret = ret * a;
  return ret;
}
long long rt(long long n, long long t) {
  long long sz = pow(n, 1.0 / t) + 1;
  for (; ksm(sz, t) < n;) sz++;
  for (; ksm(sz - 1, t) >= n;) sz--;
  return sz;
}
long long phi[100000 + 50], g[100000 + 50], notp[100000 + 50], p[100000 + 50];
void prepare() {
  notp[1] = 1;
  phi[1] = 1;
  for (long long i = 2; i <= 100000; i++) {
    if (!notp[i]) p[++p[0]] = i, phi[i] = i - 1;
    for (long long j = 1, x; j <= p[0] && (x = i * p[j]) <= 100000; j++) {
      notp[x] = 1;
      if (i % p[j] == 0) {
        phi[x] = phi[i] * p[j];
        break;
      } else {
        phi[x] = phi[i] * (p[j] - 1);
      }
    }
  }
  g[0] = -1;
  for (long long i = 1; i <= 100000; i++) g[i] = g[i - 1] + 2 * phi[i];
}
long long f(long long l, long long r) {
  long long ans = 0;
  for (long long x = l, y = l; x <= r; x = y + 1) {
    y = r / (r / x);
    ans = ans + (y - x + 1) * g[r / x];
  }
  ans = (ans + (r - l + 1)) / 2;
  return ans;
}
long long T, n, k;
int main() {
  ios_base::sync_with_stdio(false);
  prepare();
  cin >> T;
  for (; T--;) {
    cin >> n >> k;
    if (k >= 20 || (1 << k) > n)
      cout << n << endl;
    else {
      long long l = 1, r = n + 1;
      long long ans = 0;
      for (long long now = k - 1; now >= 1; now--) {
        long long mul = rt(r / l, now + 1);
        long long mid = l * mul;
        ans = ans + f(l, mid - 1);
        l = mid;
      }
      ans = ans + f(l, r - 1);
      cout << ans << '\n';
    }
  }
  return 0;
}
