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 JAVA):

Solution:
import java.io.*;
import java.util.*;

public class Main {

    static int N;
    static int[] A;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        N = sc.nextInt();
        A = sc.nextIntArray(N);
        Ans answer = solve();
        pw.println( answer.value );
        pw.println( answer.way.size() );
        for (int each : answer.way) {
            pw.println(each+1);
        }
        pw.flush();
    }

    static Ans solve() {
        long even = 0;
        for (int i = 0; i < N; i++) {
            if( i % 2 == 0 && A[i] > 0) {
                even += A[i];
            }
        }

        long odd = 0;
        for (int i = 0; i < N; i++) {
            if( i % 2 == 1 && A[i] > 0 ) {
                odd += A[i];
            }
        }

        if( even <= 0 && odd <= 0 ) {
            return case_0();
        }

        List<Integer> ways = new ArrayList<>();
        LinkedList<Long> list = new LinkedList<>();
        for (int i : A) {
            list.add((long) i);
        }

        // 一つ取ってevenに合わせる
        if( odd > even ) {
            list.removeFirst();
            ways.add(0);
        }

        while(list.size() > 1 ) {
            if( list.size() == 2 ) {
                list.removeLast();
                ways.add(1);

            } else {
                // plusだけを残す
                // ので、minusの場合はいきなり消す
                if( list.getFirst() < 0 ) {
                    // 二回操作してる
                    ways.add(0);
                    ways.add(0);
                    list.removeFirst(); // minus分
                    list.removeFirst(); // odd分

                } else {
                    long nextEven = list.get(2);
                    if( nextEven >= 0 ) {
                        long first = list.getFirst();
                        ways.add(1);
                        list.set(1, first + nextEven);
                        list.remove(2);
                        list.remove(0);

                    } else {
                        if( list.size() == 3 ) {
                            // 0 1 2 -> 0 1
                            list.removeLast();
                            ways.add(2);
                        } else {
                            // 0 1 2 3 -> 0 1 1+3 3 -> 0 1+3
                            long second = list.get(1);
                            long forth = list.get(3);
                            ways.add(2);
                            list.set(2, second + forth); //　どうせ使わないあたいなのだけど一応
                            list.remove(3);
                            list.remove(1);
                        }
                    }
                }
            }
        }
        return new Ans(list.getFirst(), ways);
    }

    static Ans case_0() {
        int max = Integer.MIN_VALUE;
        int max_index = -1;

        for (int i = 0; i < N; i++) {
            if( A[i] > max ) {
                max = A[i];
                max_index = i;
            }
        }

        List<Integer> ways = new ArrayList<>();
        // max_index以外を全部すてる
        // -> max_index個前に存在するのでそれを捨てる(way=0)
        // + N-max_index-1個後ろに存在するのでそれを捨てる(way=size-1)
        for (int i = 0; i < max_index; i++) {
            ways.add(0);
        }
        for (int i = 0; i < N-max_index-1; i++) {
            int size = N - max_index - i;
            ways.add(size-1);
        }

        return new Ans(max, ways);
    }

    static class Ans {
        long value;
        List<Integer> way;

        public Ans(long value, List<Integer> way) {
            this.value = value;
            this.way = way;
        }
    }

    static class FastScanner {

        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}