#include <bits/stdc++.h>
const int N = 1e5;
uint32_t P = 1e9 + 7;
int phi[N * 2 + 1], minp[N * 2 + 1], rad[N * 2 + 1];
bool vis[N * 2 + 1];
uint32_t pw[N + 1];
std::vector<int> pr;
uint64_t power(uint64_t a, uint32_t b) {
  uint64_t ans = 1;
  for (; b; a = a * a % P, b >>= 1)
    if (b & 1) ans = ans * a % P;
  return ans;
}
int partial_phi(int n, int s) {
  if (n == 0) return 0;
  if (s == 1) return n;
  int p = minp[s];
  return partial_phi(n, s / p) - partial_phi(n / p, s / p);
}
int main() {
  int n, k;
  assert(scanf("%d%d", &n, &k) == 2);
  uint64_t invk = power(k, P - 2);
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) pw[i] = pw[i - 1] * invk % P;
  phi[1] = 1;
  rad[1] = 1;
  for (int i = 2; i <= 2 * n; ++i) {
    if (!vis[i]) {
      pr.push_back(i);
      minp[i] = i;
      phi[i] = i - 1;
      rad[i] = i;
    }
    for (int j = 0; j < pr.size() && i * pr[j] <= 2 * n; ++j) {
      vis[i * pr[j]] = 1;
      minp[i * pr[j]] = pr[j];
      if (i % pr[j] == 0) {
        phi[i * pr[j]] = phi[i] * pr[j];
        rad[i * pr[j]] = rad[i];
        break;
      }
      phi[i * pr[j]] = phi[i] * (pr[j] - 1);
      rad[i * pr[j]] = rad[i] * pr[j];
    }
  }
  uint32_t ans = 0;
  for (int d = 1; d < n; ++d) {
    int m = (n - 1) / d;
    for (int s = 2; s <= m; ++s) ans = (ans + (uint64_t)phi[s] * pw[n - d]) % P;
    for (int s = m + 1; s <= m * 2; ++s)
      ans = (ans + (uint64_t)(partial_phi(m, rad[s]) -
                              partial_phi(s - m - 1, rad[s])) *
                       pw[std::min(2 * n - d * s, n - d)]) %
            P;
  }
  printf("%u\n", ans);
  return 0;
}

### Prompt

Please create a solution in CPP to the following problem:

You are given integers n, k. Let's consider the alphabet consisting of k different elements.

Let beauty f(s) of the string s be the number of indexes i, 1≤ i<|s|, for which prefix of s of length i equals to suffix of s of length i. For example, beauty of the string abacaba equals 2, as for i = 1, 3 prefix and suffix of length i are equal.

Consider all words of length n in the given alphabet. Find the expected value of f(s)^2 of a uniformly chosen at random word. We can show that it can be expressed as P/Q, where P and Q are coprime and Q isn't divided by 10^9 + 7. Output P⋅ Q^{-1} mod 10^9 + 7.

Input

The first and the only line contains two integers n, k (1≤ n ≤ 10^5, 1≤ k≤ 10^9) — the length of a string and the size of alphabet respectively.

Output

Output a single integer — P× Q^{-1} mod 10^9 + 7.

Examples

Input


2 3


Output


333333336


Input


1 5


Output


0


Input


100 1


Output


9801


Input


10 10


Output


412377396

Note

In the first example, there are 9 words of length 2 in alphabet of size 3 — aa, ab, ac, ba, bb, bc, ca, cb, cc. 3 of them have beauty 1 and 6 of them have beauty 0, so the average value is 1/3.

In the third example, there is only one such word, and it has beauty 99, so the average value is 99^2.

### Response

```cpp
#include <bits/stdc++.h>
const int N = 1e5;
uint32_t P = 1e9 + 7;
int phi[N * 2 + 1], minp[N * 2 + 1], rad[N * 2 + 1];
bool vis[N * 2 + 1];
uint32_t pw[N + 1];
std::vector<int> pr;
uint64_t power(uint64_t a, uint32_t b) {
  uint64_t ans = 1;
  for (; b; a = a * a % P, b >>= 1)
    if (b & 1) ans = ans * a % P;
  return ans;
}
int partial_phi(int n, int s) {
  if (n == 0) return 0;
  if (s == 1) return n;
  int p = minp[s];
  return partial_phi(n, s / p) - partial_phi(n / p, s / p);
}
int main() {
  int n, k;
  assert(scanf("%d%d", &n, &k) == 2);
  uint64_t invk = power(k, P - 2);
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) pw[i] = pw[i - 1] * invk % P;
  phi[1] = 1;
  rad[1] = 1;
  for (int i = 2; i <= 2 * n; ++i) {
    if (!vis[i]) {
      pr.push_back(i);
      minp[i] = i;
      phi[i] = i - 1;
      rad[i] = i;
    }
    for (int j = 0; j < pr.size() && i * pr[j] <= 2 * n; ++j) {
      vis[i * pr[j]] = 1;
      minp[i * pr[j]] = pr[j];
      if (i % pr[j] == 0) {
        phi[i * pr[j]] = phi[i] * pr[j];
        rad[i * pr[j]] = rad[i];
        break;
      }
      phi[i * pr[j]] = phi[i] * (pr[j] - 1);
      rad[i * pr[j]] = rad[i] * pr[j];
    }
  }
  uint32_t ans = 0;
  for (int d = 1; d < n; ++d) {
    int m = (n - 1) / d;
    for (int s = 2; s <= m; ++s) ans = (ans + (uint64_t)phi[s] * pw[n - d]) % P;
    for (int s = m + 1; s <= m * 2; ++s)
      ans = (ans + (uint64_t)(partial_phi(m, rad[s]) -
                              partial_phi(s - m - 1, rad[s])) *
                       pw[std::min(2 * n - d * s, n - d)]) %
            P;
  }
  printf("%u\n", ans);
  return 0;
}

```