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 NMax = 1000005;
const int logMax = 20;
int N;
char S[NMax * 2];
int Partial[NMax * 2];
int Tree[NMax * 8];
int open, closed, last;
struct SArray {
  int pos;
  int nb[2];
} L[2 * NMax], Aux[2 * NMax];
vector<int> V[2 * NMax];
int Cnt[NMax * 2], Ind[NMax * 2];
int P[2][NMax * 2];
void Read() {
  scanf("%s", S + 1);
  N = strlen(S + 1);
  for (int i = N + 1; i <= 2 * N; i++) S[i] = S[i - N];
}
void precalcPartial() {
  for (int i = 1; i <= N * 2; i++) {
    if (S[i] == '(')
      Partial[i] = Partial[i - 1] + 1;
    else
      Partial[i] = Partial[i - 1] - 1;
  }
}
inline bool cmp(SArray a, SArray b) {
  if (a.nb[0] == b.nb[0]) return a.nb[1] < b.nb[1];
  return a.nb[0] < b.nb[0];
}
void Sort() {
  for (int i = 1; i <= N * 2; i++) {
    Cnt[L[i].nb[1]]++;
  }
  int p = 0;
  Ind[0] = 1;
  for (int i = 1; i <= 2 * N; i++) Ind[i] = Ind[i - 1] + Cnt[i - 1];
  for (int i = 1; i <= 2 * N; i++) Aux[Ind[L[i].nb[1]]++] = L[i];
  Cnt[0] = Ind[0] = 0;
  for (int i = 1; i <= 2 * N; i++) L[i] = Aux[i], Cnt[i] = 0, Ind[i] = 0;
  for (int i = 1; i <= N * 2; i++) {
    Cnt[L[i].nb[0]]++;
  }
  Ind[0] = 1;
  for (int i = 1; i <= 2 * N; i++) Ind[i] = Ind[i - 1] + Cnt[i - 1];
  for (int i = 1; i <= 2 * N; i++) Aux[Ind[L[i].nb[0]]++] = L[i];
  Cnt[0] = Ind[0] = 0;
  for (int i = 1; i <= 2 * N; i++) L[i] = Aux[i], Cnt[i] = 0, Ind[i] = 0;
}
void buildSuffixArray() {
  for (int i = 1; i <= N * 2; i++) P[0][i] = S[i] - '(' + 1;
  int ind = 1;
  for (int i = 1; (1 << (i - 1)) <= N * 2; i++, ind ^= 1) {
    last = i;
    for (int j = 1; j <= N * 2; j++) {
      L[j].pos = j;
      L[j].nb[0] = P[ind ^ 1][j];
      L[j].nb[1] =
          (j + (1 << (i - 1)) <= N * 2) ? P[ind ^ 1][j + (1 << (i - 1))] : 0;
    }
    Sort();
    int cnt = 0;
    for (int j = 1; j <= 2 * N; j++) {
      if (L[j].nb[0] != L[j - 1].nb[0] || L[j].nb[1] != L[j - 1].nb[1]) ++cnt;
      P[ind][L[j].pos] = cnt;
    }
  }
  last = ind ^ 1;
}
void precalcOpenClosed() {
  for (int i = 1; i <= N; i++) {
    if (S[i] == '(')
      ++open;
    else
      ++closed;
  }
}
void buildTree(int K, int L, int R) {
  if (L == R) {
    Tree[K] = Partial[L];
    return;
  }
  buildTree(K * 2, L, (L + R) / 2);
  buildTree(K * 2 + 1, (L + R) / 2 + 1, R);
  Tree[K] = min(Tree[K * 2], Tree[K * 2 + 1]);
}
int Query(int K, int L, int R, int x, int y) {
  if (L > R || L > y || R < x) return 1000000005;
  if (L >= x && R <= y) return Tree[K];
  int a = Query(K * 2, L, (L + R) / 2, x, y);
  int b = Query(K * 2 + 1, (L + R) / 2 + 1, R, x, y);
  return min(a, b);
}
void ifOpenLessThenClosed() {
  int suff = -1, Min = 1000000005;
  for (int i = 1; i <= N; i++) {
    if (Query(1, 1, 2 * N, i, i + N - 1) - Partial[i - 1] + closed - open < 0)
      continue;
    if (Min > P[last][i]) {
      Min = P[last][i];
      suff = i;
    }
  }
  for (int i = 1; i <= closed - open; i++) printf("(");
  for (int i = suff; i - suff + 1 <= N; i++) printf("%c", S[i]);
  printf("\n");
}
void ifClosedLessThenOpen() {
  int suff = -1, Min = 1000000005;
  for (int i = 1; i <= N; i++) {
    if (Query(1, 1, 2 * N, i, i + N - 1) - Partial[i - 1] < 0) continue;
    if (Min > P[last][i]) {
      Min = P[last][i];
      suff = i;
    }
  }
  for (int i = suff; i - suff + 1 <= N; i++) printf("%c", S[i]);
  for (int i = 1; i <= open - closed; i++) printf(")");
  printf("\n");
}
int main() {
  Read();
  precalcPartial();
  buildSuffixArray();
  buildTree(1, 1, 2 * N);
  precalcOpenClosed();
  if (open >= closed)
    ifClosedLessThenOpen();
  else
    ifOpenLessThenClosed();
  return 0;
}