#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define MAXN 200010

using namespace std;

ll N;
vector <ll> A(MAXN);
vector <ll> graf[MAXN];
vector < vector <ll> > dp(2, vector <ll> (MAXN));

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> N;
    ll X, Y, sum = 0;
    for(int i = 1; i <= N; i++) {cin >> A[i]; sum += A[i];}
    for(int i = 1; i <= N - 1; i++)
    {
        cin >> X >> Y;
        graf[X].push_back(Y);
        graf[Y].push_back(X);
    }
    if(graf[1].size() == N - 1)
    {
        if(sum - A[1] <= A[1])
        {
            cout << sum - A[1] << endl;
            cout << N - 1 << endl;
            for(int i = 2; i <= N; i++) cout << i << " ";
            cout << endl << 0 << endl;
        }
        else {cout << A[1] << endl << 1 << endl << 1 << endl << 0 << endl;}
        return 0;
    }
    for(int i = 1; i <= N; i++)
    {
        if(i == 1)
        {
            dp[0][i] = 0;
            dp[1][i] = A[i];
        }
        dp[0][i] = dp[1][i - 1];
        dp[1][i] = min(min(dp[0][i - 1], dp[1][i - 1]), dp[1][i - 2])+ A[i];
    }
    cout << min(dp[0][N], dp[1][N]) << endl;
    vector <ll> rez1, rez2;
    ll i = 0, j = N;
    while(j > 0)
    {
        if(i == 1)
        {
            if(j%2) rez1.push_back(j);
            else rez2.push_back(j);
        }
        if(i == 0) {i = 1; j--;}
        else
        {
            ll mini = min(min(dp[0][j - 1], dp[1][j - 1]), dp[1][j - 2]);
            if(dp[0][j - 1] == mini) {i = 0; j--;}
            else if(dp[1][j - 1] == mini) {j--;}
            else {j -= 2;}
        }
    }
    reverse(rez1.begin(), rez1.end());
    reverse(rez2.begin(), rez2.end());
    if(rez1.size() < rez2.size()) swap(rez1, rez2);
    cout << rez1.size() << endl;
    for(auto br : rez1) cout << br << " ";
    cout << endl;
    cout << rez2.size() << endl;
    for(auto br : rez2) cout << br << " ";
    cout << endl;
    return 0;
}