题目描述
Problem Description
ckw has an undirected tree. He will randomly select a node and start a random walk, where each unit of time he jumps to any node within a distance of at most $2$ from the current node with equal probability. There are some nodes marked on the tree. Calculate the expected time for ckw to first reach a marked node.
Input Format
The first line contains two numbers $n$ and $m$, representing the number of nodes and the number of marked nodes, respectively.
The next $n-1$ lines each contain two numbers $x$ and $y$, indicating that there is an edge between nodes $x$ and $y$.
The next $m$ lines each contain a number representing a marked node (may have duplicates).
Output Format
Output $n$ lines, each containing a number. The $i$-th line represents the expected number of steps starting from node $i$, modulo $998244353$.
Sample Input and Output
Sample Input #1
2 1
1 2
1
Sample Output #1
0
2
Sample Input #2
10 2
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
2
5
Sample Output #2
3
0
3
4
0
8
10
13
14
15
Sample Input #3
10 2
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
3
6
Sample Output #3
5
5
0
5
5
0
5
5
5
5
Notes
$2 \le n \le 10^5, 1 \le m \le n$
$subtask1(20pts): n \le 300$
$subtask2(16pts):$ The $i$-th edge connects nodes $i$ and $i+1$
$subtask3(8pts):$ The $i$-th edge connects nodes $1$ and $i+1$
$subtask4(20pts): n \le 3000$, and the maximum degree of any node is at most $4$
$subtask5(36pts):$ No additional restrictions
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分