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 = 2e6 + 100;
int na[N], nb[N], ns[N], nv[N];
int sa[N], he[N], rk[N];
int cmp(int *r, int a, int b, int l) {
  return r[a] == r[b] && r[a + l] == r[b + l];
}
void _sort(int x[N], int y[N], int n, int m) {
  for (int i = 0; i < m; i++) ns[i] = 0;
  for (int i = 0; i < n; i++) ns[x[y[i]]]++;
  for (int i = 1; i < m; i++) ns[i] += ns[i - 1];
  for (int i = n - 1; i >= 0; i--) {
    sa[--ns[x[y[i]]]] = y[i];
  }
}
void da(int *r, int n, int m) {
  int *x = na, *y = nb;
  for (int i = 0; i < n; i++) x[i] = r[i];
  for (int i = 0; i < n; i++) y[i] = i;
  for (int i = 0; i < m; i++) ns[i] = 0;
  for (int i = 0; i < n; i++) ns[x[i] = r[i]]++;
  for (int i = 1; i < m; i++) ns[i] += ns[i - 1];
  for (int i = n - 1; i >= 0; i--) sa[--ns[x[i]]] = i;
  for (int j = 1, p = 1, i; p < n; j *= 2, m = p) {
    for (p = 0, i = n - j; i < n; i++) y[p++] = i;
    for (i = 0; i < n; i++)
      if (sa[i] >= j) y[p++] = sa[i] - j;
    for (i = 0; i < n; i++) nv[i] = x[y[i]];
    for (i = 0; i < m; i++) ns[i] = 0;
    for (i = 0; i < n; i++) ns[nv[i]]++;
    for (i = 1; i < m; i++) ns[i] += ns[i - 1];
    for (i = n - 1; i >= 0; i--) sa[--ns[nv[i]]] = y[i];
    swap(x, y);
    p = 1;
    x[sa[0]] = 0;
    for (i = 1; i < n; i++) {
      x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p - 1 : p++;
    }
  }
}
void gethe(int *r, int n) {
  for (int i = 1; i <= n; i++) rk[sa[i]] = i;
  for (int i = 0, k = 0, j = 0; i < n; he[rk[i++]] = k) {
    for (k ? k-- : 0, j = sa[rk[i] - 1]; r[i + k] == r[j + k]; k++)
      ;
  }
}
void debug(int n) {
  for (int i = 0; i <= n; i++) printf("%d ", rk[i]);
  printf("rk\n");
  for (int i = 0; i <= n; i++) printf("%d ", sa[i]);
  printf("sa\n");
  for (int i = 0; i <= n; i++) printf("%d ", he[i]);
  printf("he\n");
}
void solve(int *r, int n) {
  r[n] = 0;
  da(r, n + 1, 3);
  gethe(r, n);
}
int l, r, sta[N];
int aa[N], bb[N];
void ins(int id) {
  while (r > l && aa[sta[r - 1]] >= aa[id]) r--;
  sta[r++] = id;
}
char ss[N];
int vis[N];
int main() {
  while (scanf("%s", ss) != EOF) {
    int n = strlen(ss);
    int num = 0;
    for (int i = 0; i < n; i++) {
      if (ss[i] == '(') {
        aa[i] = 1;
        bb[i] = 1;
        num++;
      } else {
        aa[i] = -1;
        bb[i] = 2;
        num--;
      }
    }
    for (int i = 0; i < n; i++) {
      aa[i + n] = aa[i];
      bb[i + n] = bb[i];
    }
    for (int i = 1; i < 2 * n; i++) {
      aa[i] += aa[i - 1];
    }
    memset(vis, 0, sizeof(vis));
    l = r = 0;
    for (int i = 0; i < n; i++) {
      ins(i);
    }
    for (int i = 0; i < n; i++) {
      if (sta[l] < i) l++;
      int x = aa[sta[l]];
      if (i) x -= aa[i - 1];
      if (num < 0) {
        x += -num;
      }
      if (x >= 0) {
        vis[i] = 1;
      }
      ins(i + n);
    }
    solve(bb, n * 2);
    int id = -1;
    for (int i = 0; i < n; i++)
      if (vis[i]) {
        if (id == -1 || rk[i] < rk[id]) {
          id = i;
        }
      }
    if (id == -1) {
      printf("x\n");
      continue;
    }
    for (int i = 0; i < -num; i++) {
      printf("(");
    }
    for (int i = 0; i < n; i++) {
      printf("%c", ss[id]);
      id++;
      if (id == n) id = 0;
    }
    for (int i = 0; i < num; i++) {
      printf(")");
    }
    printf("\n");
  }
  return 0;
}