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;
int z, n;
char s[2000007], t[2000007];
int tab[2000007];
vector<int> suf;
void suf_array(const char* init, vector<int>& suf) {
  string s = init;
  vector<int> head, color, sub, tmp;
  head.assign(max((int)s.size(), 256), 0);
  suf.resize(s.size());
  color.resize(s.size());
  sub.resize(s.size());
  tmp.resize(s.size());
  for (int i = 0; i < s.size(); i++) ++head[s[i]];
  for (int i = 1; i < 256; i++) head[i] += head[i - 1];
  for (int i = 255; i >= 0; i--) head[i] = head[i - 1];
  head[0] = 0;
  for (int i = 0; i < s.size(); i++) {
    suf[head[s[i]]] = i;
    ++head[s[i]];
  }
  int classes = 1;
  head[0] = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[suf[i - 1]] != s[suf[i]]) {
      ++classes;
      head[classes - 1] = i;
    }
    color[suf[i]] = classes - 1;
  }
  for (int k = 1; k < s.size(); k *= 2) {
    for (int i = 0; i < s.size(); i++) {
      int first = suf[i] - k;
      if (first < 0) first += s.size();
      tmp[head[color[first]]] = first;
      ++head[color[first]];
    }
    suf = tmp;
    int second;
    pair<int, int> prv, cur;
    cur = make_pair(-1, 0);
    classes = 0;
    for (int i = 0; i < s.size(); i++) {
      prv = cur;
      second = suf[i] + k;
      if (second >= s.size()) second -= s.size();
      cur = make_pair(color[suf[i]], color[second]);
      if (cur != prv) {
        ++classes;
        head[classes - 1] = i;
      }
      sub[suf[i]] = classes - 1;
    }
    color = sub;
    if (classes == s.size()) break;
  }
}
int start, ending;
int tree[2000007 * 4];
int ans[2000007 * 4];
void build(int v, int l, int r) {
  if (l == r) {
    tree[v] = tab[l - 1];
    return;
  }
  int m = (l + r) / 2;
  build(2 * v, l, m);
  build(2 * v + 1, m + 1, r);
  tree[v] = min(tree[2 * v], tree[2 * v + 1]);
}
int query(int v, int l, int r, int p, int q) {
  if (p <= l && q >= r) return tree[v];
  int ret = 1000000001;
  int m = (l + r) / 2;
  if (p <= m) ret = min(ret, query(2 * v, l, m, p, q));
  if (m + 1 <= q) ret = min(ret, query(2 * v + 1, m + 1, r, p, q));
  return ret;
}
bool ok(int i) {
  return query(1, 1, n, 1 + suf[i], 1 + suf[i] + n / 2 - 1) +
             max(0, ending - start) - tab[suf[i]] >=
         0;
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  strcpy(t, s);
  strcpy(t + n, s);
  n *= 2;
  t[n] = 0;
  for (int i = 1; i < n; i++) tab[i] = tab[i - 1] + (t[i - 1] == '(' ? 1 : -1);
  build(1, 1, n);
  suf_array(s, suf);
  for (int i = 0; i < n / 2; i++) {
    start += (s[i] == '(');
    ending += (s[i] != '(');
  }
  int shiftid = 0;
  for (int i = 0; i < n / 2; i++)
    if (suf[i] < n / 2 && ok(i)) {
      shiftid = suf[i];
      break;
    }
  t[0] = 0;
  for (int i = 0; i < ending - start; i++) t[i] = '(';
  t[ending - start] = 0;
  printf("%s", t);
  printf("%s", s + shiftid);
  s[shiftid] = 0;
  printf("%s", s);
  t[0] = 0;
  for (int i = 0; i < start - ending; i++) t[i] = ')';
  t[start - ending] = 0;
  printf("%s\n", t);
  return 0;
}