Baby Bob is learning about mathematical expressions. He despises operands and operators, and only likes round brackets.
He's got a sequence of positive integers . He wants to bracketize the sequence. A bracketized sequence created from is a sequence of strings such that each has length , and consists only of either opening brackets (, or closing brackets ), but not both.
For example let .
- A possible bracketized sequence created from is
),))),((((. - The sequence
),)(),((((is not a bracketized sequence created from , because the second element consists of both opening and closing brackets. - The sequence
(,)))),((((is not a bracketized sequence created from , because the length of the second element is not . - The sequence
(,)is not a bracketized sequence created from , because it consists of only strings.
Take the string (i.e., concatenate the elements of the bracketized sequence). Bob wonders whether he can bracketize so that the resulting string is a valid bracket sequence. A bracket sequence is valid if 1 and + characters can be inserted into it so that it becomes a valid mathematical expression. For example, (((()))) is a valid bracket sequence if .
Task
Write a program that finds such a bracket sequence or determines that it's impossible!
Input data
The first line contains the only integer . The second line contains integers .
Output data
You need to print a valid bracket sequence created from or -1 if it's not possible to create one.
If there are multiple correct bracket sequences, output any.
Constraints and clarifications
- for each
| # | Points | Constraints |
|---|---|---|
| 1 | 0 | Examples |
| 2 | 20 | |
| 3 | 30 | and |
| 4 | 50 | No additional constraints |
Example 1
stdin
3
1 3 4
stdout
(((())))
Explanation
This sample case is explained in the statement.
Example 2
stdin
4
2 2 1 1
stdout
(())()
Explanation
In this sample the bracketized sequence is ((, )), (, ).
Example 3
stdin
2
2 1
stdout
-1