#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int N;
int A[1010], chk[1010];
ll psum[2][1010];
vector<int> sol;

int main() {
    scanf("%d", &N);

    ll sum1 = 0;
    ll sum2 = 0;
    for(int i = 0; i < N; i++) {
        scanf("%d", &A[i]);
        if(i % 2) sum1 += max(0, A[i]);
        else sum2 += max(0, A[i]);
    }

    int mx = -1e9, p;
    for(int i = 0; i < N; i++) {
        if(mx < A[i]) {
            mx = A[i], p = i;
        }
    }
    if(mx < 0) {
        for(int i = N - 1; i > p; i--) {
            sol.push_back(i);
        }
        for(int i = 0; i < p; i++) {
            sol.push_back(0);
        }
        printf("%d\n%d\n", mx, sol.size());
        for(int i = 0; i < sol.size(); i++) {
            printf("%d ", sol[i] + 1);
        }
        return 0;
    }

    vector<pii> tmp;
    for(int i = 0; i < N; i++) tmp.push_back({A[i], i % 2});

    if(sum1 < sum2) {
        while(1) {
            bool ok = false;
            for(int i = 0; i < tmp.size(); i++) {
                if(!tmp[i].second && tmp[i].first < 0) {
                    sol.push_back(i);
                    if(i && i != (int)tmp.size() - 1) {
                        tmp[i - 1].first += tmp[i + 1].first;
                        tmp.erase(tmp.begin() + i + 1);
                    }
                    tmp.erase(tmp.begin() + i);
                    ok = true;
                    break;
                }
            }
            if(!ok) break;
        }
        while(1) {
            bool ok = false;
            for(int i = 0; i < tmp.size(); i++) {
                if(tmp[i].second) {
                    sol.push_back(i);
                    if(i && i != (int)tmp.size() - 1) {
                        tmp[i - 1].first += tmp[i + 1].first;
                        tmp.erase(tmp.begin() + i + 1);
                    }
                    tmp.erase(tmp.begin() + i);
                    ok = true;
                    break;
                }
            }
            if(!ok) break;
        }
    }
    else {
        while(1) {
            bool ok = false;
            for(int i = 0; i < tmp.size(); i++) {
                if(tmp[i].second && tmp[i].first < 0) {
                    sol.push_back(i);
                    if(i && i != (int)tmp.size() - 1) {
                        tmp[i - 1].first += tmp[i + 1].first;
                        tmp.erase(tmp.begin() + i + 1);
                    }
                    tmp.erase(tmp.begin() + i);
                    ok = true;
                    break;
                }
            }
            if(!ok) break;
        }
        while(1) {
            bool ok = false;
            for(int i = 0; i < tmp.size(); i++) {
                if(!tmp[i].second) {
                    sol.push_back(i);
                    if(i && i != (int)tmp.size() - 1) {
                        tmp[i - 1].first += tmp[i + 1].first;
                        tmp.erase(tmp.begin() + i + 1);
                    }
                    tmp.erase(tmp.begin() + i);
                    ok = true;
                    break;
                }
            }
            if(!ok) break;
        }
    }
    printf("%lld\n%d\n", max(sum1, sum2), sol.size());
    for(int i = 0; i < sol.size(); i++) {
        printf("%d\n", sol[i] + 1);
    }
}


Measured memory_bytes: 256