Problem:
Score : 700 points

Problem Statement

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.

Sample Input 1

5
1 4 3 7 5

Sample Output 1

11
3
1
4
2

The sequence would change as follows:

After the first operation: 4, 3, 7, 5

After the second operation: 4, 3, 7

After the third operation: 11(4+7)

Sample Input 2

4
100 100 -1 100

Sample Output 2

200
2
3
1

After the first operation: 100, 200(100+100)

After the second operation: 200

Sample Input 3

6
-1 -2 -3 1 2 3

Sample Output 3

4
3
2
1
2

After the first operation: -4, 1, 2, 3

After the second operation: 1, 2, 3

After the third operation: 4

Sample Input 4

9
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000

Sample Output 4

5000000000
4
2
2
2
2

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a<<" "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int P = 1e9 + 7;
inline int add(int a, int b) {if((a += b) >= P) a -= P; return a;}
inline int sub(int a, int b) {if((a -= b) < 0) a += P; return a;}
inline int mul(int a, int b) {return 1ll * a * b % P;}
inline int kpow(int a, int b) {int r=1;for(;b;b>>=1,a=mul(a,a)) {if(b&1)r=mul(r,a);}return r;}
//----
const int N = 1010;
int n;
int a[N];
ll ans = -2e9, ansl, ansr;
pii gao(int l, int r, int o) {
	rep(be, 0, 2) {
		ll t = 0;
		int step = 0;
		for(int i = be + l; i <= r; i += 2) {
			t += a[i];
			step++;
		}
		if(o && t == ans)
			return {step - 1, be};
		if(step - 1 && t > ans) {
			ans = t;
			ansl = l, ansr = r;
		}
	}
}
int main(){
	scanf("%d", &n);
	rep(i, 0, n) scanf("%d", a + i);
	rep(i, 0, n) for(int j = n - 1; j >= i; j--) {
		gao(i, j, 0);
	}
	printf("%lld\n", ans);
	pii sb = gao(ansl, ansr, 1);
	int step = ansl + (n - 1 - ansr) + sb.fi + sb.se;
//	dd(ansl), dd(ansr), dd(sb.fi), de(sb.se);
	printf("%d\n", step);
	rep(i, 0, ansl) printf("1\n");
	if(sb.se) printf("1\n");
	int m = n - ansl - sb.se - sb.fi * 2;
	rep(i, 0, sb.fi) printf("2\n");
	rep(i, ansr + 1, n) printf("%d\n", m--);
	return 0;
}