{"raw_statement":[{"iden":"problem statement","content":"Given are an integer $K$ and integers $a_1,\\dots, a_K$. Determine whether a sequence $P$ satisfying below exists. If it exists, find the lexicographically smallest such sequence.\n\n*   Every term in $P$ is an integer between $1$ and $K$ (inclusive).\n*   For each $i=1,\\dots, K$, $P$ contains $a_i$ occurrences of $i$.\n*   For each term in $P$, there is a contiguous subsequence of length $K$ that contains that term and is a permutation of $1,\\dots, K$."},{"iden":"constraints","content":"*   $1 \\leq K \\leq 100$\n*   $1 \\leq a_i \\leq 1000 \\quad (1\\leq i\\leq K)$\n*   $a_1 + \\dots + a_K\\leq 1000$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$K$\n$a_1$ $a_2$ $\\dots$ $a_K$"},{"iden":"sample input 1","content":"3\n2 4 3"},{"iden":"sample output 1","content":"2 1 3 2 2 3 1 2 3 \n\nFor example, the fifth term, which is $2$, is in the subsequence $(2, 3, 1)$ composed of the fifth, sixth, and seventh terms."},{"iden":"sample input 2","content":"4\n3 2 3 2"},{"iden":"sample output 2","content":"1 2 3 4 1 3 1 2 4 3"},{"iden":"sample input 3","content":"5\n3 1 4 1 5"},{"iden":"sample output 3","content":"\\-1"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}