#include <iostream>
using namespace std;
long long n, ans, cnt, mi=1, a[1005], s[2], x[505], y[505], z;
int main() {
	int i, j;
	cin>>n;
	for(i=1; i<=n; i++) {
		cin>>a[i];
		s[i%2] += max(a[i], 0LL);
		if(a[i]>a[mi]) mi=i;
	}
	for(i=s[1]>s[0]; i<=n; i+=2) if(a[i]>0) {
		x[++z] = i;
		if(z>1) cnt += y[z-1] = (x[z] - x[z-1]) / 2;
	}
	if(z) {
		ans = max(s[0], s[1]);
		cnt += x[1]-1 + n-x[z];
	} else {
		ans = a[mi];
		cnt = n-1;
		x[++z] = mi;
	}
	cout<<ans<<endl<<cnt<<endl;
    //先去掉两端
	for(i=n; i>x[z]; i--) cout<<i<<endl;
	for(i=1; i<x[1]; i++) cout<<1<<endl;
	for(i=1; i<z; i++) for(j=y[i]; j>0; j--) cout<<j+1<<endl;
	return 0;
}
