#P5442. 【XR-2】约定 (加强版)
【XR-2】约定 (加强版)
Description
There is a complete graph with vertices, numbered from to .
For the edge connecting vertices and , its weight is .
Define the weight of a tree as the sum of the weights of all its edges.
Randomly choose a spanning tree from all spanning trees of this graph, and find the expected value of its weight.
You need to output the answer modulo .
Input Format
One line containing two positive integers .
Output Format
One line containing one integer, representing the answer modulo .
3 1
8
4 3
450
1926 817
984167516
998244353 1
998244352
Hint
Constraints
Translated by ChatGPT 5
京公网安备 11011102002149号