Problem: You have an integer sequence of length N: a_1, a_2, ..., a_N.

You repeatedly perform the following operation until the length of the sequence becomes 1:

* First, choose an element of the sequence.
* If that element is at either end of the sequence, delete the element.
* If that element is not at either end of the sequence, replace the element with the sum of the two elements that are adjacent to it. Then, delete those two elements.



You would like to maximize the final element that remains in the sequence.

Find the maximum possible value of the final element, and the way to achieve it.

Constraints

* All input values are integers.
* 2 \leq N \leq 1000
* |a_i| \leq 10^9

Input

Input is given from Standard Input in the following format:


N
a_1 a_2 ... a_N


Output

* In the first line, print the maximum possible value of the final element in the sequence.
* In the second line, print the number of operations that you perform.
* In the (2+i)-th line, if the element chosen in the i-th operation is the x-th element from the left in the sequence at that moment, print x.
* If there are multiple ways to achieve the maximum value of the final element, any of them may be printed.

Examples

Input

5
1 4 3 7 5


Output

11
3
1
4
2


Input

4
100 100 -1 100


Output

200
2
3
1


Input

6
-1 -2 -3 1 2 3


Output

4
3
2
1
2


Input

9
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000


Output

5000000000
4
2
2
2
2

Solution (in CPP):

Solution:
#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;
	}
}