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>
#pragma GCC optimize("Ofast")
using namespace std;
template <typename T1, typename T2>
inline void remin(T1& a, T2 b) {
  a = min(a, (T1)b);
}
const int maxN = 1 << 21;
namespace SuffixArray {
int temp[maxN], inds[maxN], C[maxN], T[maxN * 4], *R, *P;
bool cmp(int i, int j) {
  while (P[i] == P[j]) i++, j++;
  return P[i] < P[j];
}
void brut(int n, int* T, int* res) {
  iota(res, res + n, 0);
  P = T;
  sort(res, res + n, cmp);
}
int cntSort(int n, int* T, int k) {
  int m = 0;
  if (k == 0) {
    for (int i = 0; i < n; i += 3) temp[m++] = i;
    for (int i = 1; i < n; i += 3) temp[m++] = i;
  } else
    for (int i = 2; i < n; i += 3) temp[m++] = i;
  for (int j = (2 - k); j > (-1); j--) {
    for (int i = (0); i < (m); i++) {
      int ind = temp[i];
      int v = j & k ? R[ind + 1] : T[ind + j];
      C[v]++;
    }
    for (int i = 1; C[i - 1] != m; i++) C[i] += C[i - 1];
    for (int i = (m - 1); i > (-1); i--) {
      int ind = temp[i];
      int v = j & k ? R[ind + 1] : T[ind + j];
      inds[--C[v]] = ind;
    }
    fill(C, C + n + 1, 0);
    if (j != 0) copy(inds, inds + m, temp);
  }
  return m;
}
inline bool differ(int* T, int i, int j) {
  return T[i + 2] ^ T[j + 2] | T[i + 1] ^ T[j + 1] | T[i] ^ T[j];
}
inline int newInd(int i, int p) { return i / 3 + i % 3 * p; }
void calcRanks(int* sa, int n, int d = 0) {
  for (int i = (0); i < (n); i++) R[sa[i]] = i + d;
}
bool cmpMerge(int i, int j) {
  for (; true; i++, j++) {
    if (P[i] != P[j]) return P[i] < P[j];
    if (i % 3 != 2 and j % 3 != 2) return R[i] < R[j];
  }
}
void ks(int n, int* T, int* res) {
  if (n < 6) {
    brut(n, T, res);
    return;
  }
  int m = cntSort(n, T, 0), p = (n + 2) / 3 + 1, ctr = 2;
  int *A = T + n + 2, *S = res + n / 3;
  A[p - 1] = 1, A[m + 1] = A[m + 2] = 0;
  for (int i = (0); i < (m); i++) {
    if (i != 0 and differ(T, inds[i - 1], inds[i])) ctr++;
    A[newInd(inds[i], p)] = ctr;
  }
  ks(m + 1, A, S - 1);
  for (int i = (0); i < (m); i++)
    S[i] = S[i] < p ? S[i] * 3 : (S[i] - p) * 3 + 1;
  calcRanks(S, m, 1);
  R[n] = 0;
  int k = cntSort(n, T, 1);
  P = T;
  merge(S, S + m, inds, inds + k, res, cmpMerge);
}
void run(char* Tin, int n, int* sa, int* lcp, int* ranks) {
  R = ranks;
  for (int i = (0); i < (n); i++) T[i] = (int)Tin[i] + 1;
  T[n] = T[n + 1] = 0;
  n < 256 ? brut(n, T, sa) : ks(n, T, sa);
  calcRanks(sa, n);
  for (int i = 0, q = 0; i < n; i++) {
    if (R[i] == n - 1) continue;
    int j = sa[R[i] + 1];
    while (T[i + q] == T[j + q]) q++;
    lcp[R[i]] = q;
    if (q != 0) q--;
  }
}
}  // namespace SuffixArray
char T[maxN], S[maxN];
int sum[maxN], pref[maxN], suf[maxN];
int sa[maxN], R[maxN], lcp[maxN];
void solve() {
  scanf("%s", T + 1);
  int n = strlen(T + 1);
  for (int i = (1); i < (n + 1); i++)
    sum[i] = sum[i - 1] + (T[i] == '(' ? 1 : -1);
  pref[0] = suf[n + 1] = maxN;
  for (int i = (1); i < (n + 1); i++) pref[i] = min(pref[i - 1], sum[i]);
  for (int i = (n); i > (-1); i--) suf[i] = min(suf[i + 1], sum[i]);
  copy(T + 1, T + n + 1, S);
  copy(S, S + n, S + n);
  SuffixArray::run(S, n * 2, sa, lcp, R);
  pref[0] = 0;
  int opt = maxN * 3, ind = 0;
  for (int i = (1); i < (n + 1); i++) {
    int mn = min(suf[i] - sum[i - 1], (sum[n] - sum[i - 1]) + pref[i - 1]);
    int prop = sum[n];
    if (mn < 0) prop -= mn * 2;
    if (opt > prop or (opt == prop and R[i - 1] < R[ind - 1]))
      opt = prop, ind = i;
  }
  int mn =
      min(suf[ind] - sum[ind - 1], (sum[n] - sum[ind - 1]) + pref[ind - 1]);
  for (int _ = (0); _ < (-mn); _++) printf("(");
  printf("%s", T + ind);
  T[ind] = 0;
  printf("%s", T + 1);
  sum[n] -= min(mn, 0);
  for (int _ = (0); _ < (sum[n]); _++) printf(")");
  printf("\n");
}
int main() {
  int t = 1;
  for (int tid = (1); tid < (t + 1); tid++) {
    solve();
  }
  return 0;
}