#include <bits/stdc++.h>

namespace IO
{
char gc()
{
#ifdef FREAD
	static char buf[1<<21], *P1 = buf, *P2 = buf;
	if(P1 == P2)
	{
		P1 = buf;
		P2 = buf + fread(buf, 1, 1<<21, stdin);
		if(P1 == P2) return EOF;
	}
	return *(P1++);
#else
	return getchar();
#endif
}
template<typename Tp> bool get1(Tp &x)
{
	bool neg = 0;
	char c = gc();
	while( c != EOF && (c < '0' || c > '9') && c != '-' ) c = gc();
	if(c == '-') c = gc(), neg = 1;
	if(c == EOF) return false;
	x = 0;
	for(; c>='0' && c<='9'; c = gc()) x = x*10 + c - '0';
	if(neg) x = -x;
	return true;
}
template<typename Tp> void printendl(Tp x)
{
	if(x<0)putchar('-'),x=-x;
	static short a[40], sz;
	sz = 0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
	puts("");
}
} // namespace IO
using IO::get1;
using IO::printendl;
#define get2(x,y) get1(x) && get1(y)
#define get3(x,y,z) get2(x,y) && get1(z)
#define get4(x,y,z,w) get3(x,y,z) && get1(w)
#define pb push_back
#define mp std::make_pair
#define ff first
#define ss second
typedef long long LL;
typedef unsigned long long uLL;
typedef std::pair<int,int> pii;
const int inf = 0x3f3f3f3f;
const LL Linf = 1ll<<61;

const int maxn = 111;

int a[maxn], p[1111], n, k, tot, mn, mx;

bool have[maxn];
std::vector<int> try_extend(std::vector<int> pre)
{
	static int b[maxn], have[maxn];
	
	std::vector<int> ret;
	for(int i=1; i<=k; i++)
	{
		b[i] = a[i];
		have[i] = 0;
	}
	for(auto v : pre) have[v] = 1;
	for(int i=1; i<=k; i++) if(!have[i]) ret.pb(i);
	// printf("try size= %d mx= %d mn= %d\n", ret.size(), mx, mn);
	// for(int i=1; i<=k; i++) printf("i= %d c= %d\n", i, a[i]);
	for(auto v : ret)
	{
		b[v]--;
		if(b[v] < 0) return std::vector<int>();
	}
	mx = *std::max_element(b+1, b+k+1);
	mn = *std::min_element(b+1, b+k+1);
	if(mx > mn * 2 + 1) return std::vector<int>();
	
	if(mx <= mn * 2) std::sort(ret.begin(), ret.end());
	else
	{
		std::vector<int> good, other;
		for(auto v : ret) if(b[v] != mx && b[v] != mn) good.pb(v); else if(b[v] == mx) other.pb(v);
		for(auto v : ret) if(b[v] == mn) other.pb(v);
		int it1 = 0, it2 = 0;
		
		ret.clear();
		while(it1 < good.size() && it2 < other.size())
		{
			if(good[it1] < other[it2]) ret.pb(good[it1++]);
			else ret.pb(other[it2++]);
		}
		while(it1 < good.size()) ret.pb(good[it1++]);
		while(it2 < other.size()) ret.pb(other[it2++]);
	}
	
	if(mx == mn * 2 + 1)
	{
		bool haveMN = 0;
		for(auto v : pre)
		{
			if(b[v] == mn) haveMN = 1;
			else if(b[v] == mx && haveMN) return std::vector<int>();
		}
		for(auto v : ret)
		{
			if(b[v] == mn) haveMN = 1;
			else if(b[v] == mx && haveMN) return std::vector<int>();
		}
	}
	
	return ret;
}

void extend()
{
	std::vector<int> ext, tmp;
	if(tot == 0) ext = try_extend(std::vector<int>());
	else
	{
		for(int i=std::max(0, tot + k - n); i < k; i++)
		{
			tmp.clear();
			for(int j=tot-i+1; j<=tot; j++) tmp.pb(p[j]);
			tmp = try_extend(tmp);
			if(tmp.size() && (ext.size() == 0 || tmp < ext)) ext = tmp;
		}
	}
	assert(ext.size());
	for(auto v : ext)
	{
		p[++tot] = v;
		a[v]--;
	}
}

int main()
{
	get1(k);
	for(int i=1; i<=k; i++)
	{
		get1(a[i]);
		n += a[i];
	}
	
	int mx = *std::max_element(a+1, a+k+1), mn = *std::min_element(a+1, a+k+1);
	if(mx > mn * 2)
	{
		puts("-1");
		return 0;
	}
	while(tot < n) extend();
	for(int i=1; i<=n; i++) printf("%d ", p[i]);
	return 0;
}

Measured memory_bytes: 3736