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<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 998244353;
constexpr int inf = 3e18;

int N,A[1005];
void solve1(){
	int mx=-inf,idx;
	rep(i,N)if(chmax(mx,A[i]))idx=i;
	cout<<mx<<endl<<N-1<<endl;
	rep(i,idx)cout<<1<<endl;
	for(int i=N-idx;i>=2;i--)cout<<i<<endl;
}
void solve2(){
	int even=0,odd=0;
	rep(i,N){
		if(i&1)odd+=max(0ll,A[i]);
		else even+=max(0ll,A[i]);
	}
	vector<bool>v;
	vector<int>ope;
	rep(i,N){
		if((i&1)&&odd>=even&&A[i]>=0)v.pb(true);
		else if(!(i&1)&&odd<even&&A[i]>=0)v.pb(true);
		else v.pb(false);
	}
	while(v.size()&&!v[0]){
		v.erase(v.begin());ope.pb(1);
	}
	while(v.size()&&!v.back()){
		ope.pb(v.size());v.erase(v.end()-1);
	}
	while(v.size()>1){
		if(v[2]){
			ope.pb(2);v.erase(v.begin());v.erase(v.begin());
		}else {
			ope.pb(3);v.erase(v.begin()+1);v.erase(v.begin()+1);
		}
	}
	cout<<max(even,odd)<<endl<<len(ope)<<endl;
	for(int i:ope)cout<<i<<endl;
}
signed main(){
	cin>>N;
	bool flag=false;
	rep(i,N){
		cin>>A[i];
		flag|=A[i]>=0;
	}
	if(!flag)solve1();
	else solve2();
}