P28483 [洛谷] 【XR-2】Promise
提高+
题目描述

Background

"XiaoYuan, don't go! When will we meet again after this separation?"

"XiaoYan, we will definitely meet again! Until then, it's just a brief farewell..."

Problem Description

Because of that one promise, XiaoYan began an endless wait.

The promise transformed into a graph with $n$ vertices in XiaoYan's mind. Initially, it was a complete graph where vertex numbers ranged from $1$ to $n$, and the weight of the edge connecting vertices $i$ and $j$ was $(i+j)^k$.

However, during the wait, time gradually eroded her faith, and some edges were randomly removed. Eventually, the graph became a tree with $n$ vertices, forever etched in XiaoYan's heart.

A long, long time later, XiaoYan's magic was exhausted, and she was on the brink of collapse in pain and despair. It was then that XiaoYuan finally came to find XiaoYan. To save her only friend, she needed to know the expected sum of the tree's edge weights modulo $998244353$.

Can you help XiaoYuan find the answer so she can fulfill that promise?

Input Format

A line containing two positive integers $n, k$.

Output Format

A line containing one integer, the answer modulo $998244353$.

Sample Input and Output

Sample Input #1

3 1

Sample Output #1

8

Sample Input #2

4 3

Sample Output #2

450

Sample Input #3

1926 817

Sample Output #3

984167516

Notes

Sample 1 Explanation

This complete graph has $3$ nodes and $3$ edges, forming a cycle.
The weights of these edges are: $3, 4, 5$
The final tree can have $3$ possible configurations with weights: $7, 8, 9$
The expected value is $8$.

Data Range and Constraints

This problem uses subtask testing.

Subtask 1 (5 points): $1 \le n \le 5$, $1 \le k \le 10$.
Subtask 2 (11 points): $k = 1$.
Subtask 3 (11 points): $1 \le n, k \le 20000$.
Subtask 4 (13 points): $1 \le n, k \le 10^5$.
Subtask 5 (23 points): $1 \le k \le 10^5$.
Subtask 6 (37 points): No additional constraints.

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

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1
样例输出
8