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 = 1000010;
const int maxL = 21;
namespace suffixArray {
int ra[maxN], sa[maxN], P[maxL][maxN];
int lg, len, cum[maxN];
struct node {
  int a, b, c;
} L[maxN], tmp[maxN];
inline int cSort(int idx) {
  int n = max(300, len + 2), sum = 0;
  for (int i = 0; i < n; i++) cum[i] = 0;
  for (int i = 0; i < len; i++) {
    if (idx)
      cum[L[i].a + 1]++;
    else
      cum[L[i].b + 1]++;
  }
  for (int i = 0; i < n; i++) sum += cum[i], cum[i] = sum - cum[i];
  for (int i = 0; i < len; i++) {
    if (idx)
      tmp[cum[L[i].a + 1]++] = L[i];
    else
      tmp[cum[L[i].b + 1]++] = L[i];
  }
  for (int i = 0; i < len; i++) L[i] = tmp[i];
}
inline void construct(const char* s) {
  len = strlen(s);
  lg = 1;
  for (int i = 0; i < len; i++) P[0][i] = int(s[i]);
  for (int shift = 1; shift < len; shift <<= 1, lg++) {
    for (int i = 0; i < len; i++) {
      L[i].a = P[lg - 1][i];
      L[i].b = i + shift < len ? P[lg - 1][i + shift] : -1;
      L[i].c = i;
    }
    cSort(0);
    cSort(1);
    for (int i = 0; i < len; i++)
      P[lg][L[i].c] = (i > 0 && L[i].a == L[i - 1].a && L[i].b == L[i - 1].b)
                          ? P[lg][L[i - 1].c]
                          : i;
  }
  lg--;
  for (int i = 0; i < len; i++) sa[i] = 0;
  for (int i = 0; i < len; i++) sa[P[lg][i]] = i;
  for (int i = 0; i < len; i++) ra[sa[i]] = i;
}
inline int lcp(int i, int j) {
  if (i == j) return len - i;
  int l = 0;
  for (int k = lg; k >= 0 && i < len && j < len; k--) {
    if (P[k][i] == P[k][j]) {
      i += 1 << k;
      j += 1 << k;
      l += 1 << k;
    }
  }
  return l;
}
}  // namespace suffixArray
char s[maxN];
int prefMin[maxN], sufMin[maxN], balance[maxN];
int main() {
  scanf("%s", s);
  int n = strlen(s);
  suffixArray::construct(s);
  s[n] = 0;
  int open = 0, close = 0;
  for (int i = 0; i < (n); ++i) {
    if (s[i] == '(') {
      ++open;
      if (i == 0)
        balance[i] = 1;
      else
        balance[i] = balance[i - 1] + 1;
    } else {
      ++close;
      if (i == 0)
        balance[i] = -1;
      else
        balance[i] = balance[i - 1] - 1;
    }
  }
  for (int i = 0; i < (n); ++i) {
    if (i == 0)
      prefMin[i] = balance[i];
    else
      prefMin[i] = min(prefMin[i - 1], balance[i]);
  }
  for (int i = n - 1; i >= 0; --i) {
    if (i == n - 1)
      sufMin[i] = balance[i];
    else
      sufMin[i] = min(sufMin[i + 1], balance[i]);
  }
  int start = -1;
  for (int i = 0; i < (n); ++i)
    if (suffixArray::sa[i] < n) {
      int p = suffixArray::sa[i];
      if (p == 0) {
        if (max(close - open, 0) + sufMin[p] >= 0) {
          if (start == -1) {
            start = p;
          }
        }
      } else {
        if (max(close - open, 0) + sufMin[p] - balance[p - 1] >= 0) {
          if (prefMin[p - 1] + max(close - open, 0) + balance[n - 1] -
                  balance[p - 1] >=
              0) {
            if (start == -1) {
              start = p;
            } else {
              int common = suffixArray::lcp(start, p);
              if (common < n - start) {
                break;
              } else {
                if (suffixArray::ra[p + common] < suffixArray::ra[0]) {
                  start = p;
                }
              }
            }
          }
        }
      }
    }
  assert(start != -1);
  while (open < close) putchar('('), ++open;
  for (int i = 0; i < (n); ++i) putchar(s[(start + i) % n]);
  while (open > close) putchar(')'), ++close;
  puts("");
  return 0;
}