use proconio::{fastout, input};
use std::cmp;

fn make_seq(v: &Vec<usize>) -> Vec<usize> {
    let n = v.len();
    let mut u: Vec<usize> = Vec::new();
    let mx: usize = vecmax(&v);
    let mn: usize = vecmin(&v);
    if mx < mn * 2 {
        for i in 1..=n {
            u.push(i);
        }
    } else {
        let mut j: usize = 0;
        for i in 1..=n {
            if v[i - 1] == mx {
                j = i;
            }
        }
        for i in 1..=n {
            if v[i - 1] != mn {
                u.push(i);
            }
            if i == j {
                break;
            }
        }
        for i in 1..=n {
            if v[i - 1] == mn {
                u.push(i);
            }
            if i == j {
                break;
            }
        }
        if j < n {
            for i in (j + 1)..=n {
                u.push(i);
            }
        }
    }
    u
}

fn ok(v: &Vec<usize>) -> bool {
    let mx: usize = vecmax(&v);
    let mn: usize = vecmin(&v);
    if mx > 2 * mn {
        false
    } else {
        true
    }
}

fn vecmax(v: &Vec<usize>) -> usize {
    let n = v.len();
    let mut mx: usize = v[0];
    for i in 1..n {
        mx = cmp::max(mx, v[i]);
    }
    mx
}

fn vecmin(v: &Vec<usize>) -> usize {
    let n = v.len();
    let mut mn: usize = v[0];
    for i in 1..n {
        mn = cmp::min(mn, v[i]);
    }
    mn
}

#[fastout]
fn main() {
    input! {
        k: usize,
        mut a: [usize; k],
    }

    //可能かどうかの判定
    let mx: usize = vecmax(&a);
    let mn: usize = vecmin(&a);

    //不可能な場合を除外
    if mx > 2 * mn {
        println!("{}", -1);
        return;
    }

    let mut all: usize = 0;
    for i in 0..k {
        all += a[i];
    }

    let mut ans: Vec<usize> = Vec::with_capacity(all);

    let mut num: usize = 0;

    loop {
        if ans.len() == 0 {
            let mut now: Vec<usize> = make_seq(&a);
            ans.append(&mut now);
            for i in 0..k {
                a[i] -= 1;
            }
            num += k;
        } else {
            let n: usize = ans.len();
            let mut v: Vec<Vec<usize>> = Vec::with_capacity(k + 1);
            let mut flag: bool;
            for i in 0..(k - 1) {
                let mut v_tmp: Vec<usize> = Vec::with_capacity(k);
                let mut c = a.clone();
                flag = false;
                for j in 0..=i {
                    v_tmp.push(ans[n - k + j]);
                    if a[ans[n - k + j] - 1] == 0 {
                        flag = true;
                        break;
                    }
                    c[ans[n - k + j] - 1] -= 1;
                }
                if flag {
                    continue;
                }
                if ok(&c) {
                    v_tmp.sort();
                    v.push(v_tmp);
                } else {
                    //この場合もうまくいくかもしれない
                    let cmx: usize = vecmax(&c);
                    let cmn: usize = vecmin(&c);

                    if cmx == cmn * 2 + 1 {
                        let mut v_tmp2: Vec<usize> = Vec::with_capacity(k);
                        for j in (i + 1)..k {
                            v_tmp2.push(ans[n - k + j]);
                        }
                        let mut j: usize = 0;
                        for i in 1..=k {
                            if c[i - 1] == cmx {
                                j = i;
                            }
                        }
                        for i in 1..=k {
                            if c[i - 1] != cmn && v_tmp.contains(&i) {
                                v_tmp2.push(i);
                            }
                            if i == j {
                                break;
                            }
                        }
                        for i in 1..=k {
                            if c[i - 1] == cmn && v_tmp.contains(&i) {
                                v_tmp2.push(i);
                            }
                            if i == j {
                                break;
                            }
                        }
                        if j < k {
                            for i in (j + 1)..=k {
                                if v_tmp.contains(&i) {
                                    v_tmp2.push(i);
                                }
                            }
                        }
                        let mut lastcmx: usize = 0;
                        let mut firstcmn: usize = 0;
                        for i in 0..k {
                            if c[v_tmp2[i] - 1] == cmx {
                                lastcmx = i;
                            }
                        }
                        for i in 0..k {
                            if c[v_tmp2[i] - 1] == cmn {
                                firstcmn = i;
                                break;
                            }
                        }
                        if lastcmx < firstcmn {
                            for _ in (i + 1)..k {
                                v_tmp2.remove(0);
                            }
                            v.push(v_tmp2);
                        }
                    }
                }
            }
            if ok(&a) {
                let now: Vec<usize> = make_seq(&a);
                v.push(now);
            }
            v.sort();
            let mut w = v[0].clone();
            ans.append(&mut w);
            let m: usize = v[0].len();
            for i in 0..m {
                a[v[0][i] - 1] -= 1;
            }
            num += m;
        }

        if all == num {
            break;
        }
    }

    for i in 0..(all - 1) {
        print!("{} ", ans[i]);
    }
    println!("{}", ans[all - 1]);
}


Measured memory_bytes: 2292