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.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using std::max;
using std::vector;
const int MOD = 1e9 + 7;
int sum(int a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
  return a;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
int mult(int a, int b) { return (a * 1LL * b) % MOD; }
int bin_pow(int a, int n) {
  int res = 1;
  for (; n; n >>= 1, a = mult(a, a))
    if (n & 1) res = mult(res, a);
  return res;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int N = 2e5;
vector<int> cnt[N], divs[N];
int mu[N], sm[N], pw[N];
bool used[N];
vector<int> g[N];
void dfs(int v) {
  used[v] = true;
  for (int u : g[v])
    if (!used[u]) dfs(u);
}
int func(int n, int a, int b) {
  for (int i = 0; i < n; ++i) {
    g[i].clear();
    used[i] = false;
  }
  for (int i = a; i < n; ++i) {
    g[i].push_back(i - a);
    g[i - a].push_back(i);
  }
  for (int i = b; i < n; ++i) {
    g[i].push_back(i - b);
    g[i - b].push_back(i);
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (used[i]) continue;
    dfs(i);
    ++res;
  }
  return res;
}
int ffunc(int n, int a, int b) {
  int d = gcd(a, b);
  return (d - (n % d)) * max(1, (a + b) / d - (n / d)) +
         (n % d) * max(1, (a + b) / d - (n + d - 1) / d);
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int x = 1; x <= 2 * n; ++x)
    for (int y = x; y <= 2 * n; y += x) divs[y].push_back(x);
  mu[1] = 1;
  for (int x = 1; x <= 2 * n; ++x)
    for (int y = x + x; y <= 2 * n; y += x) mu[y] -= mu[x];
  for (int d = 1; d <= n; ++d) {
    int nn = n / d;
    if (used[nn]) continue;
    cnt[nn].resize(2 * nn + 1);
    for (int s = 2; s <= nn; ++s) {
      for (int x : divs[s]) cnt[nn][s] += mu[x] * (s / x - 1);
      cnt[nn][s] %= MOD;
      sm[nn] = sum(sm[nn], cnt[nn][s]);
    }
    for (int s = nn + 1; s <= 2 * nn; ++s) {
      for (int x : divs[s])
        cnt[nn][s] += mu[x] * max(0, ((nn) / x - (s / x - (nn) / x) + 1));
      cnt[nn][s] %= MOD;
    }
    used[nn] = true;
  }
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) pw[i] = mult(pw[i - 1], k);
  int ans = 0;
  for (int d = 1; d <= n; ++d) {
    ans = sum(ans, mult(sm[n / d], pw[d]));
    ans = sum(ans, mult(cnt[n / d][n / d + 1], pw[d]));
    for (int y = 2; y * d < n; ++y)
      ans = sum(ans, mult(cnt[n / d][n / d + y], pw[y * d - (n % d)]));
  }
  for (int a = 1; a < n; ++a) ans = sub(ans, pw[ffunc(n, a, n)]);
  for (int b = 1; b <= n; ++b) ans = sub(ans, pw[ffunc(n, n, b)]);
  ans = mult(ans, bin_pow(pw[n], MOD - 2));
  printf("%d", ans);
}