#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long cal[100005];
long long val[100005];
vector<int> prime;
long long dp[25][100005];
long long cal2(int l, int r) {
  if (l > r) return 0;
  long long tot = 0;
  long long last = r;
  for (int i = 1;;) {
    int Next = (r) / (i + 1);
    if (Next < l) {
      tot += cal[i] * (last - l + 1);
      break;
    }
    tot += cal[i] * (last - Next);
    last = Next;
    i = r / Next;
  }
  return tot;
}
void dc(int k, int l, int r, int optl, int optr) {
  if (l > r) return;
  int mid = (l + r) / 2;
  int opt = 0;
  dp[k][mid] = 1e18;
  long long now = cal2(optr + 1, mid);
  for (int i = min(optr, mid); i >= optl; i--) {
    now += cal[mid / i];
    long long val = dp[k - 1][i - 1] + now;
    if (val < dp[k][mid]) {
      dp[k][mid] = val;
      opt = i;
    }
  }
  dc(k, l, mid - 1, optl, opt);
  dc(k, mid + 1, r, opt, optr);
}
void solve() {
  int n, k;
  scanf("%d %d", &n, &k);
  if (k >= 20)
    printf("%d\n", n);
  else {
    printf("%lld\n", dp[k][n]);
  }
}
int main() {
  for (int i = 1; i <= 100000; i++) val[i] = i;
  for (int i = 2; i <= 100000; i++) {
    if (val[i] == i) {
      for (int j = i; j <= 100000; j += i) val[j] = val[j] / i * (i - 1);
    }
  }
  cal[1] = 1;
  for (int i = 2; i <= 100000; i++) cal[i] = cal[i - 1] + val[i];
  for (int i = 1; i <= 100000; i++) {
    dp[1][i] = i * 1ll * (i + 1) / 2;
  }
  for (int i = 2; i <= 20; i++) {
    dc(i, 1, 100000, 1, 100000);
  }
  int t = 1;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}

### Prompt

Please formulate a Cpp solution to the following problem:

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.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long cal[100005];
long long val[100005];
vector<int> prime;
long long dp[25][100005];
long long cal2(int l, int r) {
  if (l > r) return 0;
  long long tot = 0;
  long long last = r;
  for (int i = 1;;) {
    int Next = (r) / (i + 1);
    if (Next < l) {
      tot += cal[i] * (last - l + 1);
      break;
    }
    tot += cal[i] * (last - Next);
    last = Next;
    i = r / Next;
  }
  return tot;
}
void dc(int k, int l, int r, int optl, int optr) {
  if (l > r) return;
  int mid = (l + r) / 2;
  int opt = 0;
  dp[k][mid] = 1e18;
  long long now = cal2(optr + 1, mid);
  for (int i = min(optr, mid); i >= optl; i--) {
    now += cal[mid / i];
    long long val = dp[k - 1][i - 1] + now;
    if (val < dp[k][mid]) {
      dp[k][mid] = val;
      opt = i;
    }
  }
  dc(k, l, mid - 1, optl, opt);
  dc(k, mid + 1, r, opt, optr);
}
void solve() {
  int n, k;
  scanf("%d %d", &n, &k);
  if (k >= 20)
    printf("%d\n", n);
  else {
    printf("%lld\n", dp[k][n]);
  }
}
int main() {
  for (int i = 1; i <= 100000; i++) val[i] = i;
  for (int i = 2; i <= 100000; i++) {
    if (val[i] == i) {
      for (int j = i; j <= 100000; j += i) val[j] = val[j] / i * (i - 1);
    }
  }
  cal[1] = 1;
  for (int i = 2; i <= 100000; i++) cal[i] = cal[i - 1] + val[i];
  for (int i = 1; i <= 100000; i++) {
    dp[1][i] = i * 1ll * (i + 1) / 2;
  }
  for (int i = 2; i <= 20; i++) {
    dc(i, 1, 100000, 1, 100000);
  }
  int t = 1;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}

```