#P5437. 【XR-2】约定

【XR-2】约定

Description

Just because of that promise, Xiaoyan began a wait with no end in sight.

In Xiaoyan's heart, the promise turned into a graph with nn vertices. At the beginning, it was a complete graph. The vertices are numbered from 11 to nn, and the weight of the edge connecting vertices i,ji, j is (i+j)k(i+j)^k.

However, during the waiting, time was also slowly wearing away her faith, so some edges in the graph were randomly deleted. In the end, the graph became a tree with nn vertices, and stayed in Xiaoyan's heart forever.

A very, very long time later, Xiaoyan's magic ran out, and she was on the verge of breaking down in pain and despair. Just then, Xiaoyuan finally came to find Xiaoyan. To save her only friend, she must know the result of the expected total edge weight of this tree modulo 998244353998244353.

Can you help Xiaoyuan compute the answer, so she can fulfill that promise?

Input Format

One line with two positive integers n,kn, k.

Output Format

One line with one integer, the value of the answer modulo 998244353998244353.

3 1

8

4 3

450

1926 817

984167516

Hint

[Sample 11 Explanation]

This complete graph has 33 nodes and 33 edges, forming a cycle.
The weights of these edges are: 3,4,53, 4, 5.
In the end, there are also 33 possible trees, with total weights 7,8,97, 8, 9.
The expected value is 88.

[Constraints and Agreements]

This problem uses bundled testdata.

Subtask 1 (5 points): 1n51 \le n \le 5, 1k101 \le k \le 10.
Subtask 2 (11 points): k=1k = 1.
Subtask 3 (11 points): 1n,k200001 \le n, k \le 20000.
Subtask 4 (13 points): 1n,k1051 \le n, k \le 10^5.
Subtask 5 (23 points): 1k1051 \le k \le 10^5.
Subtask 6 (37 points): no special constraints.

For 100%100\% of the data, 1n9982443521 \le n \le 998244352, 1k1071 \le k \le 10^7.


"Sorry to have kept you waiting... You have worked so hard until today..."

"Xiaoyuan..."

"Come, let's go. From now on, we will never be apart..."

"Yes. I have been waiting for this moment—so long it felt like forever."

Translated by ChatGPT 5