#include<iostream>
#include<algorithm>
#include<queue>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
typedef long long ll;
using namespace std;
ll const MAX = 1005;
ll n;
ll a[MAX];
ll ans[MAX];

int main() {
	cin >> n;
	bool flag = 1;
	ll odd_sum = 0; ll even_sum = 0;
	ll odd_cnt = 0; ll even_cnt = 0;
	REP(i, 1, n) {
		cin >> a[i];
		if (a[i] >= 0) {
			flag = 0;
			if (i % 2 == 0) {
				even_sum += a[i];
				even_cnt++;
			}
			else {
				odd_sum += a[i];
				odd_cnt++;
			}
		}
	}
	if (flag) {
		ll max_v = a[1];
		ll max_i = 1;
		REP(i, 2, n) {
			if (max_v < a[i]) {
				max_v = a[i];
				max_i = i;
			}
		}
		cout << max_v << endl << n - 1 << endl;
		for (ll i = n; i >= max_i + 1; i--) {
			cout << i << endl;
		}
		REP(i, 1, max_i - 1) {
			cout << 1 << endl;
		}
		return 0;
	}
	ll cur, next, cnt;
	if (odd_sum > even_sum) {
		cur = next = n - (n % 2 == 0);
		cnt = odd_cnt;
	}
	else {
		cur = next = n - (n % 2 == 1);
		cnt = even_cnt;
	}
	cout << max(odd_sum, even_sum) << endl;
	while (a[cur] < 0) {
		next = cur = cur - 2;
	}
	ll ans_cnt = 0;
	for (ll i = n; i > cur; i--) {
		ans_cnt++;
		ans[ans_cnt] = i;
	}
	REP(i, 1, cnt - 1) {
		next -= 2;
		while (a[next] < 0) {
			next -= 2;
		}
		while (cur > next) {
			ll erase = (cur + next) / 2;
			ans_cnt++;
			ans[ans_cnt] = erase;
			cur -= 2;
		}
	}
	REP(i, 1, cur - 1) {
		ans_cnt++;
		ans[ans_cnt] = 1;
	}
	cout << ans_cnt << endl;
	REP(i, 1, ans_cnt) {
		cout << ans[i] << endl;
	}
}