#include <bits/stdc++.h>
using namespace std;
const int inf = 2147483647;
const int mod = 1e9 + 7;
const int N = 200001;
int _max(int x, int y) { return x > y ? x : y; }
int _min(int x, int y) { return x < y ? x : y; }
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * f;
}
void put(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) put(x / 10);
  putchar(x % 10 + '0');
}
bool v[N];
vector<int> q[N];
int plen, p[N], mu[N];
int u[N];
int dec(int x, int y) {
  x -= y;
  return x < 0 ? x + mod : x;
}
int add(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
int pow_mod(int a, int k) {
  int ans = 1;
  for (; k; k >>= 1, a = (long long)a * a % mod)
    if (k & 1) ans = (long long)ans * a % mod;
  return ans;
}
void get_p() {
  mu[1] = 1;
  for (int i = 2; i < N; i++) {
    if (!v[i]) p[++plen] = i, mu[i] = -1;
    for (int j = 1; j <= plen && i * p[j] < N; j++) {
      v[i * p[j]] = 1;
      if (i % p[j] == 0) break;
      mu[i * p[j]] = -mu[i];
    }
  }
  for (int i = 1; i < N; i++)
    for (int j = i; j < N; j += i) q[j].push_back(i);
}
int main() {
  get_p();
  int n = read(), k = read();
  u[0] = 1;
  for (int i = 1; i <= n; i++) u[i] = (long long)u[i - 1] * k % mod;
  int ans = 0;
  for (int i = 2; i < 2 * n - 1; i++) {
    for (int j = 0; j < q[i].size(); j++) {
      int d = q[i][j], hh = u[_max(i - n, d)];
      long long s = 0;
      for (int h = 0; h < q[i / d].size(); h++) {
        int g = q[i / d][h];
        int l = 1, r = i / d / g - 1;
        int p = (n - 1) / d / g, cc = _max(0, r - p);
        r -= cc, l += cc;
        s += mu[g] * _max(0, r - l + 1);
      }
      ans = add(ans, (long long)s * hh % mod);
    }
  }
  put((long long)ans * pow_mod(u[n], mod - 2) % mod), puts("");
  return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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>
using namespace std;
const int inf = 2147483647;
const int mod = 1e9 + 7;
const int N = 200001;
int _max(int x, int y) { return x > y ? x : y; }
int _min(int x, int y) { return x < y ? x : y; }
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * f;
}
void put(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) put(x / 10);
  putchar(x % 10 + '0');
}
bool v[N];
vector<int> q[N];
int plen, p[N], mu[N];
int u[N];
int dec(int x, int y) {
  x -= y;
  return x < 0 ? x + mod : x;
}
int add(int x, int y) {
  x += y;
  return x >= mod ? x - mod : x;
}
int pow_mod(int a, int k) {
  int ans = 1;
  for (; k; k >>= 1, a = (long long)a * a % mod)
    if (k & 1) ans = (long long)ans * a % mod;
  return ans;
}
void get_p() {
  mu[1] = 1;
  for (int i = 2; i < N; i++) {
    if (!v[i]) p[++plen] = i, mu[i] = -1;
    for (int j = 1; j <= plen && i * p[j] < N; j++) {
      v[i * p[j]] = 1;
      if (i % p[j] == 0) break;
      mu[i * p[j]] = -mu[i];
    }
  }
  for (int i = 1; i < N; i++)
    for (int j = i; j < N; j += i) q[j].push_back(i);
}
int main() {
  get_p();
  int n = read(), k = read();
  u[0] = 1;
  for (int i = 1; i <= n; i++) u[i] = (long long)u[i - 1] * k % mod;
  int ans = 0;
  for (int i = 2; i < 2 * n - 1; i++) {
    for (int j = 0; j < q[i].size(); j++) {
      int d = q[i][j], hh = u[_max(i - n, d)];
      long long s = 0;
      for (int h = 0; h < q[i / d].size(); h++) {
        int g = q[i / d][h];
        int l = 1, r = i / d / g - 1;
        int p = (n - 1) / d / g, cc = _max(0, r - p);
        r -= cc, l += cc;
        s += mu[g] * _max(0, r - l + 1);
      }
      ans = add(ans, (long long)s * hh % mod);
    }
  }
  put((long long)ans * pow_mod(u[n], mod - 2) % mod), puts("");
  return 0;
}

```