#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-' && t != EOF; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  if (t == EOF) return false;
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
  return true;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
const int maxn = 100111;
int qpow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)ret * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ret;
}
int n, k, p[maxn];
long long cnt[maxn];
vector<int> divs[maxn * 2];
int main() {
  (get_int(n) && get_int(k));
  k = qpow(k, mod - 2);
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = (long long)p[i - 1] * k % mod;
  for (int i = 1; i < n; i++)
    for (int j = i; j < n * 2; j += i) divs[j].push_back(i);
  for (int s = 1; s < n + n; s++) {
    reverse(divs[s].begin(), divs[s].end());
    vector<int> ansv;
    for (auto g : divs[s]) {
      int lb = g, rb = (n - 1) / g * g;
      lb = max(lb, s - rb);
      rb = min(rb, s - lb);
      if (lb > rb)
        ansv.push_back(0);
      else
        ansv.push_back((rb - lb) / g + 1);
    }
    for (int i = 0; i < (int)divs[s].size(); i++) {
      for (int j = 0; j < i; j++)
        if (divs[s][j] % divs[s][i] == 0) ansv[i] -= ansv[j];
      int g = divs[s][i];
      if (s - g <= n)
        cnt[n - g] += ansv[i];
      else
        cnt[n + n - s] += ansv[i];
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + cnt[i] % mod * p[i]) % mod;
  printf("%d\n", ans);
  return 0;
}

### Prompt

Develop a solution in CPP to the problem described below:

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;
template <typename T>
bool get_int(T &x) {
  char t = getchar();
  bool neg = false;
  x = 0;
  for (; (t > '9' || t < '0') && t != '-' && t != EOF; t = getchar())
    ;
  if (t == '-') neg = true, t = getchar();
  if (t == EOF) return false;
  for (; t <= '9' && t >= '0'; t = getchar()) x = x * 10 + t - '0';
  if (neg) x = -x;
  return true;
}
template <typename T>
void print_int(T x) {
  if (x < 0) putchar('-'), x = -x;
  short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
const int inf = 0x3f3f3f3f;
const long long Linf = 1ll << 61;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
const int maxn = 100111;
int qpow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)ret * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ret;
}
int n, k, p[maxn];
long long cnt[maxn];
vector<int> divs[maxn * 2];
int main() {
  (get_int(n) && get_int(k));
  k = qpow(k, mod - 2);
  p[0] = 1;
  for (int i = 1; i <= n; i++) p[i] = (long long)p[i - 1] * k % mod;
  for (int i = 1; i < n; i++)
    for (int j = i; j < n * 2; j += i) divs[j].push_back(i);
  for (int s = 1; s < n + n; s++) {
    reverse(divs[s].begin(), divs[s].end());
    vector<int> ansv;
    for (auto g : divs[s]) {
      int lb = g, rb = (n - 1) / g * g;
      lb = max(lb, s - rb);
      rb = min(rb, s - lb);
      if (lb > rb)
        ansv.push_back(0);
      else
        ansv.push_back((rb - lb) / g + 1);
    }
    for (int i = 0; i < (int)divs[s].size(); i++) {
      for (int j = 0; j < i; j++)
        if (divs[s][j] % divs[s][i] == 0) ansv[i] -= ansv[j];
      int g = divs[s][i];
      if (s - g <= n)
        cnt[n - g] += ansv[i];
      else
        cnt[n + n - s] += ansv[i];
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans = (ans + cnt[i] % mod * p[i]) % mod;
  printf("%d\n", ans);
  return 0;
}

```