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 = (int)2e6 + 10;
const int inf = (int)1e9;
const int P[] = {(int)1e9 + 7, (int)1e9 + 9};
const int Q[] = {17, 239};
int stp[2][maxn];
int h[2][maxn];
int h1[2][maxn];
int h2[2][maxn];
const int sh = 1 << 21;
int rm[2 * sh + 10];
void upd(int first, int val) {
  first += sh;
  rm[first] = val;
  while (first > 1) {
    first /= 2;
    rm[first] = min(rm[first * 2], rm[first * 2 + 1]);
  }
}
int get_min(int l, int r) {
  l += sh;
  r += sh;
  int ans = inf;
  while (l <= r) {
    ans = min(rm[l], ans);
    ans = min(rm[r], ans);
    l = (l + 1) / 2;
    r = (r - 1) / 2;
  }
  return ans;
}
char s[maxn];
int n;
int sum[maxn];
void print(pair<int, pair<int, int> > ans) {
  for (int j = 0; j < ans.first; j++) {
    printf("(");
  }
  for (int j = 0; j < n; j++) {
    printf("%c", s[ans.second.first + j]);
  }
  for (int j = 0; j < ans.second.second; j++) {
    printf(")");
  }
  printf("\n");
}
int get_c(const pair<int, pair<int, int> >& a, int l) {
  if (l < a.first) return -1;
  if (l < a.first + n) {
    return s[a.second.first + l - a.first] == '(' ? -1 : 1;
  }
  return 1;
}
pair<int, int> get_hash(const pair<int, pair<int, int> >& a, int l) {
  if (l <= a.first) {
    return make_pair(h1[0][l], h1[1][l]);
  }
  if (l <= a.first + n) {
    int l2 = l - a.first;
    pair<int, int> H1 = make_pair(h1[0][a.first], h1[1][a.first]);
    pair<int, int> H2 =
        make_pair(((h[0][a.second.first] -
                    (long long)h[0][a.second.first + l2] * stp[0][l2]) %
                       P[0] +
                   P[0]) %
                      P[0],
                  ((h[1][a.second.first] -
                    (long long)h[1][a.second.first + l2] * stp[1][l2]) %
                       P[1] +
                   P[1]) %
                      P[1]);
    return make_pair(
        (H1.first + (long long)H2.first * stp[0][a.first]) % P[0],
        (H1.second + (long long)H2.second * stp[1][a.first]) % P[1]);
  }
  {
    int l2 = l - a.first - n;
    pair<int, int> H1 = get_hash(a, a.first + n);
    pair<int, int> H2 = make_pair(h2[0][l2], h2[1][l2]);
    ;
    return make_pair(
        (H1.first + (long long)H2.first * stp[0][a.first + n]) % P[0],
        (H1.second + (long long)H2.second * stp[1][a.first + n]) % P[1]);
  }
}
bool super_less(const pair<int, pair<int, int> >& a,
                const pair<int, pair<int, int> >& b) {
  if (a.first + a.second.second != b.first + b.second.second) {
    return a.first + a.second.second < b.first + b.second.second;
  }
  int l = 0;
  int r = a.first + a.second.second + n;
  while (l < r) {
    int m = (l + r + 1) / 2;
    if (get_hash(a, m) == get_hash(b, m)) {
      l = m;
    } else {
      r = m - 1;
    }
  }
  if (r == a.first + a.second.second + n) {
    return false;
  }
  return get_c(a, l) < get_c(b, l);
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; i++) {
    s[i + n] = s[i];
  }
  stp[0][0] = 1;
  stp[1][0] = 1;
  for (int j = 0; j < 2; j++) {
    for (int i = 1; i <= 2 * n; i++) {
      stp[j][i] = ((long long)stp[j][i - 1] * Q[j]) % P[j];
    }
  }
  for (int j = 0; j < 2; j++) {
    h[j][2 * n] = 0;
    for (int i = 2 * n - 1; i >= 0; i--) {
      h[j][i] = ((long long)h[j][i + 1] * Q[j] + (s[i] == '(' ? 1 : 2)) % P[j];
    }
  }
  for (int j = 0; j < 2; j++) {
    h1[j][0] = 0;
    h2[j][0] = 0;
    for (int i = 1; i <= 2 * n; i++) {
      h1[j][i] = ((long long)h1[j][i - 1] * Q[j] + 1) % P[j];
      h2[j][i] = ((long long)h2[j][i - 1] * Q[j] + 2) % P[j];
    }
  }
  sum[0] = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '(') {
      sum[i + 1] = sum[i] + 1;
    } else {
      sum[i + 1] = sum[i] - 1;
    }
  }
  for (int i = 0; i <= 2 * n; i++) {
    upd(i, sum[i]);
  }
  pair<int, pair<int, int> > ans = make_pair(inf, make_pair(0, inf));
  for (int i = 0; i < n; i++) {
    int mn = min(0, get_min(i, i + n) - sum[i]);
    int add_beg = abs(mn);
    int add_end = sum[i + n] + add_beg - sum[i];
    pair<int, pair<int, int> > res = make_pair(add_beg, make_pair(i, add_end));
    if (super_less(res, ans)) {
      ans = res;
    }
  }
  print(ans);
  return 0;
}