#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;

int main() {
	int N;
	cin >> N;
	ll os = 0, es = 0, ma = LLONG_MIN;
	vector<ll> A(N);
	for (int i = 0;i < N;i++) {
		cin >> A[i];
		if (i & 1) {
			if (A[i] > 0)os += A[i];
		}
		else {
			if (A[i] > 0)es += A[i];
		}
		ma = max(ma, A[i]);
	}
	queue<int> Q;
	if (os == 0 && es == 0) {
		cout << ma << endl;
		int ti;
		for (ti = N - 1;ti >= 0;ti--) {
			if (A[ti] == ma)break;
			Q.push(ti + 1);
		}
		for (int i = 0;i < ti;i++) {
			Q.push(1);
		}
		cout << Q.size() << endl;
		while (!Q.empty()) {
			cout << Q.front() << endl;
			Q.pop();
		}
		return 0;
	}

	bool ze = 1;
	if (es > os) {
		cout << es << endl;
		for (int i = 0;i < N;) {
			if (A[i] < 0) {
				Q.push(i + 1);
				if (i != N - 1) {
					A.erase(A.begin() + i + 1);
					N--;
				}
				if (i != 0) {
					A.erase(A.begin() + i - 1);
					N--;
				}
				else {
					i++;
					ze = 0;
				}
			}
			else {
				i += 2;
			}
		}
	}
	else {
		cout << os << endl;
		ze = 0;
		for (int i = 1;i < N;) {
			if (A[i] < 0) {
				Q.push(i + 1);
				if (i != N - 1) {
					A.erase(A.begin() + i + 1);
					N--;
				}
				A.erase(A.begin() + i - 1);
				N--;
			}
			else {
				i += 2;
			}
		}
	}

	for (int i = ze;i < N;) {
		Q.push(i + 1);
		if (i == 0) {
			i++;
			N--;
		}
		else {
			N -= 2;
		}
	}
	cout << Q.size() << endl;
	while (!Q.empty()) {
		cout << Q.front() << endl;
		Q.pop();
	}
}