#include<bits/stdc++.h>
#define int long long
constexpr long long mod = 1000000007;
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << x << "\n"
using namespace std;
int n, a[1234];
int ans[5];
vector<int>v;
signed main() {
	cin >> n;
	for1(i, n) {
		cin >> a[i];
		ans[i % 2] += max(a[i], (int)0);
	}
	if (ans[0] == 0 && ans[1] == 0) {
		ans[2] = -mod; for1(i, n)if (ans[2] < a[i]) { ans[2] = a[i]; ans[3] = i; }
		puts(ans[2]); puts(n - 1);
		for1(i, n)if (i < ans[3])puts(1); else if (i != ans[3])puts(n + 2 - i);
		return 0;
	}
	else {
		puts(max(ans[0], ans[1]));
		for1(i, n) {
			if (i == n)break;
			if (i == 1 && ans[0] > ans[1])v.push_back(1);
			else if (a[i] < 0) { v.push_back(1); v.push_back(1); i++; }
			else if (i + 1 == n) { v.push_back(2); break; }
			else if (a[i + 2] > 0) { v.push_back(2); i++; }
			else { v.push_back(3); if (i + 2 == n) { v.push_back(2); break; }i++; a[i + 1] = 1; }
		}
		puts(v.size()); for (int i : v)puts(i);
	}
}