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;
#pragma comment(linker, "/STACK:200000000")
const double EPS = 1E-9;
const int INF = 1000000000;
const long long INF64 = (long long)1E18;
const double PI = 3.1415926535897932384626433832795;
const int NMAX = 2100000;
char s[NMAX];
int p[NMAX], cnt[NMAX], c[NMAX], pn[NMAX], cn[NMAX], n, b[NMAX];
bool good[NMAX];
int md[NMAX * 4], add[NMAX * 4];
void md_build(int idx, int l, int r) {
  if (l == r) {
    md[idx] = b[l];
    return;
  }
  int mid = (l + r) >> 1;
  md_build(idx << 1, l, mid);
  md_build(idx << 1 | 1, mid + 1, r);
  md[idx] = min(md[idx << 1], md[idx << 1 | 1]);
}
void md_relax(int idx, int l, int r) {
  if (add[idx]) {
    md[idx] += add[idx];
    if (l != r) {
      add[idx << 1] += add[idx];
      add[idx << 1 | 1] += add[idx];
    }
    add[idx] = 0;
  }
}
void md_add(int idx, int l, int r, int a, int b, int d) {
  md_relax(idx, l, r);
  if (b < l || r < a) return;
  if (a <= l && r <= b) {
    add[idx] += d;
    return md_relax(idx, l, r);
  }
  int mid = (l + r) >> 1;
  md_add(idx << 1, l, mid, a, b, d);
  md_add(idx << 1 | 1, mid + 1, r, a, b, d);
  md[idx] = min(md[idx << 1], md[idx << 1 | 1]);
}
int md_min(int idx, int l, int r, int a, int b) {
  md_relax(idx, l, r);
  if (b < l || r < a) return INF;
  if (a <= l && r <= b) return md[idx];
  int mid = (l + r) >> 1;
  return min(md_min(idx << 1, l, mid, a, b),
             md_min(idx << 1 | 1, mid + 1, r, a, b));
}
int main() {
  gets(s);
  n = (int)strlen(s);
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < (int)(n); i++) ++cnt[s[i] - '('];
  cnt[1] += cnt[0];
  for (int i = 0; i < (int)(n); i++) p[--cnt[s[i] - '(']] = i;
  c[p[0]] = 0;
  int classes = 1;
  for (int i = (int)(1); i < (int)(n); i++) {
    if (s[p[i]] != s[p[i - 1]]) ++classes;
    c[p[i]] = classes - 1;
  }
  for (int h = 0; (1 << h) < n; ++h) {
    for (int i = 0; i < (int)(n); i++) pn[i] = (p[i] - (1 << h) + n) % n;
    memset(cnt, 0, classes * sizeof(int));
    for (int i = 0; i < (int)(n); i++) ++cnt[c[pn[i]]];
    for (int i = (int)(1); i < (int)(classes); i++) cnt[i] += cnt[i - 1];
    for (int i = (int)(n)-1; i >= 0; i--) p[--cnt[c[pn[i]]]] = pn[i];
    cn[p[0]] = 0;
    classes = 1;
    for (int i = (int)(1); i < (int)(n); i++) {
      int mid1 = (p[i] + (1 << h)) % n, mid2 = (p[i - 1] + (1 << h)) % n;
      if (c[p[i]] != c[p[i - 1]] || c[mid1] != c[mid2]) ++classes;
      cn[p[i]] = classes - 1;
    }
    memcpy(c, cn, n * sizeof(int));
  }
  int sum = 0;
  for (int i = 0; i < (int)(n); i++) {
    sum += s[i] == '(' ? +1 : -1;
    b[i] = sum;
  }
  for (int i = 0; i < (int)(n); i++) b[i + n] = sum;
  md_build(1, 0, 2 * n);
  for (int i = 0; i < (int)(n); i++) {
    if (i) {
      if (s[i - 1] == '(')
        md_add(1, 0, 2 * n, i, i + n - 1, -1);
      else
        md_add(1, 0, 2 * n, i, i + n - 1, +1);
    }
    good[i] = md_min(1, 0, 2 * n, i, i + n - 1) >= min(0, sum);
  }
  int sh = -1;
  for (int i = 0; i < (int)(n); i++)
    if (good[p[i]]) {
      sh = p[i];
      break;
    }
  rotate(s, s + sh, s + n);
  if (sum <= 0) printf("%s", string(-sum, '(').c_str());
  printf("%s", s);
  if (sum > 0) printf("%s", string(sum, ')').c_str());
  puts("");
  return 0;
}