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;
char s[1000100];
int a[2000100], add[8000100], min_[8000100], ans[2000100];
int rk[2000100], rkk[2000100], cnt[2000100], tp[2000100], tpp[2000100];
void pushdown(int rt) {
  add[rt << 1] += add[rt];
  min_[rt << 1] += add[rt];
  add[rt << 1 | 1] += add[rt];
  min_[rt << 1 | 1] += add[rt];
  add[rt] = 0;
}
int query(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) return min_[rt];
  int m = l + r >> 1, ans = 998244353;
  pushdown(rt);
  if (m >= L) ans = min(ans, query(L, R, l, m, rt << 1));
  if (m < R) ans = min(ans, query(L, R, m + 1, r, rt << 1 | 1));
  return ans;
}
void pushup(int rt) { min_[rt] = min(min_[rt << 1], min_[rt << 1 | 1]); }
void build(int l, int r, int rt) {
  if (l == r) {
    min_[rt] = a[l];
    return;
  }
  int m = l + r >> 1;
  build(l, m, rt << 1);
  build(m + 1, r, rt << 1 | 1);
  pushup(rt);
}
void update(int L, int R, int c, int l, int r, int rt) {
  if (L <= l && r <= R) {
    min_[rt] += c;
    add[rt] += c;
    return;
  }
  pushdown(rt);
  int m = l + r >> 1;
  if (m >= L) update(L, R, c, l, m, rt << 1);
  if (m < R) update(L, R, c, m + 1, r, rt << 1 | 1);
  pushup(rt);
}
int main() {
  scanf("%s", s);
  int n = strlen(s);
  int i, t, sum = 0, cntl = 0, cntr = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == '(')
      t = 1, cntl++;
    else
      t = -1, cntr++;
    sum += t;
    a[n + i] = sum;
  }
  build(1, n << 1, 1);
  int del, temp;
  if (cntl < cntr)
    del = cntr - cntl;
  else
    del = 0;
  for (i = 0; i < n; i++) {
    if (query(n - i, (n << 1) - i - 1, 1, n << 1, 1) + del < 0)
      ans[(n - i) % n] = 0;
    else
      ans[(n - i) % n] = 1;
    if (s[n - i - 1] == '(')
      temp = 1;
    else
      temp = -1;
    if (i + 1 != n) update(n - i - 1, (n << 1) - i - 2, temp, 1, n << 1, 1);
  }
  for (i = 0; i < n; i++) {
    cnt[s[i] - 39]++;
  }
  for (i = 1; i <= 2; i++) {
    cnt[i] += cnt[i - 1];
  }
  for (i = n - 1; i >= 0; i--) {
    tpp[--cnt[s[i] - 39]] = i;
  }
  rk[tpp[0]] = 1;
  for (i = 1; i < n; i++) {
    if (s[tpp[i]] == s[tpp[i - 1]])
      rk[tpp[i]] = rk[tpp[i - 1]];
    else
      rk[tpp[i]] = rk[tpp[i - 1]] + 1;
  }
  int j;
  for (i = 1; i < n; i <<= 1) {
    if (rk[tpp[n - 1]] == n) break;
    for (j = 0; j < n; j++) {
      tp[j] = (tpp[j] + n - i) % n;
    }
    memset(cnt, 0, sizeof(cnt));
    for (j = 0; j < n; j++) {
      cnt[rk[j]]++;
    }
    for (j = 1; j <= n; j++) {
      cnt[j] += cnt[j - 1];
    }
    for (j = n - 1; j >= 0; j--) {
      tpp[--cnt[rk[tp[j]]]] = tp[j];
    }
    rkk[tpp[0]] = 1;
    for (j = 1; j < n; j++) {
      if (rk[tpp[j]] == rk[tpp[j - 1]] &&
          rk[(tpp[j] + i) % n] == rk[(tpp[j - 1] + i) % n])
        rkk[tpp[j]] = rkk[tpp[j - 1]];
      else
        rkk[tpp[j]] = rkk[tpp[j - 1]] + 1;
    }
    memcpy(rk, rkk, sizeof(rk));
  }
  int fin;
  for (i = 0; i < n; i++) {
    if (ans[tpp[i]]) {
      fin = tpp[i];
      break;
    }
  }
  if (cntl < cntr) {
    while (cntl < cntr) putchar('('), cntl++;
    for (i = 0; i < n; i++) putchar(s[(i + fin) % n]);
  } else {
    for (i = 0; i < n; i++) putchar(s[(i + fin) % n]);
    while (cntr < cntl) putchar(')'), cntr++;
  }
  return 0;
}