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 INF = (int)1e9;
struct SegmTree {
  vector<int> t;
  int sz;
  SegmTree(const vector<int>& a) {
    sz = 1;
    while (sz < (int)a.size()) sz *= 2;
    t.assign(sz * 2, INF);
    for (int v = sz; v < sz + (int)a.size(); ++v) {
      t[v] = a[v - sz];
    }
    for (int v = sz - 1; v > 0; --v) {
      t[v] = min(t[v * 2], t[v * 2 + 1]);
    }
  }
  int get_min(int l, int r) {
    int res = INF;
    l += sz;
    r += sz;
    while (l <= r) {
      res = min(res, t[l]);
      res = min(res, t[r]);
      l = (l + 1) / 2;
      r = (r - 1) / 2;
    }
    return res;
  }
};
const double EPS = 1e-9;
const int PP = 7;
const int MAXN = 1 << 21;
const int MOD[2] = {(int)1e9 + 7, (int)1e9 + 17};
void add(int& x, int y, int mod) { ((x += y) >= mod) && (x -= mod); }
int mul(int& x, int y, int mod) { return x * 1ll * y % mod; }
struct Hash {
  static const int SZ = 2;
  int v[SZ];
  Hash(int x = 0) {
    for (int i = 0; i < (int)SZ; ++i) v[i] = x;
  }
  void operator+=(const Hash& h) {
    for (int i = 0; i < (int)SZ; ++i) {
      add(v[i], h.v[i], MOD[i]);
    }
  }
  void operator-=(const Hash& h) {
    for (int i = 0; i < (int)SZ; ++i) {
      add(v[i], -h.v[i] + MOD[i], MOD[i]);
    }
  }
  void operator*=(const Hash& h) {
    for (int i = 0; i < (int)SZ; ++i) {
      v[i] = mul(v[i], h.v[i], MOD[i]);
    }
  }
  void operator*=(const int& h) {
    for (int i = 0; i < (int)SZ; ++i) {
      v[i] = mul(v[i], h, MOD[i]);
    }
  }
  void print() const { fprintf(stderr, "%d %d\n", v[0], v[1]); }
};
Hash operator*(const Hash& h1, const Hash& h2) {
  Hash h = h1;
  h *= h2;
  return h;
}
Hash operator*(const Hash& h1, const int& h2) {
  Hash h = h1;
  h *= h2;
  return h;
}
Hash operator+(const Hash& h1, const Hash& h2) {
  Hash h = h1;
  h += h2;
  return h;
}
Hash operator-(const Hash& h1, const Hash& h2) {
  Hash h = h1;
  h -= h2;
  return h;
}
bool operator==(const Hash& h1, const Hash& h2) {
  return h1.v[0] == h2.v[0] && h1.v[1] == h2.v[1];
}
bool operator!=(const Hash& h1, const Hash& h2) {
  return !(h1.v[0] == h2.v[0] && h1.v[1] == h2.v[1]);
}
bool operator<(const Hash& h1, const Hash& h2) {
  return h1.v[0] < h2.v[0] || (h1.v[0] == h2.v[0] && h1.v[1] < h2.v[1]);
}
Hash P[MAXN];
struct Solver {
  vector<Hash> pref;
  vector<Hash> P;
  string s;
  Solver(const string& s) : s(s) {
    P.resize(MAXN);
    P[0] = Hash(1);
    for (int i = 1; i < MAXN; ++i) {
      P[i] = PP * P[i - 1];
    }
    pref.assign(((int)(s).size()) + 1, 0);
    for (int i = 0; i < (int)((int)(s).size()); ++i) {
      int c = (s[i] == ')') + 1;
      Hash cur = P[i] * c;
      pref[i + 1] = pref[i] + cur;
    }
  }
  Hash hash(int l, int r) {
    Hash res = pref[r + 1] - pref[l];
    res *= P[MAXN - r - 1];
    return res;
  }
};
int nn;
Solver text_hashes("dfdgggd");
string text;
bool weird_cmp(int l, int r) {
  int maxlen = nn - max(l, r);
  int left = 0;
  int right = maxlen + 1;
  while (right - left > 1) {
    int mid = (right + left) / 2;
    if (text_hashes.hash(l, mid + l - 1) == text_hashes.hash(r, mid + r - 1))
      left = mid;
    else
      right = mid;
  }
  return text[l + left] < text[r + left];
}
void solve(string s) {
  int n = (int)s.size();
  nn = 2 * n;
  text = s + s + char(0) + char(0) + char(0);
  vector<int> pref(2 * n + 1, 0);
  for (int i = 1; i <= 2 * n; i++)
    pref[i] = pref[i - 1] + (text[i - 1] == '(' ? 1 : -1);
  SegmTree Min(pref);
  vector<int> minbal(n);
  for (int i = 0; i < n; i++) {
    int l = i + 1;
    int r = i + n;
    int cnt = Min.get_min(l, r) - pref[i];
    if (cnt > 0) cnt = 0;
    minbal[i] = cnt;
  }
  vector<int> cands;
  int allbest = *max_element(minbal.begin(), minbal.end());
  assert(allbest <= 0);
  for (int i = 0; i < n; i++)
    if (minbal[i] == allbest) cands.push_back(i);
  text_hashes = Solver(text);
  int pos = *min_element(cands.begin(), cands.end(), weird_cmp);
  string ans = string(-allbest, '(');
  ans += text.substr(pos, n);
  int cntbal = 0;
  for (int i = 0; i < (int)ans.size(); i++) {
    if (ans[i] == '(')
      cntbal++;
    else if (ans[i] == ')')
      cntbal--;
    else
      assert(0);
    assert(cntbal >= 0);
  }
  ans += string(cntbal, ')');
  cout << ans << endl;
}
int main() {
  string s;
  while (cin >> s) solve(s);
}