单点时限: 10.0 sec
内存限制: 256 MB
IDEA has a tree with $n(1\leq n\leq 5000)$ nodes. Now she select a connected subgraph on the tree randomly, please help her calculate the expected size of connected subgraph she select (module $998244353$).
There are multiple test cases.
For each test case, in the first line, there is an integer n, denoting the node number of the tree.
Then for the next $n-1$ lines, $i$-th line contains an integer $u$, indicate that there is an edge between $i+1$ and $u$.
For each test cases, print the answer in one line.
3 1 1