#include <bits/stdc++.h>

using namespace std;

#define MAXN 200010

long long n;
long long a[MAXN];
vector<long long> adj[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for (long long i=1;i<=n;i++) cin>>a[i];
    for (long long i=1;i<n;i++)
    {
        long long x,y;cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    ///3.subtask
    long long ans1=0,br1=0;
    long long ans2=0,br2=0;
    for (long long i=2;i<=n;i+=2) {ans1+=a[i];br1++;}
    for (long long i=1;i<=n;i+=2) {ans2+=a[i];br2++;}
    if (ans1<ans2)
    {
        cout<<ans1<<endl;
        cout<<br1<<endl;
        for (long long i=2;i<=n;i+=2) cout<<i<<" ";
        cout<<endl;
        cout<<0<<endl;
    }
    else
    {
        cout<<ans2<<endl;
        cout<<br2<<endl;
        for (long long i=1;i<=n;i+=2) cout<<i<<" ";
        cout<<endl;
        cout<<0<<endl;
    }
}