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 = 1e9;
const int MX = 2e6 + 7;
int h[MX], h2[MX], h3[MX];
long long arrp[MX], arrp2[MX], arrp3[MX];
const long long p = 239;
const int mod = 1e9 + 7;
const int mod2 = 1e9 + 9;
const int mod3 = 1e9 + 33;
string s;
int n;
vector<int> b;
int t[8 * MX];
void build(int v, int tl, int tr) {
  if (tl == tr)
    t[v] = b[tl];
  else {
    int tm = (tl + tr) >> 1;
    build(v << 1, tl, tm);
    build((v << 1) | 1, tm + 1, tr);
    t[v] = min(t[v << 1], t[(v << 1) | 1]);
  }
}
int get(int v, int tl, int tr, int l, int r) {
  if (l > r) return INF;
  if (l == tl && r == tr) return t[v];
  int tm = (tl + tr) >> 1;
  return min(get(v << 1, tl, tm, l, min(r, tm)),
             get((v << 1) | 1, tm + 1, tr, max(tm + 1, l), r));
}
int push(long long a) { return ((a % mod) + mod) % mod; }
int push2(long long a) { return ((a % mod2) + mod2) % mod2; }
int push3(long long a) { return ((a % mod3) + mod3) % mod3; }
int get_h(int l, int r) { return push(h[r + 1] - h[l] * arrp[r - l + 1]); }
int get_h2(int l, int r) { return push2(h2[r + 1] - h2[l] * arrp2[r - l + 1]); }
int get_h3(int l, int r) { return push3(h3[r + 1] - h3[l] * arrp3[r - l + 1]); }
bool same(int l1, int r1, int l2, int r2) {
  if (get_h(l1, r1) != get_h(l2, r2)) return 0;
  if (get_h2(l1, r1) != get_h2(l2, r2)) return 0;
  if (get_h3(l1, r1) != get_h3(l2, r2)) return 0;
  return 1;
}
bool smaller(int st, int ans) {
  int l = -1, r = n;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (same(st, st + m, ans, ans + m))
      l = m;
    else
      r = m;
  }
  if (l != n - 1 && (s[st + l + 1] < s[ans + l + 1])) return 1;
  return 0;
}
int main() {
  iostream::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> s;
  n = (int)s.length();
  s += s;
  b.resize(2 * n + 1);
  b[0] = 0;
  for (int i = 1; i <= 2 * n; i++) {
    b[i] = b[i - 1];
    if (s[i - 1] == '(')
      b[i]++;
    else
      b[i]--;
  }
  vector<bool> good(n);
  build(1, 0, 2 * n);
  int add = max(0, -b[n]);
  for (int i = 0; i < n; i++) {
    int val = get(1, 0, 2 * n, i, i + n);
    if (val - b[i] + add >= 0) good[i] = 1;
  }
  h[0] = 0;
  for (int i = 0; i < 2 * n; i++) h[i + 1] = (h[i] * p + s[i]) % mod;
  arrp[0] = 1;
  for (int i = 1; i < MX; i++) {
    arrp[i] = (arrp[i - 1] * p) % mod;
  }
  h2[0] = 0;
  for (int i = 0; i < 2 * n; i++) h2[i + 1] = (h2[i] * p + s[i]) % mod2;
  arrp2[0] = 1;
  for (int i = 1; i < MX; i++) {
    arrp2[i] = (arrp2[i - 1] * p) % mod2;
  }
  h3[0] = 0;
  for (int i = 0; i < 2 * n; i++) h3[i + 1] = (h3[i] * p + s[i]) % mod3;
  arrp3[0] = 1;
  for (int i = 1; i < MX; i++) {
    arrp3[i] = (arrp3[i - 1] * p) % mod3;
  }
  int ans = -1;
  for (int i = 0; i < n; i++) {
    if (good[i]) {
      if (ans == -1 || smaller(i, ans)) ans = i;
    }
  }
  for (int i = 0; i < -b[n]; i++) cout << '(';
  for (int i = 0; i < n; i++) cout << s[ans + i];
  for (int i = 0; i < b[n]; i++) cout << ')';
  return 0;
}