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 N = 1e6 + 3;
const int M = 4e6 + 3;
const int oo = 1e9;
const int OS = 317;
const int MOD = 1e9 + 7;
char s[N];
int n, stp[M], p1[N], p2[N], s1[N], s2[N], ho[N], hz[N], h[N], op[N], zp[N],
    os[N], zs[N], il[N], ir[N];
vector<int> st;
int get(int i, int ln) {
  int ans, l1, l, r, ym;
  l1 = min(il[i], ln);
  ym = 2 * n;
  ans = (stp[ym] * 1LL * ho[l1]) % MOD;
  if (ln - l1 > 0) {
    l = i + 1;
    r = l + min(n - i, ln - l1) - 1;
    ans = (ans + (((h[r] - h[l - 1]) % MOD + MOD) % MOD) * 1LL *
                     stp[ym + l1 - (l - 1)] % MOD) %
          MOD;
    l1 += r - l + 1;
    if (ln - l1 > 0) {
      r = min(i, ln - l1);
      ans = (ans + h[r] * 1LL * stp[ym + l1] % MOD) % MOD;
      l1 += r;
      if (ln - l1 > 0) {
        r = ln - l1;
        ans = (ans + hz[r] * 1LL * stp[ym + l1] % MOD) % MOD;
      }
    }
  }
  return ans;
}
int get_ch(int i, int ln) {
  if (ln <= il[i]) return '(';
  ln -= il[i];
  if (ln <= n - i) return s[i + ln];
  ln -= n - i;
  if (ln <= i)
    return s[ln];
  else
    return ')';
}
int ans;
bool cmp(int i, int j) {
  int l, r, x;
  l = 1, r = ans;
  while (l <= r) {
    x = (l + r) >> 1;
    if (get(i, x) == get(j, x))
      l = x + 1;
    else
      r = x - 1;
  }
  if (r + 1 > ans) return true;
  return get_ch(i, r + 1) <= get_ch(j, r + 1);
}
int main() {
  if (0) {
    freopen("input.txt", "w", stdout);
    int n = 1e6;
    for (int i = 0; i < n; ++i) printf("(");
    printf("\n");
    return 0;
  }
  int i, j, len, mn;
  gets(s + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; ++i)
    if (s[i] == '(')
      p1[i] = p1[i - 1], p2[i] = p2[i - 1] + 1;
    else if (p2[i - 1])
      p1[i] = p1[i - 1] + 2, p2[i] = p2[i - 1] - 1;
    else
      p1[i] = p1[i - 1], p2[i] = p2[i - 1];
  for (i = n; i; --i)
    if (s[i] == ')')
      s1[i] = s1[i + 1], s2[i] = s2[i + 1] + 1;
    else if (s2[i + 1])
      s1[i] = s1[i + 1] + 2, s2[i] = s2[i + 1] - 1;
    else
      s1[i] = s1[i + 1], s2[i] = s2[i + 1];
  for (i = 0; i <= n; ++i) {
    op[i] = p2[i];
    zp[i] = i - p1[i] - op[i];
    zs[i] = s2[i + 1];
    os[i] = n - i - s1[i + 1] - zs[i];
    il[i] = zs[i];
    ir[i] = op[i];
    if (os[i] > zp[i])
      ir[i] += os[i] - zp[i];
    else
      il[i] += zp[i] - os[i];
  }
  ans = oo;
  for (i = 0; i < n; ++i) {
    len = n + zs[i] + op[i] + max(os[i], zp[i]) - min(os[i], zp[i]);
    if (ans > len) st.clear();
    if (ans >= len) ans = len, st.push_back(i);
  }
  stp[0] = 1;
  for (i = 1; i < M; ++i) stp[i] = (stp[i - 1] * 1LL * OS) % MOD;
  ho[0] = hz[0] = 0;
  for (i = 1; i < N; ++i)
    ho[i] = (ho[i - 1] + '(' * 1LL * stp[i - 1] % MOD) % MOD;
  for (i = 1; i < N; ++i)
    hz[i] = (hz[i - 1] + ')' * 1LL * stp[i - 1] % MOD) % MOD;
  h[0] = 0;
  for (i = 1; i <= n; ++i)
    h[i] = (h[i - 1] + s[i] * 1LL * stp[i - 1] % MOD) % MOD;
  mn = st[0];
  for (i = 1; i < st.size(); ++i)
    if (cmp(st[i], mn)) mn = st[i];
  i = mn;
  for (j = 0; j < il[i]; ++j) putchar('(');
  for (j = i + 1; j <= n; ++j) putchar(s[j]);
  for (j = 1; j <= i; ++j) putchar(s[j]);
  for (j = 0; j < ir[i]; ++j) putchar(')');
  return 0;
}