#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 1010;
int A[MAX];

int main(int argc, char* argv[])
{
	//ios::sync_with_stdio(false); cin.tie(0);

	int n;
	scanf("%d", &n);
	FOR (i, 0, n)
	{
		scanf("%d", &A[i]);
	}

	pair<LL, PII> mx = MP(-LINF, MP(-INF, -INF));

	FOR (i, 0, n)
	{
		LL sum = 0;
		for (int j = i; j < n; j += 2)
		{
			sum += A[j];

			mx = max(mx, MP(sum, MP(i, j)));
		}
	}

	cout<<mx.first<<"\n";

	int L = mx.second.first;
	int R = mx.second.second;
	VI res;

	while(L > 0)
	{
		res.PB(1);
		L--;
		R--;
		n--;
	}

	while(R + 1 < n)
	{
		res.PB(n);
		n--;
	}

	while(R != L)
	{
		res.PB(2);
		R -= 2;
	}

	cout<<SZ(res)<<"\n";
	FOR (i, 0, SZ(res))
	{
		cout<<res[i]<<"\n";
	}

}
