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;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const int N = 1000 * 1000;
const int hmul[2] = {239, 23917};
const int hmod[2] = {1000 * 1000 * 1000 + 7, 1000 * 1000 * 1000 + 9};
int n;
int m;
string s;
multiset<int> all;
int pref[2 * N + 1];
int ht[2][2 * N + 1];
int ho[2][2 * N + 1];
int hc[2][2 * N + 1];
int pm[2][2 * N + 1];
int ans, ai, aj, aop, acl;
char getb(int op, int i, int j, int cl, int k) {
  if (k < op) return '(';
  if (k - op < n) return s[i + k - op];
  return ')';
}
pair<int, int> gethash(int op, int i, int j, int cl, int k) {
  pair<int, int> res;
  for (int t = 0; t < 2; t++) {
    int len = 0;
    int tmp;
    tmp = min(op, k);
    int cur = ho[t][tmp];
    len += tmp;
    k -= tmp;
    if (k > 0) {
      tmp = min(n, k);
      cur = ((long long)cur +
             (ht[t][i] - (long long)ht[t][i + tmp] * pm[t][tmp] % hmod[t] +
              hmod[t]) *
                 pm[t][len]) %
            hmod[t];
      if (cur < 0) cur += hmod[t];
      k -= tmp;
      len += tmp;
      if (k > 0) {
        tmp = min(cl, k);
        cur = (cur + (long long)hc[t][tmp] * pm[t][len]) % hmod[t];
        len += tmp;
      }
    }
    if (t == 0)
      res.first = cur;
    else
      res.second = cur;
  }
  return res;
}
int ls(int op1, int i1, int j1, int cl1, int op2, int i2, int j2, int cl2) {
  int len = op1 + n + cl1;
  int l = 0, r = len + 1;
  while (r - l > 1) {
    int s = (l + r) / 2;
    pair<int, int> h1 = gethash(op1, i1, j1, cl1, s);
    pair<int, int> h2 = gethash(op2, i2, j2, cl2, s);
    if (h1 == h2)
      l = s;
    else
      r = s;
  }
  if (r > len) return false;
  return int(getb(op1, i1, j1, cl1, r - 1) < getb(op2, i2, j2, cl2, r - 1));
}
int upd(int op, int i, int j, int cl) {
  if (op + n + cl > ans) return 0;
  if (op + n + cl == ans && !ls(op, i, j, cl, aop, ai, aj, acl)) return 0;
  ans = op + n + cl;
  aop = op;
  ai = i;
  aj = j;
  acl = cl;
  return 0;
}
int main() {
  cin >> s;
  n = ((int)(s).size());
  s = s + s;
  for (int i = 0; i < 2 * n; i++)
    pref[i + 1] = pref[i] + int(s[i] == '(') - int(s[i] == ')');
  for (int t = 0; t < 2; t++) {
    ht[t][2 * n] = 0;
    for (int i = 2 * n - 1; i >= 0; i--)
      ht[t][i] = ((long long)ht[t][i + 1] * hmul[t] + s[i]) % hmod[t];
    ho[t][0] = hc[t][0] = 0;
    pm[t][0] = 1;
    for (int i = 1; i <= 2 * n; i++) {
      ho[t][i] = ((long long)ho[t][i - 1] * hmul[t] + int('(')) % hmod[t];
      hc[t][i] = ((long long)hc[t][i - 1] * hmul[t] + int(')')) % hmod[t];
      pm[t][i] = ((long long)pm[t][i - 1] * hmul[t]) % hmod[t];
    }
  }
  for (int i = 0; i < n; i++) all.insert(pref[i]);
  ans = 1e9;
  for (int i = 0; i < n; i++) {
    all.insert(pref[i + n]);
    int low = *all.begin();
    int open = 0, close = 0;
    if (low < pref[i]) open += pref[i] - low;
    if (pref[i + n] - pref[i] + open > 0)
      close += pref[i + n] - pref[i] + open;
    else
      open += -(pref[i + n] - pref[i] + open);
    upd(open, i, i + n, close);
    all.erase(all.find(pref[i]));
  }
  printf("%s", string(aop, '(').c_str());
  printf("%s", s.substr(ai, n).c_str());
  printf("%s", string(acl, ')').c_str());
  printf("\n");
  cerr << clock() << endl;
  return 0;
}