题目描述
Problem Description
Calculate the number of labeled rooted trees that satisfy the following conditions:
- The tree has exactly \( n \) nodes.
- Each node has an integer weight within the range \([1, m]\).
- The weight of each node is not greater than the weight of its parent node.
Since the answer may be very large, output the answer modulo \( 998244353 \).
Two trees \( T_1 \) and \( T_2 \) are considered different if and only if they have a different number of nodes, different root nodes, or there exists a node \( i \) such that the parent node of \( i \) in \( T_1 \) is different from the parent node of \( i \) in \( T_2 \), or the weight of node \( i \) is different in \( T_1 \) and \( T_2 \).
Input Format
A single line containing two positive integers \( n \) and \( m \), as described in the problem statement.
Output Format
A single integer representing the answer to the problem.
Sample Input and Output
Sample Input #1
2 2
Sample Output #1
6
Sample Input #2
4 6
Sample Output #2
13524
Sample Input #3
9 34
Sample Output #3
857311624
Notes
Sample Explanation
For the first sample,

The six trees are shown in the image above, where the numbers inside the circles are node identifiers, and the numbers outside the circles are node weights.
Data Range
"This problem uses batched testing."
For all test cases, it is guaranteed that \( 1 \leq n \leq 400 \) and \( 1 \leq m < 998244353 \).
- Subtask 1 (7 pts) \( n = 3, m = 3 \).
- Subtask 2 (11 pts) \( m = 1 \).
- Subtask 3 (19 pts) \( n, m \leq 6 \).
- Subtask 4 (17 pts) \( n \leq 7 \).
- Subtask 5 (11 pts) \( n, m \leq 50 \).
- Subtask 6 (35 pts) No special restrictions.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分