#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl '\n'
#define pb push_back
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int maxN = 1e5 + 5;
int main(){
    ios;
    int n;
    cin>>n;
    vector<ll> a(n+1);
    for(int i = 1;i<=n;i++)cin>>a[i];
    vector<vector<int>> g(n + 1);
    bool podzadatak1 = true;
    for(int i = 0;i < n - 1;i++){
        int u, v;
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
        if(u!=1&&v!=1)podzadatak1 = false;
    }
    ll mn = LLONG_MAX;
    ll r1 = a[1];
    ll r2 = LLONG_MAX;
    int prvi = -1;
    int drugi = -1;
    for(int i = 2;i<=n;i++){
        ll tr = a[1] + a[i];
        if(tr<=r2){
            r2 = tr;
            prvi = 1;
            drugi = i;
        }
    }
    if(r1<=r2){
        cout<<r1<<endl;
        cout<<1<<endl;
        cout<<1<<endl;
        cout<<0<<endl;
    }
    else{
        cout<<r2<<endl;
        cout<<2<<endl;
        cout<<prvi<<" "<<drugi<<endl;
        cout<<0<<endl;
    }



}