Given a integer

, you are asked to calculate the sum of the diameter of all unrooted labeled trees with

nodes labeled from

to

. Here the diameter of a tree is the length of the longest simple path on this tree, and the length of a path is the number of edges along this path.
Since the answer may be too large, you only need to output the result modulo a given prime number

.
输入描述:
The input contains two integers
and
, where
is a prime number.
输出描述:
Output a single integer, indicating the sum of the diameter of all labeled trees with
nodes modulo
.