You are given a rooted tree of n vertices, and r is the root of the tree. Each vertex x has value a_x.
Let us define the DFS procedure starting from x to find y:
The procedure is legal if and only if y is in the subtree of x.
Define f(x,y) as the expectation of the minimum value of all vertices which were pushed on the stack during the DFS procedure starting from x to find y.
Now we want to calculate ∑f(x,y) for all legal pairs (x,y). It can be shown that the answer can be expressed as an irreducible fraction yx, where x and y are integers and y≡0(mod998,244,353). Output the integer equal to x⋅y−1(mod998,244,353). In other words, output an integer a such that 0≤a<998,244,353 and a⋅y≡x(mod998,244,353).
The first line contains an integer T (1≤T≤100), denoting the number of test cases.
For each test case, the first line contains two integers n and r (1≤n≤4⋅105, 1≤r≤n), denoting the number of vertices in the tree and the root.
The following line contains n integers, the i-th integer of them is a_i(1≤a_i≤109) denoting the value of vertex i.
Each of the next n−1 lines contains two integers u and v (1≤u,v≤n), denoting an edge of the tree.
It is guaranteed that ∑n≤8⋅105. It is also guaranteed that the given graph is indeed a tree.
Output T lines. Each line must contain one integer: the answer to the respective test case.