OK	WA	TLE	MLE	RTE	NT
0
0
Test primeri	0	2	0	0	0	0
Vreme	-	0,00s	-	-	-	-
Memorija	-	1,00MB	-	-	-	-
OK	WA	TLE	MLE	RTE	NT
1
0
Test primeri	0	3	0	0	0	0
Vreme	-	0,00s	-	-	-	-
Memorija	-	1,00MB	-	-	-	-
OK	WA	TLE	MLE	RTE	NT
2
0
Test primeri	0	3	0	0	0	0
Vreme	-	0,17s	-	-	-	-
Memorija	-	3,00MB	-	-	-	-
OK	WA	TLE	MLE	RTE	NT
3
0
Test primeri	0	6	0	0	0	0
Vreme	-	0,17s	-	-	-	-
Memorija	-	3,00MB	-	-	-	-
OK	WA	TLE	MLE	RTE	NT
4
0
Test primeri	0	7	0	0	0	0
Vreme	-	0,00s	-	-	-	-
Memorija	-	1,00MB	-	-	-	-
OK	WA	TLE	MLE	RTE	NT
5
0
Test primeri	0	8	0	0	0	0
Vreme	-	0,22s	-	-	-	-
Memorija	-	3,00MB	-	-	-	-
OK	WA	TLE	MLE	RTE	NT
6
0
Test primeri	0	11	0	0	0	0
Vreme	-	0,20s	-	-	-	-
Memorija	-	3,00MB	-	-	-	-
#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, ag;
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        cin >> a[i];
        if (i % 3 == 1)
        {
            jedan += a[i];
            ag = 1;
        }
        else if (i % 3 == 2)
        {
            dva += a[i];
            ag = 2;
        }
        else ag = 3;
    }
    for (i = 0; i < n-1; i++)
    {
        cin >> m >> s;
    }
    if (jedan < dva && ag != 3)
    {
        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;
}