#P5442. 【XR-2】约定 (加强版)

【XR-2】约定 (加强版)

Description

There is a complete graph with nn vertices, numbered from 11 to nn.
For the edge connecting vertices ii and jj, its weight is (i+j)k(i+j)^k.
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 998244353998244353.

Input Format

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

Output Format

One line containing one integer, representing the answer modulo 998244353998244353.

3 1
8
4 3
450
1926 817
984167516
998244353 1
998244352

Hint

Constraints

1n10100001\le n \le 10^{10000}
1k1071\le k \le 10^7

Translated by ChatGPT 5