Rikka with Random Tree
题号:NC213949
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Generating tests is always a boring and error-prone task for problem setters.
Recently, Rikka set a problem on trees, and now, she wants to generate some tests for this problem. At this time, Rikka tries an unusual way to generate trees. To generate a tree of size n:
  1. Rikka sets vertex 1 as the root;
  2. For the i-th (i>1) vertex, let be all factors of i where . Rikka uniformly randoms an integer j from [1, k-1], and sets vertex a_j as the father of vertex i.
Clearly, the result of this process must be a valid tree.
Now, Rikka wants to verify whether the generated tests are strong enough. For a tree T of size n, she defines its complexity c(T) as :

where is the number of edges in the path from vertex i to vertex j on tree T.
Rikka wants you to calculate the expectation of c(T).

输入描述:

The first line contains two integers .
The input guarantees that p is a prime number.

输出描述:

Output a single line with a single integer, the answer module p. Formally, if the simplest fraction representation of the answer is , you need to output .
示例1

输入

复制
3 998244353

输出

复制
8

说明

There is only one possible result, of which the complexity is equal to 8.
示例2

输入

复制
4 998244353

输出

复制
19

说明

There are two possible results, corresponding to the cases when the father of vertex 4 is vertex 1 or vertex 2. The complexities of these two cases are 18 and 20 respectively.
示例3

输入

复制
100 998244353

输出

复制
928958194