#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;
    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 a, b;
        cin >> a >> b;
    }
    if(pfs > a[0]){
        cout << a[0] << endl;
        cout << 1 << 1 << endl;
        cout << 0 << endl;


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