#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    int s = 0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        //trmin = min(trmin, a[i]);
        if(i!=0) s+=a[i];
    }
    for(int i=0;i<n-1;i++){
        int c,b;
        cin>>c>>b;
    }
    if(s<=a[0]){
    cout<<s<<endl;
    cout<<n-1<<endl;
    for(int i=1;i<n;i++) cout<<i<<" ";
    cout<<endl;
    cout<<0<<endl;
    cout<<endl;
    }
    else{
        cout<<a[0]<<endl;
        cout<<1<<endl;
        cout<<1<<endl;
        cout<<0<<endl;
        cout<<0<<endl;
    }
}