#import<iostream>
#import<cstdio>
#import<vector>
#define N 1005
using namespace std;

typedef long long ll;
ll n, mx = -1e9, c, s[2], a[N];
vector<int> b;
int main(){
	ll i, j;
	cin >> n;
	for (i = 0; i < n; i++) scanf("%lld", &a[i]), s[i % 2] += a[i] * (a[i] > 0), mx = max(mx, a[i]);
	cout << (mx < 0 ? mx : max(s[0], s[1])) << endl;
	if (mx >= 0) mx = -2e9;
	for (i = 0; i < n; i++) if (i % 2 == (s[0] < s[1]) && a[i] > 0 || a[i] == mx) mx = -2e9, b.push_back(i);
	for (i = 1; i < b.size(); i++) c += (b[i] - b[i - 1]) / 2;
	c += b[0] + n - b[b.size() - 1] - 1;
	cout << c << endl;
	for (i = n; i > b[b.size() - 1] + 1; i--) printf("%lld\n", i);
	for (i = 0; i < b[0]; i++) printf("1\n");
	for (i = 1; i < b.size(); i++)
		for (j = (b[i] - b[i - 1]) / 2 + 1; j > 1; j--) printf("%lld\n", j);
}