#include <bits/stdc++.h>

using namespace std;
#define int long long
void dfs()
{

}
signed  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int pfs = 0;
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        if(i >0)
        {
            pfs+= a[i];
        }
    }
    for(int i = 0; i < n-1; i++)
    {
        int c, b;
        cin >> c >> b;
    }
    if(pfs >= a[0]){
        cout << a[0] << endl;
        cout << 1 << endl << 1 << endl;
        cout << 0 << endl;


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