#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define fi first
#define si second
#define pii pair<int,int>
#define int long long

using namespace std;

signed main()
{
    speed;
    int n;
    cin>>n;
    int niz[n+1];
    int sum1=0,sumall=0;
    for(int i=1;i<=n;i++){
        cin>>niz[i];
        sumall+=niz[i];
    }
    sum1=niz[1];
    for(int i=0;i<n;i++){
        int u,v;
        cin>>u>>v;
    }
    if(sum1>sumall-sum1){
        cout<<sum1<<endl;
        cout<<1<<endl<<1<<endl;
    }
    else{
        cout<<sumall-sum1<<endl;
        cout<<n-1<<endl;
        for(int i=2;i<=n;i++)cout<<i<<" ";
    }
    return 0;
}