Score : 300 points
Given is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition:
Input is given from Standard Input in the following format:
N D_1 D_2 ... D_N
Print the answer.
4 0 1 1 2
2
For example, a tree with edges (1,2), (1,3), and (2,4) satisfies the condition.
4 1 1 1 1
0
7 0 3 2 1 2 2 1
24