#P1120D. Power Tree

    ID: 4645 Type: RemoteJudge 2000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>dfs and similardpdsugraphsgreedytrees*2500

Power Tree

No submission language available for this problem.

Description

You are given a rooted tree with nn vertices, the root of the tree is the vertex 11. Each vertex has some non-negative price. A leaf of the tree is a non-root vertex that has degree 11.

Arkady and Vasily play a strange game on the tree. The game consists of three stages. On the first stage Arkady buys some non-empty set of vertices of the tree. On the second stage Vasily puts some integers into all leaves of the tree. On the third stage Arkady can perform several (possibly none) operations of the following kind: choose some vertex vv he bought on the first stage and some integer xx, and then add xx to all integers in the leaves in the subtree of vv. The integer xx can be positive, negative of zero.

A leaf aa is in the subtree of a vertex bb if and only if the simple path between aa and the root goes through bb.

Arkady's task is to make all integers in the leaves equal to zero. What is the minimum total cost ss he has to pay on the first stage to guarantee his own win independently of the integers Vasily puts on the second stage? Also, we ask you to find all such vertices that there is an optimal (i.e. with cost ss) set of vertices containing this one such that Arkady can guarantee his own win buying this set on the first stage.

The first line contains a single integer nn (2n2000002 \le n \le 200\,000) — the number of vertices in the tree.

The second line contains nn integers c1,c2,,cnc_1, c_2, \ldots, c_n (0ci1090 \le c_i \le 10^9), where cic_i is the price of the ii-th vertex.

Each of the next n1n - 1 lines contains two integers aa and bb (1a,bn1 \le a, b \le n), denoting an edge of the tree.

In the first line print two integers: the minimum possible cost ss Arkady has to pay to guarantee his own win, and the number of vertices kk that belong to at least one optimal set.

In the second line print kk distinct integers in increasing order the indices of the vertices that belong to at least one optimal set.

Input

The first line contains a single integer nn (2n2000002 \le n \le 200\,000) — the number of vertices in the tree.

The second line contains nn integers c1,c2,,cnc_1, c_2, \ldots, c_n (0ci1090 \le c_i \le 10^9), where cic_i is the price of the ii-th vertex.

Each of the next n1n - 1 lines contains two integers aa and bb (1a,bn1 \le a, b \le n), denoting an edge of the tree.

Output

In the first line print two integers: the minimum possible cost ss Arkady has to pay to guarantee his own win, and the number of vertices kk that belong to at least one optimal set.

In the second line print kk distinct integers in increasing order the indices of the vertices that belong to at least one optimal set.

Samples

Sample Input 1

5
5 1 3 2 1
1 2
2 3
2 4
1 5

Sample Output 1

4 3
2 4 5

Sample Input 2

3
1 1 1
1 2
1 3

Sample Output 2

2 3
1 2 3

Note

In the second example all sets of two vertices are optimal. So, each vertex is in at least one optimal set.