#include<bits/stdc++.h>
using namespace std;
int main(){

    int n;
    cin>>n;

    int niz[n+5];
    vector<vector<int> > v( n );

    for(int i=0;i<n;i++){
        cin>>niz[i];
    }

    int a,b;
    for(int i=0;i<n-1;i++){

        cin>>a>>b;

        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int vlcn[n+5];
    bool bul1 = true;

    if(v[0].size() != 1){
        bul1 = false;
    }
    for(int i=1;i<n-1;i++){

        if(v[i].size() != 2){
            bul1 = false;
            break;
        }
    }
    if(v[n-1].size() != 1){
        bul1 = false;
    }

    if(v[0].size() == n-1){

        int u=0;
        for(int i=1;i<n;i++){

            u += niz[i];
        }

        if(niz[0] <= u){

            cout<<niz[0]<<endl;
            cout<<1<<endl;
            cout<<1<<endl;
            cout<<0<<endl;
        }
        else{

            cout<<u<<endl;
            cout<<n-1<<endl;
            for(int i=1;i<n;i++){

                cout<<i+1<<" ";
            }
            cout<<endl;
            cout<<0;
        }
    }
    else if(bul1){

        int u1=0;
        int u2=0;

        for(int i=0;i<n;i=i+2){

            u1 += niz[i];
        }
        for(int i=1;i<n;i=i+2){

            u2 += niz[i];
        }

        if(u1 >= u2){

            cout<<u2<<endl;
            cout<<(n-1)/2<<endl;
            for(int i=1;i<n;i=i+2){
                cout<<i+1<<" ";
            }
            cout<<endl;
            cout<<0;
        }
        else{

            cout<<u1<<endl;
            cout<<n - (n-1)/2<<endl;
            for(int i=0;i<n;i=i+2){
                cout<<i+1<<" ";
            }
            cout<<endl;
            cout<<0;
        }
    }
}