You are given a tree T of N nodes. You can pick a non-empty set of nodes S from T. Add minimal nodes and edges from T to S such that S becomes a connected graph G.
We define the cost of S defined as c to be the size of the minimum vertex cover of G.
Note that, minimum vertex cover of a graph is a set of vertices that includes at least one end point of every edge of the graph and size of the set is as minimum as possible.
You need to find the sum of cM for all possible sets S modulo 998244353.
Input
First line will contain a single integer T representing the test cases.
Each case starts with a blank line and two integers N and M. After that N - 1 lines follow. In each line there will be a space separated integers U and V denoting an edge between node U and V.
Constraints
- 1 ≤ T ≤ 1000
- 1 ≤ N ≤ 105
- Sum of N of all test cases is ≤ 105
- 1 ≤ U, V ≤ N and will form a valid Tree
- 0 ≤ M ≤ 200
Output
For each test case, print a single line containing the case number and the answer.
Sample
Sample Input | Sample Output |
---|---|
3 3 1 1 2 1 3 4 1 1 2 1 3 3 4 4 7 1 2 1 3 3 4 | Case 1: 4 Case 2: 15 Case 3: 519 |
Notes
- Minimum vertex cover of a single node graph is 0.
- Assume that $0^0 = 1$ for this problem if you need to compute it.
Explanation for Sample 1
Nodeset | Connected Tree | Min Vertex Cover | Cost, c | cM |
---|---|---|---|---|
Initial Tree, T |
|
- | - | - |
S1 = {1} |
|
|
0 | 0 |
S2 = {2} |
|
|
0 | 0 |
S3 = {3} |
|
|
0 | 0 |
S4 = {1, 2} |
|
|
1 | 1 |
S5 = {1, 3} |
|
|
1 | 1 |
S6 = {2, 3} |
|
|
1 | 1 |
S7 = {1, 2, 3} |
|
|
1 | 1 |
Total | 4 |