#agc058f. [agc058_f]Authentic Tree DP

[agc058_f]Authentic Tree DP

Problem Statement

For an undirected tree tt, let us define a rational number f(t)f(t) as follows.

  • Let nn be the number of vertices in tt.
  • If n=1n=1: Let f(t)=1f(t)=1.
  • If ngeq2n \\geq 2:
    • For an edge ee in tt, we denote by tx(e)t_x(e) and ty(e)t_y(e) the two trees that result from deleting ee from tt (in arbitrary order).
    • Let $f(t)=(\\sum_{e \\in t} f(t_x(e)) \\times f(t_y(e)))/n$.

You are given a tree TT with NN vertices numbered 11 to NN. The ii-th edge connects Vertex AiA_i and Vertex BiB_i.

Find the value f(T)f(T) textmod998244353\\text{mod }{998244353}.

What is a rational number textmod998244353\\text{mod }{998244353}?

Under the Constraints of this problem, when the sought rational number is represented as fracPQ\\frac{P}{Q}, it can be proved that Qneq0pmod998244353Q \\neq 0 \\pmod{998244353}. Therefore, there is a unique integer RR such that $R \\times Q \\equiv P \\pmod{998244353}, 0 \\leq R < 998244353$. Find this RR.

Constraints

  • 2leqNleq50002 \\leq N \\leq 5000
  • 1leqAi,BileqN1 \\leq A_i,B_i \\leq N
  • The given graph is a tree.

Input

Input is given from Standard Input in the following format:

NN A1A_1 B1B_1 A2A_2 B2B_2 vdots\\vdots AN1A_{N-1} BN1B_{N-1}

Output

Print the answer.


Sample Input 1

2
1 2

Sample Output 1

499122177

We have f(T)=1/2f(T)=1/2.


Sample Input 2

3
1 2
2 3

Sample Output 2

332748118

We have f(T)=1/3f(T)=1/3.


Sample Input 3

4
1 2
2 3
3 4

Sample Output 3

103983787

Sample Input 4

10
4 5
1 9
6 1
8 4
5 9
4 7
3 10
5 2
4 3

Sample Output 4

462781191