#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define eprintf(...) 42
#endif

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

const int K = 101;
const int N = 1010;
int k;
int a[K];
int aa[K];
int b[N];
int id[K];
int lastP = 0;

/*

		vector<pii> c;
		if (n == 0) {
			for (int i = 0; i < k; i++)
				c.push_back(mp(a[i], i));
		} else {
			for (int i = 0; ; i++) {
				int v = b[n - k + i];
				c.push_back(mp(a[v], v));
				if (a[v] == mx) break;
			}
		}
		sort(all(c));
		reverse(all(c));
		for (auto t : c) {
			int v = t.second;
			if (a[v] == 0) {
				printf("-1\n");
				return 0;
			}
			a[v]--;
			b[n++] = v;
		}
*/

bool canCont(int n) {
	int oldn = n;
	for (int i = 0; i < k; i++)
		a[i] = aa[i];
	for (int i = lastP; i < oldn; i++)
		a[b[i]]++;
	int z = 0;
	for (int i = 0; i < k; i++) {
		id[i] = 0;
	}
	for (int i = lastP; i < n; i++) {
		if (id[b[i]]) return false;
		id[b[i]] = 1;
	}
	if (lastP == 0) {
		for (int i = 0; i < k; i++) {
			id[i] = i;
		}
		z = k;
	} else {
		for (int i = 0; i < k; i++)
			id[b[lastP - k + i]] = i;
		for (int i = lastP; i < n; i++)
			z = max(z, id[b[i]] + 1);
	}
	int mx = 0;
	for (int i = 0; i < k; i++) {
		if (a[i] < 0) return false;
		mx = max(mx, a[i]);
	}
	if (mx == 0) return true;
	for (int i = 0; i < k; i++)
		if (a[i] == mx)
			z = max(z, id[i] + 1);
	for (int i = lastP; i < n; i++)
		id[b[i]] = k + 1;
	vector<pii> c;
	for (int i = 0; i < k; i++)
		if (id[i] < z)
			c.push_back(mp(a[i], i));
	sort(all(c));
	reverse(all(c));
	for (auto t : c) {
		int v = t.second;
		if (a[v] == 0) {
			return false;
		}
		a[v]--;
		b[n++] = v;
	}
	for (int i = lastP; i < oldn; i++)
		a[b[i]]--;
	while(true) {
		c.clear();
		int cntMax = 0;
		int mx = 0;
		for (int i = 0; i < k; i++) {
			if (a[i] > mx) {
				mx = a[i];
				cntMax = 0;
			}
			if (a[i] == mx) cntMax++;
		}
		if (mx == 0) return true;
		for (int i = 0; ; i++) {
			int v = b[n - k + i];
			c.push_back(mp(a[v], v));
			if (a[v] == mx) cntMax--;
			if (cntMax == 0) break;
		}
		sort(all(c));
		reverse(all(c));
		for (auto t : c) {
			int v = t.second;
			if (a[v] == 0) {
				return false;
			}
			a[v]--;
			b[n++] = v;
		}
	}
}

int main()
{
	startTime = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &k);
	for (int i = 0; i < k; i++)
		scanf("%d", &aa[i]);
	int n = 0;
	if (!canCont(n)) {
		printf("-1\n");
		return 0;
	}
	while(true) {
		/*
		for (int i = 0; i < n; i++)
			printf("%d ", b[i]);
		printf("\n");
		*/
		if (n >= k) {
			for (int i = 0; i < k; i++)
				id[i] = 0;
			bool ok = true;
			for (int i = 0; ok && i < k; i++) {
				int x = b[n - k + i];
				ok &= !id[x];
				id[x] = 1;
			}
			if (ok) lastP = n;
		}
		//printf("lastP = %d\n", lastP);
		int mx = 0;
		for (int i = 0; mx >= 0 && i < k; i++) {
			if (aa[i] == 0) continue;
			mx = max(mx, aa[i]);
			b[n++] = i;
			aa[i]--;
			if (canCont(n)) {
				mx = -1;
				break;
			}
			n--;
			aa[i]++;
		}
		if (mx == -1) continue;
		if (mx == 0) break;
		assert(false);
	}
	for (int i = 0; i < n; i++)
		printf("%d ", b[i] + 1);
	printf("\n");

	return 0;
}


Measured memory_bytes: 3256