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

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 v he bought on the first stage and some integer x, and then add x to all integers in the leaves in the subtree of v. The integer x can be positive, negative of zero.

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

Arkady's task is to make all integers in the leaves equal to zero. What is the minimum total cost s 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 s) set of vertices containing this one such that Arkady can guarantee his own win buying this set on the first stage.

Input

The first line contains a single integer n (2 ≤ n ≤ 200 000) — the number of vertices in the tree.

The second line contains n integers c_1, c_2, …, c_n (0 ≤ c_i ≤ 10^9), where c_i is the price of the i-th vertex.

Each of the next n - 1 lines contains two integers a and b (1 ≤ a, b ≤ n), denoting an edge of the tree.

Output

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

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

Examples

Input


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


Output


4 3
2 4 5 


Input


3
1 1 1
1 2
1 3


Output


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.
#include <bits/stdc++.h>
using namespace std;
namespace IO {
void read(int &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while ('0' > c || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  x *= f;
}
void read(long long &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while ('0' > c || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  x *= f;
}
void write(int x) {
  if (x < 10)
    putchar(x + '0');
  else {
    write(x / 10);
    putchar(x % 10 + '0');
  }
}
void write(long long x) {
  if (x < 10)
    putchar(x + '0');
  else {
    write(x / 10);
    putchar(x % 10 + '0');
  }
}
}  // namespace IO
namespace ufs {
int fa[200005];
void makeset(int n) {
  for (int i = 1; i <= n; i++) fa[i] = i;
}
int findset(int x) {
  if (fa[x] == x) return x;
  return fa[x] = findset(fa[x]);
}
void merge(int u, int v) {
  int a = findset(u);
  int b = findset(v);
  fa[a] = b;
}
}  // namespace ufs
using namespace IO;
using namespace ufs;
struct node {
  int u, v;
  long long w;
  int id;
  friend bool operator<(const node &a, const node &b) { return a.w < b.w; }
} a[200005];
int n, lena;
int cnt;
int l[200005], r[200005];
long long w[200005], mst;
vector<int> g[200005];
vector<int> ans;
void dfs(int u, int fa) {
  if (g[u].size() == 1 && g[u].front() == fa) {
    l[u] = ++cnt;
    r[u] = cnt;
    a[++lena] = (node){l[u], r[u] + 1, w[u], u};
    return;
  }
  l[u] = (1 << 30);
  r[u] = 0;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v != fa) {
      dfs(v, u);
      l[u] = min(l[u], l[v]);
      r[u] = max(r[u], r[v]);
    }
  }
  a[++lena] = (node){l[u], r[u] + 1, w[u], u};
}
int main() {
  ios::sync_with_stdio(false);
  read(n);
  for (int i = 1; i <= n; i++) read(w[i]);
  for (int i = 1, u, v; i < n; i++) {
    read(u);
    read(v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  sort(a + 1, a + lena + 1);
  makeset(n + 1);
  for (int i = 1, j; i <= lena; i = j) {
    j = i;
    while (a[j].w == a[i].w && j <= lena) {
      if (findset(a[j].u) != findset(a[j].v)) ans.push_back(a[j].id);
      j++;
    }
    for (int k = i; k < j; k++) {
      if (findset(a[k].u) != findset(a[k].v)) {
        merge(a[k].u, a[k].v);
        mst += a[k].w;
      }
    }
  }
  write(mst);
  putchar(' ');
  write((int)ans.size());
  putchar('\n');
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    write(ans[i]);
    putchar(' ');
  }
  return 0;
}
