#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
long long a[1000001], b[1000001];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long long n, i, m, s, par = 0, nepar = 0;
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        cin >> a[i];
        if (i % 2 == 0)
        {
            par += a[i];
        }
        else
        {
            nepar += a[i];
        }
    }
    for (i = 0; i < n-1; i++)
    {
        cin >> m >> s;
    }
    cout << min(par,nepar) << endl;
    if (par < nepar)
    {
        cout << n/2 << endl;
        for (i = 2; i <= n; i += 2) cout << i << " ";
        cout << endl;
    }
    else
    {
        cout << (n+1)/2 << endl;
        for (i = 1; i <= n; i += 2) cout << i << " ";
        cout << endl;
    }
    cout << 0 << endl;
    return 0;
}