#include <bits/stdc++.h>

using namespace std;

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

    int n;
    cin >> n;
    vector<long long> cost (n);
    vector<vector<int>> s (n);

    for(int i=0;i<n;++i) cin >> cost[i];

    for(int i=0;i<n-1;++i){
        int temp1,temp2;
        cin >> temp1 >> temp2;

        s[temp1].push_back(temp2);
        s[temp2].push_back(temp1);
    }
    long long sum1 = 0, sum2 = 0;
    for(int i=0;i<n;i++){
        if(i%2 == 0) sum1 += cost[i];
        else sum2 += cost[i];
    }

    if(sum1 < sum2){
        cout << sum1 << '\n';
        cout << sum1/2 + sum1%2 << '\n';
        for(int i=0;i<n;i+=2){
            cout << i+1 << " ";
        }
        cout << '\n';

        cout << 0;
    }
    else
    {
        cout << sum2 << '\n';
        cout << sum2/2 << '\n';
        for(int i=1;i<n;i+=2){
            cout << i+1 << " ";
        }

        cout << '\n';
        cout << 0;
    }



}