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;
char buf[2000002];
struct st {
  int open;
  int close;
  st() { open = close = 0; }
  void add_front(char c) {
    if (c == '(') {
      if (close) {
        close--;
      } else {
        open++;
      }
    } else {
      close++;
    }
  }
  void add_back(char c) {
    if (c == '(') {
      open++;
    } else {
      if (open) {
        open--;
      } else {
        close++;
      }
    }
  }
};
st pref[2000002];
st suf[2000002];
st merge(st a, st b) {
  int par = min(a.open, b.close);
  a.open -= par;
  b.close -= par;
  st r;
  r.open = a.open + b.open;
  r.close = a.close + b.close;
  return r;
}
string S;
long long int h[2000002][2];
long long int base[] = {1000000007, 1000000009};
long long int up[] = {1231413, 7324125};
long long int mul[2000002][2];
void hash_init() {
  mul[0][0] = mul[0][1] = 1;
  for (int i = 1; i < 2000002; i++) {
    for (int j = 0; j < 2; j++) {
      mul[i][j] = mul[i - 1][j];
      mul[i][j] *= up[j];
      mul[i][j] %= base[j];
    }
  }
  long long int cur[] = {0, 0};
  for (int i = 0; i < S.size(); i++) {
    for (int j = 0; j < 2; j++) {
      cur[j] *= up[j];
      cur[j] += S[i];
      cur[j] %= base[j];
      h[i][j] = cur[j];
    }
  }
}
pair<long long int, long long int> gett(int a, int b) {
  long long int val[] = {h[b][0], h[b][1]};
  if (a) {
    val[0] -= (h[a - 1][0] * mul[b - a + 1][0]) % base[0];
    val[1] -= (h[a - 1][1] * mul[b - a + 1][1]) % base[1];
    if (val[0] < 0) val[0] += base[0];
    if (val[1] < 0) val[1] += base[1];
  }
  return make_pair(val[0], val[1]);
}
bool eq(int a, int b, int len) {
  if (a > b) swap(a, b);
  pair<long long int, long long int> val1 = gett(a, a + len - 1);
  pair<long long int, long long int> val2 = gett(b, b + len - 1);
  return val1 == val2;
}
bool lexicographically_small(int a, int b) {
  if (S[a] != S[b]) return S[a] < S[b];
  int mint = 1;
  int maxt = S.size() / 2;
  while (mint + 1 < maxt) {
    int mid = (mint + maxt) >> 1;
    if (eq(a, b, mid)) {
      mint = mid;
    } else {
      maxt = mid;
    }
  }
  if (eq(a, b, maxt)) {
    mint = maxt;
  } else {
    maxt = mint;
  }
  return S[a + mint] < S[b + mint];
}
string ans;
string s;
int main() {
  scanf("%s", buf);
  s = buf;
  S = s + s;
  hash_init();
  {
    st cur;
    for (int i = 0; i < s.size(); i++) {
      cur.add_back(s[i]);
      pref[i] = cur;
    }
  }
  {
    st cur;
    for (int i = s.size() - 1; i >= 0; i--) {
      cur.add_front(s[i]);
      suf[i] = cur;
    }
  }
  int MIN_LEN = INT_MAX;
  for (int i = 0; i < s.size(); i++) {
    st nex = suf[i];
    if (i) {
      nex = merge(nex, pref[i - 1]);
    }
    MIN_LEN = min(MIN_LEN, (int)(s.size() + nex.open + nex.close));
  }
  int max_open = 0;
  for (int i = 0; i < s.size(); i++) {
    st nex = suf[i];
    if (i) {
      nex = merge(nex, pref[i - 1]);
    }
    int len = s.size() + nex.open + nex.close;
    if (len == MIN_LEN) {
      max_open = max(max_open, nex.close);
    }
  }
  int id = -1;
  for (int i = 0; i < s.size(); i++) {
    st nex = suf[i];
    if (i) {
      nex = merge(nex, pref[i - 1]);
    }
    int len = s.size() + nex.open + nex.close;
    if (len != MIN_LEN) {
      continue;
    }
    if (max_open != nex.close) {
      continue;
    }
    if (id == -1) {
      id = i;
      continue;
    }
    if (!lexicographically_small(id, i)) {
      id = i;
    }
  }
  for (int i = 0; i < max_open; i++) {
    ans.push_back('(');
  }
  ans += s.substr(id, s.size() - id);
  if (id) {
    ans += s.substr(0, id);
  }
  while (ans.size() < MIN_LEN) {
    ans.push_back(')');
  }
  printf("%s\n", ans.c_str());
  return 0;
}