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