import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.io.File;
import java.io.PrintWriter;

/**
 * Created by IntelliJ IDEA.
 * User: m09fpv
 * Date: 02.12.2009
 * Time: 17:53:02
 * To change this template use File | Settings | File Templates.
 */
public class salesman {
 public static void main(String[]  args) throws Exception {
   Scanner in=new  Scanner(new File("salesman.in"));
   PrintWriter out=new PrintWriter(new File("salesman.out"));
   int n=in.nextInt(); int t,tmp,cnt;
   ArrayList<Integer> a=new ArrayList<Integer>();
   for(int i=0;i<n;i++){
     t=in.nextInt();
     a.add(t);
   }
   Collections.sort(a);
   cnt=a.get(n-1)+a.get(0);
   if(cnt<0){ cnt=0; }
   for(int i=0;i<n-2;i++){
    tmp=a.get(i)+a.get(i+1);
    cnt+=tmp;
   }
   if(cnt<0){ out.println("0"); }
   else{ out.println(cnt); }
   out.print(n+" ");
   for(int i=0;i<n-1;i++){
    out.print(i+1+" ");
   }
   in.close();
   out.close();
  }
}
