#include <bits/stdc++.h>
using namespace std;
inline long long max(long long x, long long y) { return x > y ? x : y; }
inline long long min(long long x, long long y) { return x < y ? x : y; }
inline long long gcd(long long n, long long m) { return m ? gcd(m, n % m) : n; }
inline long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
inline void swap(long long &x, long long &y) {
  long long t = x;
  x = y;
  y = t;
  return;
}
namespace yspm {
inline long long read() {
  long long res = 0, f = 1;
  char k;
  while (!isdigit(k = getchar()))
    if (k == '-') f = -1;
  while (isdigit(k)) res = res * 10 + k - '0', k = getchar();
  return res * f;
}
const long long mod = 1e9 + 7;
inline long long add(long long x, long long y) {
  return x + y >= mod ? x + y - mod : x + y;
}
inline long long del(long long x, long long y) {
  return x - y < 0 ? x - y + mod : x - y;
}
inline long long mul(long long x, long long y) {
  return x * y - x * y / mod * mod;
}
inline long long ksm(long long x, long long y) {
  long long res = 1;
  for (; y; y >>= 1, x = mul(x, x))
    if (y & 1) res = mul(res, x);
  return res;
}
const long long N = 4e5 + 10;
long long p[N], phi[N], n, k, pri[N], fl[N], cnt, s[N];
signed main() {
  n = read();
  k = read();
  phi[1] = 1;
  for (register long long i = 2; i < N; ++i) {
    if (!fl[i]) pri[++cnt] = i, phi[i] = i - 1;
    for (register long long j = 1; j <= cnt && i * pri[j] < N; ++j) {
      fl[i * pri[j]] = 1;
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = phi[i] * pri[j];
        break;
      } else
        phi[i * pri[j]] = phi[i] * (pri[j] - 1);
    }
  }
  p[0] = 1;
  for (register long long i = 1; i < N; ++i)
    s[i] = add(phi[i], s[i - 1]), p[i] = mul(p[i - 1], k);
  long long sum3 = 0, sum2 = 0, sum1 = 0, in = ksm(p[n], mod - 2);
  for (register long long i = n + 1; i <= 2 * n - 2; ++i)
    sum1 = add(sum1, mul(n * 2 - i - 1, p[i]));
  sum1 = mul(sum1, in);
  for (register long long i = 1; i < n; ++i)
    sum2 = add(sum2, mul(p[i], del(s[(n - 1) / i + 1], 1)));
  for (register long long i = 2; i <= n - 1; ++i)
    if (n % i)
      sum3 = add(mul(p[((n - 1) / i + 1) * i], phi[(n - 1) / i + 1]), sum3);
  sum3 = mul(sum3, in);
  printf("%lld\n", mul(in, add(sum1, del(sum2, sum3))));
  return 0;
}
}  // namespace yspm
signed main() { return yspm::main(); }

### Prompt

Your task is to create 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;
inline long long max(long long x, long long y) { return x > y ? x : y; }
inline long long min(long long x, long long y) { return x < y ? x : y; }
inline long long gcd(long long n, long long m) { return m ? gcd(m, n % m) : n; }
inline long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
inline void swap(long long &x, long long &y) {
  long long t = x;
  x = y;
  y = t;
  return;
}
namespace yspm {
inline long long read() {
  long long res = 0, f = 1;
  char k;
  while (!isdigit(k = getchar()))
    if (k == '-') f = -1;
  while (isdigit(k)) res = res * 10 + k - '0', k = getchar();
  return res * f;
}
const long long mod = 1e9 + 7;
inline long long add(long long x, long long y) {
  return x + y >= mod ? x + y - mod : x + y;
}
inline long long del(long long x, long long y) {
  return x - y < 0 ? x - y + mod : x - y;
}
inline long long mul(long long x, long long y) {
  return x * y - x * y / mod * mod;
}
inline long long ksm(long long x, long long y) {
  long long res = 1;
  for (; y; y >>= 1, x = mul(x, x))
    if (y & 1) res = mul(res, x);
  return res;
}
const long long N = 4e5 + 10;
long long p[N], phi[N], n, k, pri[N], fl[N], cnt, s[N];
signed main() {
  n = read();
  k = read();
  phi[1] = 1;
  for (register long long i = 2; i < N; ++i) {
    if (!fl[i]) pri[++cnt] = i, phi[i] = i - 1;
    for (register long long j = 1; j <= cnt && i * pri[j] < N; ++j) {
      fl[i * pri[j]] = 1;
      if (i % pri[j] == 0) {
        phi[i * pri[j]] = phi[i] * pri[j];
        break;
      } else
        phi[i * pri[j]] = phi[i] * (pri[j] - 1);
    }
  }
  p[0] = 1;
  for (register long long i = 1; i < N; ++i)
    s[i] = add(phi[i], s[i - 1]), p[i] = mul(p[i - 1], k);
  long long sum3 = 0, sum2 = 0, sum1 = 0, in = ksm(p[n], mod - 2);
  for (register long long i = n + 1; i <= 2 * n - 2; ++i)
    sum1 = add(sum1, mul(n * 2 - i - 1, p[i]));
  sum1 = mul(sum1, in);
  for (register long long i = 1; i < n; ++i)
    sum2 = add(sum2, mul(p[i], del(s[(n - 1) / i + 1], 1)));
  for (register long long i = 2; i <= n - 1; ++i)
    if (n % i)
      sum3 = add(mul(p[((n - 1) / i + 1) * i], phi[(n - 1) / i + 1]), sum3);
  sum3 = mul(sum3, in);
  printf("%lld\n", mul(in, add(sum1, del(sum2, sum3))));
  return 0;
}
}  // namespace yspm
signed main() { return yspm::main(); }

```