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;
namespace IO {
const int sz = 1 << 15;
char inbuf[sz], outbuf[sz];
char *pinbuf = inbuf + sz;
char *poutbuf = outbuf;
inline char _getchar() {
  if (pinbuf == inbuf + sz) fread(inbuf, 1, sz, stdin), pinbuf = inbuf;
  return *(pinbuf++);
}
inline void _putchar(char x) {
  if (poutbuf == outbuf + sz) fwrite(outbuf, 1, sz, stdout), poutbuf = outbuf;
  *(poutbuf++) = x;
}
inline void flush() {
  if (poutbuf != outbuf)
    fwrite(outbuf, 1, poutbuf - outbuf, stdout), poutbuf = outbuf;
}
}  // namespace IO
inline int read() {
  int x = 0, p = 1;
  char c = IO::_getchar();
  while (c < '0' || c > '9') {
    if (c == '-') p = -1;
    c = IO::_getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = IO::_getchar();
  return x * p;
}
const int Maxn = 1e6 + 5;
char c[Maxn];
int n;
struct br {
  int v, m;
  br() { v = m = 0; }
  br(int _v, int _m) { v = _v, m = _m; }
  br(char __) {
    int _x = (__ == '(') ? 1 : -1;
    v = _x, m = min(0, _x);
  }
  br operator+(br x) { return br(v + x.v, min(m, v + x.m)); }
};
const long long mod1 = 998244353;
const long long mod2 = 1e9 + 9;
int H1[Maxn][22], H2[Maxn][22];
br pre[Maxn], suf[Maxn];
long long pw1[25], pw2[25];
bool cmp(int x, int y) {
  int lim = 1;
  while ((1 << lim) <= n) lim++;
  for (int i = lim - 1; i >= 0; i--) {
    if (H1[x][i] == H1[y][i] && H2[x][i] == H2[y][i]) {
      x += 1 << i;
      y += 1 << i;
      if (x > n) x -= n;
      if (y > n) y -= n;
    }
  }
  return c[x] < c[y];
}
int main() {
  scanf("%s", c + 1);
  n = strlen(c + 1);
  for (int i = 1; i <= n; i++) H1[i][0] = H2[i][0] = c[i];
  pw1[0] = 3948243;
  for (int i = 1; i < 25; i++) pw1[i] = pw1[i - 1] * pw1[i - 1] % mod1;
  pw2[0] = 3948243;
  for (int i = 1; i < 25; i++) pw2[i] = pw2[i - 1] * pw2[i - 1] % mod2;
  for (int i = 1, j = 2; j <= n; i++, j <<= 1) {
    for (int k = 1; k <= n; k++) {
      int nk = k + (j >> 1);
      if (nk > n) nk -= n;
      H1[k][i] = (1ll * H1[k][i - 1] * pw1[i - 1] + H1[nk][i - 1]) % mod1;
      H2[k][i] = (1ll * H2[k][i - 1] * pw2[i - 1] + H2[nk][i - 1]) % mod2;
    }
  }
  for (int i = 1; i <= n; i++) {
    pre[i] = pre[i - 1] + br(c[i]);
  }
  for (int i = n; i >= 1; i--) {
    suf[i] = br(c[i]) + suf[i + 1];
  }
  int tot = min(pre[n].v, 0);
  int ans = -1;
  for (int i = 1; i <= n; i++) {
    br tmp = suf[i] + pre[i - 1];
    if (tmp.m == tot) {
      if (ans == -1)
        ans = i;
      else {
        if (cmp(i, ans)) ans = i;
      }
    }
  }
  tot = pre[n].v;
  string res;
  for (int i = ans; i <= n; i++) res += c[i];
  for (int i = 1; i < ans; i++) res += c[i];
  if (tot > 0) {
    for (int i = 0; i < tot; i++) res += ')';
  } else {
    string tmp;
    for (int i = 0; i < (-tot); i++) tmp += '(';
    res = tmp + res;
  }
  printf("%s\n", res.c_str());
  return ~~(0 ^ 0 ^ 0);
}