#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};

template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}

extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}


int main()
{
	int n;
	cin>>n;
	auto a=read<LL>(n);
	LL se=0,so=0;
	REP(i,n)
	{
		if(i%2==0)
		{
			if(a[i]>0)
				se+=a[i];
		}
		else
		{
			if(a[i]>0)
				so+=a[i];
		}
	}
	vector<int> ope;
	if(max(so, se)==0)
	{
		int ma=-INF-10, mind=-1;
		REP(i,n)
		if(ma<a[i])
		{
			ma= a[i];
			mind=i;
		}
		print(ma);
		print(n-1);
		REP(i,n-1)
		{
			if(i<mind)
				print(1);
			else
				print(n-i);
		}
		return 0;
	}
	print(max(so,se));
	if(so>se)
	{
		ope.push_back(1);
		int j=-1;
		for(int i=1;i<n;i+=2)
		{
			if(a[i]<=0)
			{
				ope.push_back(1);
				ope.push_back(1);
			}
			else{
				j=i;
				break;
			}
		}
		for(int i=j+2;i<n;i+=2)
		{
			if(a[i]>0)
			{
				ope.push_back(2);
			}
			else
			{
				ope.push_back(3);
			}
		}
		if(a[n-1]>0&&n%2==0)
		{
		}
		else if(n%2==1)
		{
			ope.push_back(2);
		}
		else
		{
			ope.push_back(2);
		}
	}
	else
	{
		int j=-1;
		for(int i=0;i<n;i+=2)
		{
			if(a[i]<=0)
			{
				ope.push_back(1);
				ope.push_back(1);
			}
			else{
				j=i;
				break;
			}
		}
		for(int i=j+2;i<n;i+=2)
		{
			if(a[i]>0)
			{
				ope.push_back(2);
			}
			else
			{
				ope.push_back(3);
			}
		}
		if(a[n-1]>0&&n%2==1)
		{
		}
		else if(n%2==0)
		{
			ope.push_back(2);
		}
		else
		{
			ope.push_back(2);
		}
	}
	print(ope.size());
	REP(i,ope.size())
		print(ope[i]);

}


Measured memory_bytes: 256