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>
#pragma GCC target("pclmul")
using ul = std::uint32_t;
using ull = std::uint64_t;
using li = std::int32_t;
using ll = std::int64_t;
using llf = long double;
using us = std::uint16_t;
const ul mod = 1e9 + 7;
ul plus(ul a, ul b) { return a + b < mod ? a + b : a + b - mod; }
ul minus(ul a, ul b) { return a < b ? a + mod - b : a - b; }
ul mul(ul a, ul b) { return ull(a) * ull(b) % mod; }
void exgcd(li a, li b, li& x, li& y) {
  if (b) {
    exgcd(b, a % b, y, x);
    y -= a / b * x;
  } else {
    x = 1;
    y = 0;
  }
}
ul inverse(ul a) {
  li x, y;
  exgcd(a, mod, x, y);
  return x < 0 ? x + li(mod) : x;
}
ul n, k;
const ul maxn = 1e5;
std::vector<ul> prime;
bool notprime[maxn + 2];
ul mu[maxn + 2];
ul kpow[maxn + maxn + 1];
ul lambda[maxn + maxn + 1];
ul ans = 0;
ul f(ul p) { return (ull(p) * ull(p - 1) >> 1) % mod; }
ul kpowninv;
ul f(ul p, ul rg) {
  ul a = mul(kpow[rg], kpow[rg]);
  ul b = mul(mul(kpow[p * rg], a), minus(p, 1));
  ul c = mul(p, mul(kpow[p * rg], kpow[rg]));
  ul d = mul(kpowninv, minus(plus(a, b), c));
  return mul(mul(lambda[rg], lambda[rg]), d);
}
int main() {
  std::scanf("%u%u", &n, &k);
  mu[1] = 1;
  for (ul i = 2; i <= n + 1; ++i) {
    if (!notprime[i]) {
      prime.push_back(i);
      mu[i] = minus(0, 1);
    }
    for (ul p : prime) {
      if (i * p > n + 1) {
        break;
      }
      notprime[i * p] = true;
      if (i % p == 0) {
        break;
      } else {
        mu[i * p] = minus(0, mu[i]);
      }
    }
  }
  if (k == 1) {
    std::printf("%u\n", mul(n - 1, n - 1));
    return 0;
  }
  kpow[0] = 1;
  for (ul i = 1; i <= n + n; ++i) {
    kpow[i] = mul(kpow[i - 1], k);
    lambda[i] = inverse(minus(1, kpow[i]));
  }
  kpowninv = inverse(kpow[n]);
  ans = mul(mul(mul(mul(mul(kpow[2], kpowninv), lambda[1]), lambda[1]),
                minus(1, kpow[n])),
            minus(1, kpow[n]));
  for (ul g = 1; g <= n; ++g) {
    ul a = 0;
    ul b = 0;
    ul v = n / g + 1;
    for (ul r = 1; r <= v; ++r) {
      a = plus(a, mul(mu[r], f(v / r)));
      b = plus(b, mul(mu[r], f(v / r, r * g)));
    }
    ans = plus(ans, mul(kpow[g], a));
    ans = minus(ans, b);
  }
  for (ul i = 1; i <= n - 1; ++i) {
    ans = minus(ans, kpow[i]);
    ans = minus(ans, kpow[i]);
  }
  ans = minus(ans, kpow[n]);
  ans = mul(ans, kpowninv);
  std::printf("%u\n", ans);
  return 0;
}