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;
const int MAXN = 2e6 + 1000;
int t1, t2;
int lr[MAXN];
int ll[MAXN];
int rl[MAXN];
int rr[MAXN];
bool check(int i) {
  if (i == 0) {
    return rr[i] == t1 && rl[i] == t2;
  }
  int tl, tr;
  tr = rr[i];
  tl = ll[i - 1];
  int tmin = min(rl[i], lr[i - 1]);
  tl += rl[i] - tmin;
  tr += lr[i - 1] - tmin;
  if (tr == t1 && tl == t2) return true;
  return false;
}
struct SA {
  int rank[MAXN], height[MAXN];
  int len;
  inline int ge(char a) {
    if (a == '(')
      return 1;
    else if (a == ')')
      return 2;
    else
      return 0;
  }
  int sa[MAXN];
  int wa[MAXN], wb[MAXN], wv[MAXN], ws[MAXN];
  int cmp(int *r, int a, int b, int l) {
    return r[a] == r[b] && r[a + l] == r[b + l];
  }
  void da(char *r, int *sa, int n, int m) {
    int i, j, p, *x = wa, *y = wb, *t;
    for (i = 0; i < m; i++) ws[i] = 0;
    for (i = 0; i < n; i++) ws[x[i] = ge(r[i])]++;
    for (i = 1; i < m; i++) ws[i] += ws[i - 1];
    for (i = n - 1; i >= 0; i--) sa[--ws[x[i]]] = i;
    for (j = 1, p = 1; p < n; j *= 2, m = p) {
      for (p = 0, i = n - j; i < n; i++) y[p++] = i;
      for (i = 0; i < n; i++)
        if (sa[i] >= j) y[p++] = sa[i] - j;
      for (i = 0; i < n; i++) wv[i] = x[y[i]];
      for (i = 0; i < m; i++) ws[i] = 0;
      for (i = 0; i < n; i++) ws[wv[i]]++;
      for (i = 1; i < m; i++) ws[i] += ws[i - 1];
      for (i = n - 1; i >= 0; i--) sa[--ws[wv[i]]] = y[i];
      for (t = x, x = y, y = t, p = 1, x[sa[0]] = 0, i = 1; i < n; i++)
        x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p - 1 : p++;
    }
    return;
  }
  int solve(char *s) {
    len = strlen(s);
    s[len] = 0;
    da(s, sa, len + 1, 3);
    for (int i = 0; i < len + 1; ++i) {
      if (sa[i] < len / 2 && check(sa[i])) {
        return sa[i];
      }
    }
    return -1;
  }
} tq;
char s[MAXN];
int main() {
  while (scanf("%s", s) != EOF) {
    memset(lr, 0, sizeof lr);
    memset(ll, 0, sizeof ll);
    memset(rr, 0, sizeof rr);
    memset(rl, 0, sizeof rl);
    int len = strlen(s);
    t1 = 0, t2 = 0;
    for (int i = 0; i < len; ++i) {
      s[i + len] = s[i];
      if (s[i] == '(') {
        ++t1;
      } else {
        ++t2;
      }
    }
    int tn = min(t1, t2);
    t1 -= tn, t2 -= tn;
    swap(t1, t2);
    s[len * 2] = '\0';
    int tl = 0, tr = 0;
    for (int i = 0; i < len; ++i) {
      if (s[i] == '(') {
        ++tl;
      } else {
        if (tl == 0)
          ++tr;
        else
          --tl;
      }
      lr[i] = tr;
      ll[i] = tl;
    }
    tl = tr = 0;
    for (int i = len - 1; i >= 0; --i) {
      if (s[i] == ')') {
        ++tr;
      } else {
        if (tr == 0)
          ++tl;
        else
          --tr;
      }
      rr[i] = tr;
      rl[i] = tl;
    }
    for (int i = 0; i < t1; ++i) putchar('(');
    int tmp = tq.solve(s);
    for (int i = 0; i < len; ++i) {
      putchar(s[i + tmp]);
    }
    for (int i = 0; i < t2; ++i) putchar(')');
    puts("");
  }
  return 0;
}