#include <bits/stdc++.h>
using namespace std;
const long long p = 1e9 + 7;
inline long long read() {
  long long neg = 1, num = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') neg = -1;
  for (; isdigit(c); c = getchar()) num = (num << 1) + (num << 3) + c - '0';
  return neg * num;
}
long long n, k, tot, f[200010], g[200010], fac[200010], inv[200010],
    pri[200010], mu[200010], mul[200010];
bool vis[200010];
inline long long Pow(long long x, long long y) {
  long long res = 1;
  for (; y; y >>= 1, x = x * x % p)
    if (y & 1) res = res * x % p;
  return res;
}
inline long long C(long long x, long long y) {
  return fac[x] * inv[y] % p * inv[x - y] % p;
}
inline long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
inline void sieve() {
  vis[1] = mu[1] = 1;
  for (long long i = 2; i <= n; i++) {
    if (!vis[i]) pri[++tot] = i, mu[i] = -1;
    for (long long j = 1; j <= tot && pri[j] * i <= n; j++) {
      vis[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
      mu[i * pri[j]] = -mu[i];
    }
  }
  fac[0] = inv[0] = mul[0] = 1;
  for (long long i = 1; i <= 2 * n; i++)
    fac[i] = fac[i - 1] * i % p, mul[i] = mul[i - 1] * k % p;
  inv[2 * n] = Pow(fac[2 * n], p - 2);
  for (long long i = 2 * n - 1; i >= 1; i--) inv[i] = inv[i + 1] * (i + 1) % p;
  for (long long i = 2; i <= n; i++)
    f[i] = (f[i - 1] + (i - 1) * mul[i] % p) % p;
}
signed main() {
  n = read();
  k = read();
  sieve();
  long long ans = 0, sub = 0;
  for (long long i = 2; i <= 2 * n; i++) {
    if (i <= n)
      ans = (ans + (i - 1) * mul[i] % p) % p;
    else
      ans = (ans + (2 * n - i + 1) * mul[i] % p) % p;
  }
  ans = ans * Pow(mul[n], p - 2) % p;
  for (long long d = 1; d <= n; d++) {
    for (long long T = d; T <= n; T += d) {
      long long s1 = (n / T) * (n / T - 1) / 2 % p, s2 = Pow(f[n / T], T);
      if ((n + d - 1) / T != n / T)
        s1 = (s1 + (n + d - 1) / T - 1) % p,
        s2 = (s2 + ((n + d - 1) / T - 1) * mul[(n + d - 1) / T * T] % p) % p;
      ans = (ans + s1 * mul[d] * mu[T / d] % p) % p;
      sub = (sub + s2 * mu[T / d]) % p;
    }
  }
  sub = sub * Pow(mul[n], p - 2) % p;
  ans = (ans - sub) % p;
  for (long long i = 1; i <= n; i++)
    ans = (ans - (1 + (i != n)) * mul[max(gcd(i, n), i)]) % p;
  ans = ans * Pow(mul[n], p - 2) % p;
  ans = (ans % p + p) % p;
  printf("%lld\n", ans);
  return 0;
}

### Prompt

Your challenge is to write a CPP solution 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>
using namespace std;
const long long p = 1e9 + 7;
inline long long read() {
  long long neg = 1, num = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') neg = -1;
  for (; isdigit(c); c = getchar()) num = (num << 1) + (num << 3) + c - '0';
  return neg * num;
}
long long n, k, tot, f[200010], g[200010], fac[200010], inv[200010],
    pri[200010], mu[200010], mul[200010];
bool vis[200010];
inline long long Pow(long long x, long long y) {
  long long res = 1;
  for (; y; y >>= 1, x = x * x % p)
    if (y & 1) res = res * x % p;
  return res;
}
inline long long C(long long x, long long y) {
  return fac[x] * inv[y] % p * inv[x - y] % p;
}
inline long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
inline void sieve() {
  vis[1] = mu[1] = 1;
  for (long long i = 2; i <= n; i++) {
    if (!vis[i]) pri[++tot] = i, mu[i] = -1;
    for (long long j = 1; j <= tot && pri[j] * i <= n; j++) {
      vis[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
      mu[i * pri[j]] = -mu[i];
    }
  }
  fac[0] = inv[0] = mul[0] = 1;
  for (long long i = 1; i <= 2 * n; i++)
    fac[i] = fac[i - 1] * i % p, mul[i] = mul[i - 1] * k % p;
  inv[2 * n] = Pow(fac[2 * n], p - 2);
  for (long long i = 2 * n - 1; i >= 1; i--) inv[i] = inv[i + 1] * (i + 1) % p;
  for (long long i = 2; i <= n; i++)
    f[i] = (f[i - 1] + (i - 1) * mul[i] % p) % p;
}
signed main() {
  n = read();
  k = read();
  sieve();
  long long ans = 0, sub = 0;
  for (long long i = 2; i <= 2 * n; i++) {
    if (i <= n)
      ans = (ans + (i - 1) * mul[i] % p) % p;
    else
      ans = (ans + (2 * n - i + 1) * mul[i] % p) % p;
  }
  ans = ans * Pow(mul[n], p - 2) % p;
  for (long long d = 1; d <= n; d++) {
    for (long long T = d; T <= n; T += d) {
      long long s1 = (n / T) * (n / T - 1) / 2 % p, s2 = Pow(f[n / T], T);
      if ((n + d - 1) / T != n / T)
        s1 = (s1 + (n + d - 1) / T - 1) % p,
        s2 = (s2 + ((n + d - 1) / T - 1) * mul[(n + d - 1) / T * T] % p) % p;
      ans = (ans + s1 * mul[d] * mu[T / d] % p) % p;
      sub = (sub + s2 * mu[T / d]) % p;
    }
  }
  sub = sub * Pow(mul[n], p - 2) % p;
  ans = (ans - sub) % p;
  for (long long i = 1; i <= n; i++)
    ans = (ans - (1 + (i != n)) * mul[max(gcd(i, n), i)]) % p;
  ans = ans * Pow(mul[n], p - 2) % p;
  ans = (ans % p + p) % p;
  printf("%lld\n", ans);
  return 0;
}

```