#include <bits/stdc++.h>

#define ll long long
#define loop(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    ll n, x, sa = 0, sb = 0;
    cin >> n;
    vector<ll> a(n);
    loop(i, 0, n) {
        cin >> a[i];
        if (i % 2) sa += a[i];
        else sb += a[i];
        
    }
    loop(i, 0, n - 1) {
        cin >> x >> x;
    }

    if (sa >= sb) {
        x = n % 2;
        // Neparni [0]
        cout << sb << '\n';
        cout << n / 2 + x << '\n';
        for(ll i = 1; i < n + 1; i+= 2) {
            cout << i << ' ';
        }
        cout << '\n';
        cout << "0\n";
    } else {
        // Parni brojevi [1]
        cout << sa << '\n';
        cout << n / 2 << '\n';
        for(ll i = 2; i < n + 1; i+= 2) {
            cout << i << ' ';
        }
        cout << '\n';
        cout << "0\n";
    
    }

    return 0;
}