#include <bits/stdc++.h>
using std::max;
using std::min;
const int inf = 0x3f3f3f3f, Inf = 0x7fffffff;
const long long INF = 0x3f3f3f3f3f3f3f3f;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <typename _Tp>
_Tp gcd(const _Tp &a, const _Tp &b) {
  return !b ? a : gcd(b, a % b);
}
template <typename _Tp>
inline _Tp abs(const _Tp &a) {
  return a >= 0 ? a : -a;
}
template <typename _Tp>
inline void chmax(_Tp &a, const _Tp &b) {
  a = a < b ? b : a;
}
template <typename _Tp>
inline void chmin(_Tp &a, const _Tp &b) {
  a = a < b ? a : b;
}
template <typename _Tp>
inline void read(_Tp &x) {
  char ch(getchar());
  bool f(false);
  while (!isdigit(ch)) f |= ch == 45, ch = getchar();
  x = ch & 15, ch = getchar();
  while (isdigit(ch)) x = (((x << 2) + x) << 1) + (ch & 15), ch = getchar();
  f && (x = -x);
}
template <typename _Tp, typename... Args>
void read(_Tp &t, Args &...args) {
  read(t);
  read(args...);
}
inline int read_str(char *s) {
  char ch(getchar());
  while (ch == ' ' || ch == '\r' || ch == '\n') ch = getchar();
  char *tar = s;
  *tar++ = ch, ch = getchar();
  while (ch != ' ' && ch != '\r' && ch != '\n' && ch != EOF)
    *tar++ = ch, ch = getchar();
  return *tar = 0, tar - s;
}
const int N = 100005;
const int mod = 1000000007;
template <typename _Tp1, typename _Tp2>
inline void add(_Tp1 &a, _Tp2 b) {
  (a += b) >= mod && (a -= mod);
}
template <typename _Tp1, typename _Tp2>
inline void sub(_Tp1 &a, _Tp2 b) {
  (a -= b) < 0 && (a += mod);
}
long long ksm(long long a, long long b = mod - 2) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod, b >>= 1;
  }
  return res;
}
bool pr[N];
int mu[N], p[N], pos, pw[N];
void sieve() {
  mu[1] = 1;
  for (int i = 2; i < N; ++i) {
    if (!pr[i]) p[++pos] = i, mu[i] = -1;
    for (int j = 1; j <= pos && p[j] * i < N; ++j) {
      pr[i * p[j]] = true;
      if (i % p[j] == 0) {
        mu[i * p[j]] = 0;
        break;
      }
      mu[i * p[j]] = -mu[i];
    }
  }
}
int cnt[N << 1];
int main() {
  sieve();
  int n, k;
  read(n, k);
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) pw[i] = 1LL * pw[i - 1] * k % mod;
  int ans = 0;
  for (int g = 1; g < n; ++g) {
    int m = (n - 1) / g;
    memset(cnt, 0, (m + m + 3) << 2);
    for (int d = 1; d <= m; ++d)
      if (mu[d]) {
        int lim = m / d;
        if (mu[d] == 1)
          for (int j = 1; j <= lim + lim; ++j)
            add(cnt[d * j], min(j - 1, lim + lim - j + 1));
        else
          for (int j = 1; j <= lim + lim; ++j)
            sub(cnt[d * j], min(j - 1, lim + lim - j + 1));
      }
    for (int i = 1; i <= m + m; ++i)
      add(ans, 1LL * pw[max(g, i * g - n)] * cnt[i] % mod);
  }
  printf("%lld\n", 1LL * ans * ksm(ksm(k, n)) % mod);
  return 0;
}

### Prompt

In Cpp, your task is to solve 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 std::max;
using std::min;
const int inf = 0x3f3f3f3f, Inf = 0x7fffffff;
const long long INF = 0x3f3f3f3f3f3f3f3f;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <typename _Tp>
_Tp gcd(const _Tp &a, const _Tp &b) {
  return !b ? a : gcd(b, a % b);
}
template <typename _Tp>
inline _Tp abs(const _Tp &a) {
  return a >= 0 ? a : -a;
}
template <typename _Tp>
inline void chmax(_Tp &a, const _Tp &b) {
  a = a < b ? b : a;
}
template <typename _Tp>
inline void chmin(_Tp &a, const _Tp &b) {
  a = a < b ? a : b;
}
template <typename _Tp>
inline void read(_Tp &x) {
  char ch(getchar());
  bool f(false);
  while (!isdigit(ch)) f |= ch == 45, ch = getchar();
  x = ch & 15, ch = getchar();
  while (isdigit(ch)) x = (((x << 2) + x) << 1) + (ch & 15), ch = getchar();
  f && (x = -x);
}
template <typename _Tp, typename... Args>
void read(_Tp &t, Args &...args) {
  read(t);
  read(args...);
}
inline int read_str(char *s) {
  char ch(getchar());
  while (ch == ' ' || ch == '\r' || ch == '\n') ch = getchar();
  char *tar = s;
  *tar++ = ch, ch = getchar();
  while (ch != ' ' && ch != '\r' && ch != '\n' && ch != EOF)
    *tar++ = ch, ch = getchar();
  return *tar = 0, tar - s;
}
const int N = 100005;
const int mod = 1000000007;
template <typename _Tp1, typename _Tp2>
inline void add(_Tp1 &a, _Tp2 b) {
  (a += b) >= mod && (a -= mod);
}
template <typename _Tp1, typename _Tp2>
inline void sub(_Tp1 &a, _Tp2 b) {
  (a -= b) < 0 && (a += mod);
}
long long ksm(long long a, long long b = mod - 2) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod, b >>= 1;
  }
  return res;
}
bool pr[N];
int mu[N], p[N], pos, pw[N];
void sieve() {
  mu[1] = 1;
  for (int i = 2; i < N; ++i) {
    if (!pr[i]) p[++pos] = i, mu[i] = -1;
    for (int j = 1; j <= pos && p[j] * i < N; ++j) {
      pr[i * p[j]] = true;
      if (i % p[j] == 0) {
        mu[i * p[j]] = 0;
        break;
      }
      mu[i * p[j]] = -mu[i];
    }
  }
}
int cnt[N << 1];
int main() {
  sieve();
  int n, k;
  read(n, k);
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) pw[i] = 1LL * pw[i - 1] * k % mod;
  int ans = 0;
  for (int g = 1; g < n; ++g) {
    int m = (n - 1) / g;
    memset(cnt, 0, (m + m + 3) << 2);
    for (int d = 1; d <= m; ++d)
      if (mu[d]) {
        int lim = m / d;
        if (mu[d] == 1)
          for (int j = 1; j <= lim + lim; ++j)
            add(cnt[d * j], min(j - 1, lim + lim - j + 1));
        else
          for (int j = 1; j <= lim + lim; ++j)
            sub(cnt[d * j], min(j - 1, lim + lim - j + 1));
      }
    for (int i = 1; i <= m + m; ++i)
      add(ans, 1LL * pw[max(g, i * g - n)] * cnt[i] % mod);
  }
  printf("%lld\n", 1LL * ans * ksm(ksm(k, n)) % mod);
  return 0;
}

```