Problem: Polycarpus has a finite sequence of opening and closing brackets. In order not to fall asleep in a lecture, Polycarpus is having fun with his sequence. He is able to perform two operations:

  * adding any bracket in any position (in the beginning, the end, or between any two existing brackets); 
  * cyclic shift — moving the last bracket from the end of the sequence to the beginning. 



Polycarpus can apply any number of operations to his sequence and adding a cyclic shift in any order. As a result, he wants to get the correct bracket sequence of the minimum possible length. If there are several such sequences, Polycarpus is interested in the lexicographically smallest one. Help him find such a sequence.

Acorrect bracket sequence is a sequence of opening and closing brackets, from which you can get a correct arithmetic expression by adding characters "1" and "+" . Each opening bracket must correspond to a closed one. For example, the sequences "(())()", "()", "(()(()))" are correct and ")(", "(()" and "(()))(" are not.

The sequence a1 a2... an is lexicographically smaller than sequence b1 b2... bn, if there is such number i from 1 to n, thatak = bk for 1 ≤ k < i and ai < bi. Consider that "("  < ")".

Input

The first line contains Polycarpus's sequence consisting of characters "(" and ")". The length of a line is from 1 to 1 000 000.

Output

Print a correct bracket sequence of the minimum length that Polycarpus can obtain by his operations. If there are multiple such sequences, print the lexicographically minimum one.

Examples

Input

()(())


Output

(())()

Input

()(


Output

(())

Note

The sequence in the first example is already correct, but to get the lexicographically minimum answer, you need to perform four cyclic shift operations. In the second example you need to add a closing parenthesis between the second and third brackets and make a cyclic shift. You can first make the shift, and then add the bracket at the end.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using namespace std;
int sp[2000514 * 7], spt;
int ta[2000514], tb[2000514], tc[2000514];
int box[2000514];
void radix(int *key, int *a, int *b, int n, int m) {
  for (int i = 0; i <= m; i++) box[i] = 0;
  for (int i = 0; i < n; i++) box[key[a[i]]]++;
  for (int i = 1; i <= m; i++) box[i] += box[i - 1];
  for (int i = n - 1; i >= 0; i--) b[--box[key[a[i]]]] = a[i];
}
bool equ(int *s, int a, int b) {
  return s[a] == s[b] && s[a + 1] == s[b + 1] && s[a + 2] == s[b + 2];
}
bool cmp(int *s, int *sa12, int a, int b) {
  if (s[a + 0] != s[b + 0]) return s[a + 0] < s[b + 0];
  if (b % 3 == 1) return sa12[a + 1] < sa12[b + 1];
  if (s[a + 1] != s[b + 1]) return s[a + 1] < s[b + 1];
  return sa12[a + 2] < sa12[b + 2];
}
void make_sa(int *sa, int *s, int l, int m) {
  for (int i = 0; i < 3; i++) {
    s[l + i] = 0;
  }
  int nl = 0, hl = (l + 1) / 3;
  for (int i = 0; i < l; i++)
    if (i % 3) ta[nl++] = i;
  radix(s + 2, ta, tb, nl, m);
  radix(s + 1, tb, ta, nl, m);
  radix(s + 0, ta, sa, nl, m);
  int *nsa = sp + spt;
  spt += nl + 3;
  int *ns = sp + spt;
  spt += nl + 3;
  int j = 1;
  ns[((sa[0]) / 3 + ((sa[0]) % 3 == 1 ? 0 : hl))] = 0;
  for (int i = 1; i < nl; i++) {
    ns[((sa[i]) / 3 + ((sa[i]) % 3 == 1 ? 0 : hl))] =
        equ(s, sa[i - 1], sa[i]) ? j - 1 : j++;
  }
  if (j < nl)
    make_sa(nsa, ns, nl, j);
  else
    for (int i = 0; i < nl; i++) nsa[ns[i]] = i;
  int nr = 0;
  for (int i = 0; i < nl; i++) {
    if (nsa[i] < hl) tb[nr++] = nsa[i] * 3;
  }
  if (l % 3 == 1) tb[nr++] = l - 1;
  radix(s, tb, ta, nr, m);
  for (int i = 0; i < nl; i++) {
    tc[tb[i] = ((nsa[i]) < hl ? (nsa[i]) * 3 + 1 : ((nsa[i]) - hl) * 3 + 2)] =
        i;
  }
  int p = 0, q = 0, r = 0;
  for (; p < nr && q < nl;) {
    sa[r++] = cmp(s, tc, ta[p], tb[q]) ? ta[p++] : tb[q++];
  }
  for (; p < nr;) sa[r++] = ta[p++];
  for (; q < nl;) sa[r++] = tb[q++];
  spt -= (nl + 3) * 2;
}
char s[2000514];
int sum[2000514];
int qk[2000514];
int qx[2000514];
int qs, qe;
int mx[2000514];
int sa[2000514];
int ns[2000514];
void sol() {
  int l = 1;
  for (; s[l]; l++)
    ;
  l--;
  for (int i = 1; i <= l; i++) s[i + l] = s[i];
  s[l + l + 1] = 0;
  int nl = l * 2;
  for (int i = 1; i <= nl; i++) ns[i] = (s[i] == '(' ? 1 : 2);
  ns[nl + 1] = 0;
  for (int i = 1; i <= nl; i++) sum[i] = sum[i - 1] + (s[i] == '(' ? 1 : -1);
  int d = sum[l];
  qs = qe = 0;
  for (int i = 1; i <= nl; i++) {
    if (qe - qs && qx[qs] <= i - l) qs++;
    for (; qe - qs && qk[qe - 1] >= sum[i]; qe--)
      ;
    qk[qe] = sum[i];
    qx[qe] = i;
    qe++;
    mx[i] = qk[qs];
  }
  make_sa(sa, ns + 1, nl + 1, 128);
  int ans = -1;
  for (int i = 0; i < nl + 1; i++) {
    int w = sa[i] + 1;
    if (w > l) continue;
    int tmn = mx[w + l - 1];
    if (d < 0) {
      if (tmn - sum[w - 1] >= d) {
        ans = w;
        break;
      }
    } else {
      if (tmn - sum[w - 1] >= 0) {
        ans = w;
        break;
      }
    }
  }
  for (; d < 0; d++) putchar('(');
  s[ans + l] = 0;
  printf("%s", s + ans);
  for (; d > 0; d--) putchar(')');
  puts("");
}
int main() {
  while (scanf("%s", s + 1) != EOF) sol();
  return 0;
}