#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n-1;i++){
		int x,y;
		cin>>x>>y;
	}
	int dp1[n] = {};
	int dp2[n] = {};
	dp1[0] = a[0];
	dp2[0] = 0;
	for(int i=1;i<n;i++){
		dp1[i] = a[i]+min(dp1[i-1], dp2[i-1]);
		dp2[i] = dp1[i-1];
	}
	int suma = min(dp1[n-1], dp2[n-1]);
	vector<int> res;
	int tr = suma;
	for(int i=n-1;i>=0;i--){
		if(tr == dp1[i]){
			res.push_back(i);
			tr-=a[i];
		}
	}
	reverse(res.begin(), res.end());
	cout<<suma<<endl;
	cout<<res.size()<<endl;
	for(int i=0;i<res.size();i++) cout<<res[i]+1<<" ";
	cout<<endl;
	cout<<0<<endl;
	/*vector<int> svi;
	int trsuma = suma;
	for(int i=n-1;i>=0;i--){
		if(uzeo){
			svi.push_back(i);
			if(trsuma-a[i] == dp1[i-1])
		}
	}*/
}