#include<bits/stdc++.h>

using namespace std;

#define MAXV 200005

int n;
vector<int> boje(1), g[MAXV];
bool lanac = true;

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

    int i, j, sum_bez_1 = 0;
    cin >> n;
    for(i=1;i<=n;i++){
        int x;
        cin >> x;
        boje.push_back(x);
        if(i != 1){
            sum_bez_1 += x;
        }
    }

    for(i=1;i<n;i++){
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
        if(lanac){
            if(g[x].size() > 2 || g[y].size() > 2){
                lanac = false;
            }
        }
    }

    // Ispis
    if(g[1].size() == n-1){
        if(sum_bez_1 > boje[1]){
            cout << boje[1] << "\n";
            cout << 1 <<"\n";
            cout << 1 <<"\n";
            cout << 0;
        }
        else{
            cout << sum_bez_1 << "\n";
            cout << n-1 <<"\n";
            for(i=2;i<=n;i++){
                cout << i << " ";
            }
            cout << "\n";
            cout << 0;

        }

    }
    else if(lanac){
        long long sum1 = 0, sum2 = 0, br1=0, br2=0;
        for(i=1;i<=n;i++){
            if(i%2 == 1){
                sum1 += boje[i];
                br1++;
            }
            else{
                sum2 += boje[i];
                br2++;
            }
        }
        if(sum1 < sum2){
            cout << sum1 << "\n";
            cout << br1 << "\n";

            for(i=1;i<=n;i+=2){
                cout << i << " ";
            }

            cout << "\n";
            cout << 0;
        }
        else{
            cout << sum2 << "\n";
            cout << br2 << "\n";

            for(i=2;i<=n;i+=2){
                cout << i << " ";
            }

            cout << "\n";
            cout << 0;
        }
    }
    return 0;
}