#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, zbir = 0;
    cin >> n;
    cin >> a[1];
    for (i = 2; i <= n; i++)
    {
        cin >> a[i];
        zbir += a[i];
    }
    for (i = 0; i < n-1; i++)
    {
        cin >> m >> s;
    }
    if (a[1] < zbir)
    {
        cout << a[1] << endl << 1 << endl << 1 << endl << 0 << endl;
    }
    else
    {
        cout << zbir << endl << n-1 << endl;
        for (i = 2; i <= n; i++) cout << i << " ";
        cout << endl << 0 << endl;
    }
    return 0;
}