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 N = 2e6 + 10;
const long long md = 1e9 + 7;
int need[N], reduce[N];
long long st[N], head[N], tail[N], sdfsdfsd[N];
int n;
string s;
struct candidate {
  int start, headLen, tailLen;
  candidate() {}
  candidate(int start, int headLen, int tailLen)
      : start(start), headLen(headLen), tailLen(tailLen) {}
};
long long getSuperHash(int l, int r) {
  if (l == 0 && r == n - 1) {
    return sdfsdfsd[l];
  }
  if (l < n && r >= n) {
    return (sdfsdfsd[l] + sdfsdfsd[r] * st[n - l]) % md;
  }
  if (l >= n) {
    l -= n;
    r -= n;
  }
  if (r == n - 1) {
    return sdfsdfsd[l];
  }
  r++;
  long long res = (sdfsdfsd[l] - sdfsdfsd[r] * st[r - l]) % md;
  return (res + md) % md;
}
long long getHash(candidate i, int len) {
  if (len <= i.headLen) {
    return head[len];
  }
  long long res = head[i.headLen];
  len -= i.headLen;
  if (len <= n) {
    return (res + getSuperHash(i.start, i.start + len - 1) * st[i.headLen]) %
           md;
  }
  res += getSuperHash(i.start, i.start + n - 1) * st[i.headLen];
  res %= md;
  len -= n;
  return (res + st[n + i.headLen] * tail[len]) % md;
}
char compare(candidate last, candidate cur) {
  int l = 0, r = n + cur.headLen + cur.tailLen;
  if (getHash(last, r) == getHash(cur, r)) {
    return true;
  }
  while (l + 1 < r) {
    int len = (l + r) / 2;
    (getHash(last, len) == getHash(cur, len) ? l : r) = len;
  }
  int p = getHash(last, r) == getHash(cur, r) ? r : l;
  if (p < last.headLen) {
    return true;
  }
  p -= last.headLen;
  assert(p < n + last.tailLen);
  return p < n ? s[last.start + p] == '(' : false;
}
int main() {
  st[0] = 1;
  for (int i = 1; i < N; i++) {
    st[i] = st[i - 1] * 239 % md;
    head[i] = (head[i - 1] + st[i]) % md;
    tail[i] = (tail[i - 1] + st[i] * 2) % md;
  }
  getline(cin, s);
  n = s.length();
  s += s;
  need[n - 1] = s[n - 1] == ')';
  reduce[n - 1] = s[n - 1] == '(';
  sdfsdfsd[n - 1] = s[n - 1] - '(' + 1;
  need[n] = s[n] == ')';
  reduce[n] = s[n] == '(';
  sdfsdfsd[n] = s[n] - '(' + 1;
  for (int i = n - 2; i >= 0; i--) {
    need[i] = s[i] == ')';
    reduce[i] = s[i] == '(';
    int take = min(reduce[i], need[i + 1]);
    need[i] = need[i] + need[i + 1] - take;
    reduce[i] = reduce[i] + reduce[i + 1] - take;
    sdfsdfsd[i] = (s[i] - '(' + 1 + sdfsdfsd[i + 1] * st[1]) % md;
  }
  for (int i = n + 1; i < n * 2; i++) {
    need[i] = s[i] == ')';
    reduce[i] = s[i] == '(';
    int take = min(reduce[i - 1], need[i]);
    need[i] = need[i] + need[i - 1] - take;
    reduce[i] = reduce[i] + reduce[i - 1] - take;
    sdfsdfsd[i] = (sdfsdfsd[i - 1] + st[i - n] * (s[i] - '(' + 1)) % md;
  }
  int minCost = need[0] + reduce[0];
  vector<candidate> c;
  c.emplace_back(0, need[0], reduce[0]);
  for (int l = 1, r = n; l < n; l++, r++) {
    int take = min(reduce[l], need[r]), need, reduce;
    need = ::need[l] + ::need[r] - take;
    reduce = ::reduce[l] + ::reduce[r] - take;
    if (need + reduce > minCost) {
      continue;
    }
    if (need + reduce < minCost) {
      c.clear();
    }
    minCost = need + reduce;
    c.emplace_back(l, need, reduce);
  }
  for (candidate i : c)
    if (!compare(c[0], i)) {
      c[0] = i;
    }
  while (c[0].headLen--) {
    printf("(");
  }
  for (int i = 0; i < n; i++) {
    printf("%c", s[i + c[0].start]);
  }
  while (c[0].tailLen--) {
    printf(")");
  }
}