CSES - Match (CEOI 2016)
  • Time limit: 0.10 s
  • Memory limit: 256 MB

We define a valid bracket sequence as a string that is either:

  • The empty string;
  • A string (B), where B is a valid bracket sequence.
  • LR, the concatenation of two strings L and R which are both valid bracket sequences.

Let BB be a valid bracket sequence of length NN. We define BiB_i to be the ii-th character of the sequence BB. For two indices ii and jj, 1i<jN1 \le i < j \le N, we say that BiB_i and BjB_j are matching brackets if:

  • Bi="("B_i = \mathrm{"("} and Bj=")"B_j = \mathrm{")"};
  • i=j1i = j-1, or the subsequence C=Bi+1Bi+2Bj1C = B_{i+1}B_{i+2}\dots B_{j-1} is a valid bracket sequence.

Let SS be a string of lowercase English letters. We define SiS_i to be the ii-th character of string SS. We say that a valid bracket sequence BB matches SS if:

  • BB has the same length as SS;
  • for any pair of indices ii and jj, i<ji < j, if BiB_i and BjB_j are matching brackets, then Si=SjS_i = S_j.

We say that a bracket sequence AA is lexicographically smaller than a bracket sequence BB if there is an index ii, 1iN1 \le i \le N, such that Aj=bjA_j = b_j for each j<ij < i, and Ai<BiA_i < B_i. Character ''('' is considered lexicographically smaller than character '')''.

For a given string SS consisting of NN lowercase letters, find the lexicographically smallest valid bracket seuqnece that matches SS, or print -1 if no such bracket sequence exists.

Input

The input consists of a string SS of NN lowercase letters on one line.

Output

Output either a string BB with NN characters that represents the lexicographically smallest bracket sequence that matches the input string, or -1 if no such bracket sequence exists.

Constraints

  • 2N1052 \le N \le 10^5

Example 1

Input:

abbaaa

Output:

(()())

Example 2

Input:

abab

Output:

-1