#include <bits/stdc++.h>
using namespace std;
const long long p = 1e9 + 7;
long long po(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 0) {
    long long u = po(a, b / 2);
    return (u * u) % p;
  } else {
    long long u = po(a, b - 1);
    return (a * u) % p;
  }
}
long long inv(long long x) { return po(x, p - 2); }
vector<long long> rasl(long long x) {
  vector<long long> v;
  if (x == 1) return v;
  for (long long i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      v = rasl(x / i);
      v.push_back(i);
      return v;
    }
  }
  v.push_back(x);
  return v;
}
vector<long long> del(long long x) {
  vector<long long> v;
  for (long long i = 1; i * i <= x; ++i) {
    if (x % i == 0) {
      v.push_back(i);
      if ((i * i) != x) {
        v.push_back(x / i);
      }
    }
  }
  return v;
}
long long slv1(long long x) {
  long long ans = 0;
  for (long long i = 1; i < x; ++i) {
    vector<long long> v = rasl(i);
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    long long sz = v.size();
    for (long long mask = 0; mask < (1 << sz); ++mask) {
      long long u = 1;
      long long z = 1;
      for (long long i = 0; i < sz; ++i) {
        if (mask & (1 << i)) {
          z *= v[i];
          u *= (-1);
        }
      }
      ans += (((x - i) / z) * u);
      ans %= p;
    }
  }
  ans %= p;
  ans += p;
  ans %= p;
  return ans;
}
long long f(long long l, long long r, long long x) {
  long long ans = 0;
  vector<long long> v = rasl(x);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  long long sz = v.size();
  for (long long mask = 0; mask < (1 << sz); ++mask) {
    long long u = 1;
    long long z = 1;
    for (long long i = 0; i < sz; ++i) {
      if (mask & (1 << i)) {
        z *= v[i];
        u *= (-1);
      }
    }
    ans += u * ((r / z) - ((l - 1) / z));
    ans %= p;
  }
  ans %= p;
  ans += p;
  ans %= p;
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long l = inv(k);
  long long po[n + 1];
  po[0] = 1;
  for (long long i = 1; i <= n; ++i) {
    po[i] = po[i - 1] * l;
    po[i] %= p;
  }
  long long ans = 0;
  for (long long i = 1; i < n; ++i) {
    ans += po[n - i];
    ans %= p;
  }
  for (long long d = 1; d < n; ++d) {
    long long x = ((n - 1) / d + 1);
    long long u = slv1(x);
    u--;
    u %= p;
    ans += u * po[n - d];
    ans %= p;
  }
  for (long long x = n; x < (2 * n - 1); ++x) {
    vector<long long> z = del(x);
    for (auto d : z) {
      long long l = (x + d - n + 1);
      long long r = (n - 1);
      if (l > r) continue;
      r /= d;
      l += (d - 1);
      l /= d;
      if (l > r) continue;
      ans += f(l, r, (x / d) + 1) * po[2 * n - x - d];
      ans %= p;
    }
  }
  cout << ans;
  return 0;
}

### Prompt

Please formulate 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;
const long long p = 1e9 + 7;
long long po(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 0) {
    long long u = po(a, b / 2);
    return (u * u) % p;
  } else {
    long long u = po(a, b - 1);
    return (a * u) % p;
  }
}
long long inv(long long x) { return po(x, p - 2); }
vector<long long> rasl(long long x) {
  vector<long long> v;
  if (x == 1) return v;
  for (long long i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      v = rasl(x / i);
      v.push_back(i);
      return v;
    }
  }
  v.push_back(x);
  return v;
}
vector<long long> del(long long x) {
  vector<long long> v;
  for (long long i = 1; i * i <= x; ++i) {
    if (x % i == 0) {
      v.push_back(i);
      if ((i * i) != x) {
        v.push_back(x / i);
      }
    }
  }
  return v;
}
long long slv1(long long x) {
  long long ans = 0;
  for (long long i = 1; i < x; ++i) {
    vector<long long> v = rasl(i);
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    long long sz = v.size();
    for (long long mask = 0; mask < (1 << sz); ++mask) {
      long long u = 1;
      long long z = 1;
      for (long long i = 0; i < sz; ++i) {
        if (mask & (1 << i)) {
          z *= v[i];
          u *= (-1);
        }
      }
      ans += (((x - i) / z) * u);
      ans %= p;
    }
  }
  ans %= p;
  ans += p;
  ans %= p;
  return ans;
}
long long f(long long l, long long r, long long x) {
  long long ans = 0;
  vector<long long> v = rasl(x);
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  long long sz = v.size();
  for (long long mask = 0; mask < (1 << sz); ++mask) {
    long long u = 1;
    long long z = 1;
    for (long long i = 0; i < sz; ++i) {
      if (mask & (1 << i)) {
        z *= v[i];
        u *= (-1);
      }
    }
    ans += u * ((r / z) - ((l - 1) / z));
    ans %= p;
  }
  ans %= p;
  ans += p;
  ans %= p;
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long l = inv(k);
  long long po[n + 1];
  po[0] = 1;
  for (long long i = 1; i <= n; ++i) {
    po[i] = po[i - 1] * l;
    po[i] %= p;
  }
  long long ans = 0;
  for (long long i = 1; i < n; ++i) {
    ans += po[n - i];
    ans %= p;
  }
  for (long long d = 1; d < n; ++d) {
    long long x = ((n - 1) / d + 1);
    long long u = slv1(x);
    u--;
    u %= p;
    ans += u * po[n - d];
    ans %= p;
  }
  for (long long x = n; x < (2 * n - 1); ++x) {
    vector<long long> z = del(x);
    for (auto d : z) {
      long long l = (x + d - n + 1);
      long long r = (n - 1);
      if (l > r) continue;
      r /= d;
      l += (d - 1);
      l /= d;
      if (l > r) continue;
      ans += f(l, r, (x / d) + 1) * po[2 * n - x - d];
      ans %= p;
    }
  }
  cout << ans;
  return 0;
}

```