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;
int last, cnt;
int sa[2000100], rnk[2000100];
pair<int, int> tr[4200000];
char s[2000100], st[2000100];
int n;
struct SAM {
  int l[2000100 * 2], ch[2000100 * 2][2], fa[2000100 * 2], cnt, last, len,
      lp[2000100 * 2];
  int son[2000100 * 2], son1[2000100 * 2], lnk[2000100 * 5], nxt[2000100 * 5],
      tcnt, b[28], t[2000100 * 2], ec, d;
  bool mark[2000100 * 2];
  char s[2000100];
  void addedge1(int x, int y) {
    nxt[++ec] = son1[x];
    lnk[son1[x] = ec] = y;
  }
  void add(int c) {
    int np = ++cnt, p = last;
    last = np;
    l[np] = ++len;
    mark[np] = true;
    lp[np] = 0;
    for (; p && !ch[p][c]; p = fa[p]) ch[p][c] = np;
    if (!p)
      fa[np] = 1;
    else {
      int q = ch[p][c];
      if (l[p] + 1 == l[q])
        fa[np] = q;
      else {
        int nq = ++cnt;
        lp[nq] = lp[q] + l[q] - 1 - l[p];
        l[nq] = l[p] + 1;
        mark[nq] = false;
        memcpy(ch[nq], ch[q], sizeof ch[q]);
        fa[nq] = fa[q];
        fa[q] = fa[np] = nq;
        for (; ch[p][c] == q; p = fa[p]) ch[p][c] = nq;
      }
    }
  }
  void dfs(int u, int *sa) {
    for (int p = u; p;)
      if (son[p]) {
        int v = lnk[son[p]];
        son[p] = nxt[son[p]];
        if (mark[v]) sa[tcnt++] = len - l[v];
        p = v;
      } else
        p = fa[p];
  }
  void addedge(int x, int y) {
    nxt[++ec] = son[x];
    lnk[son[x] = ec] = y;
  }
  void build_tree() {
    memset(b, 0, sizeof b);
    for (int i = 2; i <= cnt; ++i) ++b[s[lp[i] + l[i] - l[fa[i]] - 1] - 'a'];
    for (int i = 1; i < 28; ++i) b[i] += b[i - 1];
    for (int i = 2; i <= cnt; ++i)
      t[b[s[lp[i] + l[i] - l[fa[i]] - 1] - 'a']--] = i;
    for (int i = cnt - 1; i; --i) addedge(fa[t[i]], t[i]);
  }
  void construct_sa(char *ss, int n) {
    tcnt = 0;
    for (int i = 0; i < n; ++i) s[n - i - 1] = ss[i];
    construct(n);
    build_tree();
    dfs(1, sa);
    for (int i = 0; i < n; i++) rnk[sa[i]] = i;
  }
  void construct(int n) {
    len = 0;
    last = cnt = 1;
    for (int i = 0; i < n; ++i) add(s[i] - 'a');
  }
} sam;
void build_sa() { sam.construct_sa(st, n); }
pair<int, int> upd(pair<int, int> b, pair<int, int> c) {
  return make_pair(c.first + max(0, b.first - c.second),
                   b.second + max(0, c.second - b.first));
}
void build_tree(int l, int r, int k) {
  if (l == r) {
    if (s[l] == '(')
      tr[k] = make_pair(1, 0);
    else
      tr[k] = make_pair(0, 1);
    return;
  }
  int mid = (l + r) >> 1;
  build_tree(l, mid, k << 1);
  build_tree(mid + 1, r, k << 1 | 1);
  tr[k] = upd(tr[k << 1], tr[k << 1 | 1]);
}
pair<int, int> ret;
void qry(int L, int R, int l, int r, int k) {
  if (L <= l && r <= R) {
    ret = upd(ret, tr[k]);
    return;
  }
  int mid = (l + r) >> 1;
  if (L <= mid) qry(L, R, l, mid, k << 1);
  if (mid < R) qry(L, R, mid + 1, r, k << 1 | 1);
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) s[i + n] = s[i];
  n *= 2;
  for (int i = 0; i < n; i++)
    if (s[i] == '(')
      st[i] = 'a';
    else
      st[i] = 'b';
  build_sa();
  build_tree(0, n - 1, 1);
  pair<int, int> ans = make_pair(0, 0);
  int pos = -1;
  for (int i = 0; i < n / 2; i++) {
    ret = make_pair(0, 0);
    qry(i, i + n / 2 - 1, 0, n - 1, 1);
    if (ret.first && ret.second) continue;
    if (pos == -1 || rnk[i] < rnk[pos]) pos = i;
    ans = ret;
  }
  for (int i = 0; i < ans.second; i++) putchar('(');
  for (int i = pos; i < pos + n / 2; i++) putchar(s[i]);
  for (int i = 0; i < ans.first; i++) putchar(')');
  putchar('\n');
  return 0;
}