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 maxn = 2e6 + 1000;
int Wa[maxn], Wb[maxn], Wv[maxn], Ws[maxn], sa[maxn];
int Rank[maxn];
int height[maxn];
set<int> S;
map<int, int> M;
vector<int> V;
int a[maxn];
int cmp(int *r, int a, int b, int l) {
  return r[a] == r[b] && r[a + l] == r[b + l];
}
void get_sa(int *r, int *sa, int n, int m) {
  int i, j, p, *x = Wa, *y = Wb, *t;
  for (i = 0; i < m; i++) Ws[i] = 0;
  for (i = 0; i < n; i++) Ws[x[i] = r[i]]++;
  for (i = 1; i < m; i++) Ws[i] += Ws[i - 1];
  for (i = n - 1; i >= 0; i--) sa[--Ws[x[i]]] = i;
  for (p = 1, j = 1; 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++) Wv[i] = x[y[i]];
    for (i = 0; i < m; i++) Ws[i] = 0;
    for (i = 0; i < n; i++) Ws[Wv[i]]++;
    for (i = 1; i < m; i++) Ws[i] += Ws[i - 1];
    for (i = n - 1; i >= 0; i--) sa[--Ws[Wv[i]]] = y[i];
    for (t = x, x = y, y = t, p = 1, x[sa[0]] = 0, i = 1; i < n; i++)
      x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p - 1 : p++;
  }
}
void get_height(int *r, int *sa, int n) {
  int i, j, k = 0;
  for (i = 1; i <= n; i++) Rank[sa[i]] = i;
  for (i = 0; i < n; height[Rank[i++]] = k)
    for (k ? k-- : 0, j = sa[Rank[i] - 1]; r[i + k] == r[j + k]; k++)
      ;
}
void Hinsert(int x) {
  if (M[x] == 0) S.insert(x);
  M[x]++;
}
void Herase(int x) {
  if (M[x] == 1) S.erase(x);
  M[x]--;
}
char str[maxn];
int tr, tl;
int main() {
  cin >> str;
  int n = strlen(str), nl = 0, nr = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == '(')
      nl++, str[i] = 1;
    else
      nr++, str[i] = 2;
  }
  if (nl < nr) {
    tl = 0;
    for (int i = n - 1; i >= 0; i--) {
      if (str[i] == 1) tl++;
      a[i] = 2 * tl - (n - i);
      Hinsert(-a[i]);
    }
    tl = 0;
    for (int i = n - 1; i >= 0; i--) {
      if (-(*S.begin()) <= -(n - i - 1) + 2 * tl) V.push_back(i);
      Herase(-a[i]);
      if (str[i] == 1) tl++;
      Hinsert(-(2 * nl - n - (n - i) + 2 * tl));
    }
    int N = 2 * n - 1;
    for (int i = 0; i < n; i++) a[i] = str[i];
    for (int i = n; i < N; i++) a[i] = str[i - n];
    get_sa(a, sa, N + 1, 4);
    for (int i = 1; i <= N; i++) Rank[sa[i]] = i;
    int maxr = N + 100, Kr = 0;
    for (auto i : V) {
      if (i + 1 >= N) break;
      if (Rank[i + 1] < maxr) {
        maxr = Rank[i + 1];
        Kr = i + 1;
      }
    }
    a[N] = a[N - n];
    for (int i = 0; i < nr - nl; i++) printf("(");
    for (int i = Kr; i < Kr + n; i++) printf("%c", a[i] == 2 ? ')' : '(');
  } else {
    tr = 0;
    for (int i = 0; i < n; i++) {
      if (str[i] == 2) tr++;
      a[i] = 2 * tr - i - 1;
      Hinsert(-a[i]);
    }
    tr = 0;
    for (int i = 0; i < n; i++) {
      if (-(*S.begin()) <= -i + 2 * tr) V.push_back(i);
      Herase(-a[i]);
      if (str[i] == 2) tr++;
      Hinsert(-(2 * nr - n - i - 1 + 2 * tr));
    }
    int N = 2 * n - 1;
    for (int i = 0; i < n; i++) a[i] = str[i];
    for (int i = n; i < N; i++) a[i] = str[i - n];
    get_sa(a, sa, N + 1, 4);
    for (int i = 1; i <= N; i++) Rank[sa[i]] = i;
    int maxr = N + 100, Kr = 0;
    for (auto i : V) {
      if (Rank[i] < maxr) {
        maxr = Rank[i];
        Kr = i;
      }
    }
    for (int i = Kr; i < Kr + n; i++) printf("%c", a[i] == 2 ? ')' : '(');
    for (int i = 0; i < nl - nr; i++) printf(")");
  }
}