#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
long long read() {
  char ch = getchar();
  long long x = 0, flag = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flag *= -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
  return x * flag;
}
const int Maxn = 2e5 + 9, Mod = 1e9 + 7;
int fpm(int base, int tims) {
  int r = 1;
  while (tims) {
    if (tims & 1) r = 1ll * base * r % Mod;
    base = 1ll * base * base % Mod;
    tims >>= 1;
  }
  return r;
}
int mplus(int x, const int &y) {
  x += y;
  if (x >= Mod) x -= Mod;
  return x;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int isnprime[Maxn], prime[Maxn], tot, mu[Maxn];
void sieve(int Len) {
  mu[1] = 1;
  for (int i = (2), i_end_ = (Len); i <= i_end_; ++i) {
    if (!isnprime[i]) {
      mu[i] = Mod - 1;
      prime[++tot] = i;
    }
    for (int j = 1, k; (k = prime[j] * i) <= Len && j <= tot; ++j) {
      isnprime[k] = 1;
      if (i % prime[j] == 0) {
        mu[k] = 0;
        break;
      } else
        mu[k] = (Mod - mu[i]) % Mod;
    }
  }
}
int invk, n, k;
void Init() {
  n = read(), k = read();
  invk = fpm(k, Mod - 2);
  sieve(2 * n);
}
int cnt = 0;
vector<int> divs[Maxn * 2];
int calc(int d, int s, int bound) {
  if (!bound) return 0;
  int res = 0, u = s / d;
  for (int i = (0), i_end_ = (divs[u].size() - 1); i <= i_end_; ++i)
    res = mplus(res, 1ll * bound / divs[u][i] / d * mu[divs[u][i]] % Mod);
  return res;
}
int power[Maxn];
void Solve() {
  long long ans = 0;
  for (int d = (1), d_end_ = (n); d <= d_end_; ++d)
    for (int s = d; s <= 2 * n - 2; s += d) divs[s].push_back(d);
  power[0] = 1;
  for (int i = (1), i_end_ = (n); i <= i_end_; ++i)
    power[i] = 1ll * power[i - 1] * invk % Mod;
  for (int s = (2), s_end_ = (2 * n - 2); s <= s_end_; ++s)
    for (int i = (0), i_end_ = (divs[s].size() - 1); i <= i_end_; ++i) {
      int d = divs[s][i];
      int l = max(1, s + 1 - n), r = min(n - 1, s - 1);
      if (l > r) continue;
      int res = (1ll * calc(d, s, r) - calc(d, s, l - 1) + Mod) % Mod;
      ans = mplus(ans, 1ll * res * power[n - max(s - n, d)] % Mod);
    }
  cout << ans << endl;
}
int main() {
  Init();
  Solve();
  return 0;
}

### Prompt

Create a solution in Cpp for 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 double pi = acos(-1);
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
long long read() {
  char ch = getchar();
  long long x = 0, flag = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flag *= -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
  return x * flag;
}
const int Maxn = 2e5 + 9, Mod = 1e9 + 7;
int fpm(int base, int tims) {
  int r = 1;
  while (tims) {
    if (tims & 1) r = 1ll * base * r % Mod;
    base = 1ll * base * base % Mod;
    tims >>= 1;
  }
  return r;
}
int mplus(int x, const int &y) {
  x += y;
  if (x >= Mod) x -= Mod;
  return x;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int isnprime[Maxn], prime[Maxn], tot, mu[Maxn];
void sieve(int Len) {
  mu[1] = 1;
  for (int i = (2), i_end_ = (Len); i <= i_end_; ++i) {
    if (!isnprime[i]) {
      mu[i] = Mod - 1;
      prime[++tot] = i;
    }
    for (int j = 1, k; (k = prime[j] * i) <= Len && j <= tot; ++j) {
      isnprime[k] = 1;
      if (i % prime[j] == 0) {
        mu[k] = 0;
        break;
      } else
        mu[k] = (Mod - mu[i]) % Mod;
    }
  }
}
int invk, n, k;
void Init() {
  n = read(), k = read();
  invk = fpm(k, Mod - 2);
  sieve(2 * n);
}
int cnt = 0;
vector<int> divs[Maxn * 2];
int calc(int d, int s, int bound) {
  if (!bound) return 0;
  int res = 0, u = s / d;
  for (int i = (0), i_end_ = (divs[u].size() - 1); i <= i_end_; ++i)
    res = mplus(res, 1ll * bound / divs[u][i] / d * mu[divs[u][i]] % Mod);
  return res;
}
int power[Maxn];
void Solve() {
  long long ans = 0;
  for (int d = (1), d_end_ = (n); d <= d_end_; ++d)
    for (int s = d; s <= 2 * n - 2; s += d) divs[s].push_back(d);
  power[0] = 1;
  for (int i = (1), i_end_ = (n); i <= i_end_; ++i)
    power[i] = 1ll * power[i - 1] * invk % Mod;
  for (int s = (2), s_end_ = (2 * n - 2); s <= s_end_; ++s)
    for (int i = (0), i_end_ = (divs[s].size() - 1); i <= i_end_; ++i) {
      int d = divs[s][i];
      int l = max(1, s + 1 - n), r = min(n - 1, s - 1);
      if (l > r) continue;
      int res = (1ll * calc(d, s, r) - calc(d, s, l - 1) + Mod) % Mod;
      ans = mplus(ans, 1ll * res * power[n - max(s - n, d)] % Mod);
    }
  cout << ans << endl;
}
int main() {
  Init();
  Solve();
  return 0;
}

```