#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define li(i,a,b) for(int (i) = (a); (i)<(b); i++)
#define all(v) v.begin(), v.end()
#define mem(name, val) memset(name, val, sizeof(name))
#define endl '\n'

const int nmax = 200005;
vector<int> adj[nmax];
ll cost[nmax];

vector<ll> memo0(nmax,0), memo1(nmax,0);

// boja roditelja i boja sebe
vector<pair<int,int>> boje(nmax);

//vector<int> boja(nmax,0);
vector<int> crvena;
vector<int> plava;

ll dp(bool isColored, int parent, int i){

    ll res = 0;
    if(isColored){
        if(memo1[i] != 0) return memo1[i];
        for(int ch: adj[i]){
            if(ch == parent) continue;
            res += min(dp(false, i, ch), dp(true, i ,ch));
        }
        res+=cost[i];
        memo1[i] = res;
        return res;
    }
    else{
        if(memo0[i] != 0) return memo0[i];
        for(int ch: adj[i]){
            if(ch == parent) continue;
            res += dp(true, i, ch);
        }
        memo0[i] = res;
        return res;
    }
}

void bfs(int parent, int i){

    if(boje[parent].second != 0){
        if(memo0[i]>memo1[i]){
            if(boje[parent].second == 1){
                boje[i] = mp(1,-1);
                plava.push_back(i);
            }
            else if(boje[parent].second == -1){
                crvena.push_back(i);
                boje[i] = mp(-1,1);
            }
        }
        else{
            boje[i] = mp(boje[parent].second, 0);
        }
    }
    else{
        boje[i] = mp(0, boje[parent].first);
        if(boje[i].second == 1){
            crvena.push_back(i);
        }
        else{
            plava.push_back(i);
        }
    }

    for(int ch: adj[i]){
        if(ch == parent) continue;

        bfs(i, ch);
    }
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int n;
    cin>>n;
    li(i,1,n+1) cin>>cost[i];

    int u, v;
    li(i,0,n-1){
        cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    if(adj[1].size() == n-1){
        ll zbir = 0;
        for(int i = 2;i<=n; i++){
            zbir+=cost[i];
        }
        if(zbir < cost[1]){
            cout<<zbir<<endl;
            cout<<n-1<<endl;
            for(int i = 2; i<=n; i++){
                cout<<i<<" ";
            }
            cout<<endl;
            cout<<0;
            return 0;
        }
        else{
            cout<<cost[1]<<endl;
            cout<<1<<endl;
            cout<<1<<endl;
            cout<<0<<endl;
            return 0;
        }
    }
    else{
        ll zbir1 = 0, zbir2 = 0;
        int cnt1 = 0, cnt2 = 0;
        for(int i = 1; i<=n; i+=2){
            zbir1+=cost[i]; cnt1++;
        }
        for(int i = 2; i<=n; i+=2){
            zbir2 += cost[i]; cnt2++;
        }
        if(zbir1<zbir2){
            cout<<zbir1<<endl;
            cout<<cnt1<<endl;
            for(int i = 1; i<=n; i+=2){
                cout<<i<<" ";
            }
            cout<<endl;
            cout<<0<<endl;
            return 0;
        }
        else{
            cout<<zbir2<<endl;
            cout<<cnt2<<endl;
            for(int i = 2; i<=n; i+=2){
                cout<<i<<" ";
            }
            cout<<endl;
            cout<<0<<endl;
            return 0;
        }
    }

    cout<<min(dp(false, -1, 1), dp(true,-1, 1))<<endl;

    // 1 crvena 0 nista -1 plava
    if(memo1[1] <= memo0[1]){
        //boja[1] = -1;
        boje[1] = mp(-1, -1);
        plava.push_back(1);
    }
    else{
        boje[1] = mp(1, 0);
    }

    for(int ch : adj[1]){
        bfs(1,ch);
    }

    cout<<crvena.size()<<endl;
    if(crvena.size()){
        for(int g : crvena){
            cout<<g<<" ";
        }
        cout<<endl;
    }
    cout<<plava.size()<<endl;
    for(int g: plava){
        cout<<g<<" ";
    }
    cout<<endl;

    return 0;
}