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 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
struct SAIS {
  int s[maxn << 1], t[maxn << 1], sa[maxn], rk[maxn], hi[maxn], p[maxn],
      tax[maxn], cur[maxn];
  void inducedSort(int n, int m, int n1, int *s, int *s1, int *t) {
    for (int i = 0; i < n; ++i) sa[i] = -1;
    for (int i = 0; i < m; ++i) tax[i] = 0;
    for (int i = 0; i < n; ++i) ++tax[s[i]];
    for (int i = 1; i < m; ++i) tax[i] += tax[i - 1];
    for (int i = 0; i < m; ++i) cur[i] = tax[i] - 1;
    for (int i = n1 - 1; ~i; --i) sa[cur[s[s1[i]]]--] = s1[i];
    for (int i = 1; i < m; ++i) cur[i] = tax[i - 1];
    for (int i = 0; i < n; ++i)
      if (sa[i] > 0 && t[sa[i] - 1]) sa[cur[s[sa[i] - 1]]++] = sa[i] - 1;
    for (int i = 0; i < m; ++i) cur[i] = tax[i] - 1;
    for (int i = n - 1; ~i; --i)
      if (sa[i] > 0 && !t[sa[i] - 1]) sa[cur[s[sa[i] - 1]]--] = sa[i] - 1;
  }
  void sais(int n, int m, int *s, int *t, int *p) {
    int n1 = t[n - 1] = 0, ch = rk[0] = -1, *s1 = s + n;
    for (int i = n - 2; ~i; --i)
      t[i] = s[i] == s[i + 1] ? t[i + 1] : s[i] > s[i + 1];
    for (int i = 1; i < n; ++i)
      rk[i] = t[i - 1] && !t[i] ? p[n1] = i, n1++ : -1;
    inducedSort(n, m, n1, s, p, t);
    for (int i = 0, x, y; i < n; ++i) {
      if ((x = rk[sa[i]]) == -1) continue;
      if (ch < 1 || p[x + 1] - p[x] != p[y + 1] - p[y])
        ++ch;
      else
        for (int j = p[x], k = p[y]; j <= p[x + 1]; ++j, ++k)
          if ((s[j] << 1 | t[j]) != (s[k] << 1 | t[k])) {
            ++ch;
            break;
          }
      s1[y = x] = ch;
    }
    if (ch + 1 < n1)
      sais(n1, ch + 1, s1, t + n, p + n1);
    else
      for (int i = 0; i < n1; ++i) sa[s1[i]] = i;
    for (int i = 0; i < n1; ++i) s1[i] = p[sa[i]];
    inducedSort(n, m, n1, s, s1, t);
  }
  void solve(char *str, int n, int m) {
    for (int i = 0; i < n; ++i) s[i] = str[i];
    s[n++] = 0;
    sais(n, m, s, t, p);
    for (int i = 0; i < n; ++i) rk[sa[i]] = i;
    --n;
    for (int i = 0, k = hi[0] = 0; i < n; ++i) {
      int j = sa[rk[i] - 1];
      while (s[i + k] == s[j + k]) ++k;
      if (hi[rk[i]] = k) --k;
    }
    for (int i = n; i >= 1; --i) ++sa[i], rk[i] = rk[i - 1];
  }
} sais;
char s[maxn];
int sum[maxn], mn[maxn], que[maxn];
int n, p1, p2;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) s[i + n] = s[i];
  int tn = n;
  n <<= 1;
  sais.solve(s + 1, n, 256);
  for (int i = 1; i <= n; ++i) {
    sum[i] = sum[i - 1] + (s[i] == '(' ? 1 : -1);
  }
  p1 = 1, p2 = 0;
  for (int i = 1; i <= n; ++i) {
    while (p1 <= p2 && sum[que[p2]] >= sum[i]) --p2;
    que[++p2] = i;
    while (i - que[p1] + 1 > tn) ++p1;
    if (i >= tn) mn[i - tn + 1] = sum[que[p1]] - sum[i - tn];
  }
  int x = inf, y;
  for (int i = 1; i <= tn; ++i) {
    mn[i] = mn[i] >= 0 ? 0 : -mn[i];
    x = min(x, mn[i]);
  }
  int p = 0;
  y = x + sum[tn];
  for (int i = 1; i <= n; ++i) {
    if (sais.sa[i] > tn) continue;
    if (mn[sais.sa[i]] == x) {
      p = sais.sa[i];
      break;
    }
  }
  while (x--) putchar('(');
  s[p + tn] = 0;
  printf("%s", s + p);
  while (y--) putchar(')');
  return 0;
}