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>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const string LN = "\n";
const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = (int)1e9 + 7;
const long long LINF = (long long)9e18 + 7;
const long long P = 353251;
const long long P1 = 353251;
const long long P2 = 239017;
const long long MOD = 1e9 + 7;
const long long MOD1 = 1e9 + 7;
const long long MOD2 = 1e9 + 9;
string s, t;
long long pr1[2 * 1000007];
long long pr2[2 * 1000007];
long long h1[2 * 1000007];
long long h2[2 * 1000007];
int sum[1000007];
int pref[1000007];
int suf[1000007];
int pref2[1000007];
int suf2[1000007];
void build() {
  pr1[0] = 1;
  pr2[0] = 1;
  for (int i = 0; i < t.size(); i++) {
    h1[i + 1] = (h1[i] + t[i]) * P1 % MOD1;
    h2[i + 1] = (h2[i] + t[i]) * P2 % MOD2;
    pr1[i + 1] = pr1[i] * P1 % MOD1;
    pr2[i + 1] = pr2[i] * P2 % MOD2;
  }
}
pair<long long, long long> get(int l, int r) {
  long long ans1 = (h1[r + 1] - h1[l] * pr1[r - l + 1]) % MOD1;
  if (ans1 < 0) ans1 += MOD1;
  long long ans2 = (h2[r + 1] - h2[l] * pr2[r - l + 1]) % MOD2;
  if (ans2 < 0) ans2 += MOD2;
  return make_pair(ans1, ans2);
}
bool ok(int q1, int q2) {
  int l = 0, r = s.size() + 1;
  while (l + 1 < r) {
    int m = (l + r) / 2;
    if (get(q1, q1 + m - 1) == get(q2, q2 + m - 1))
      l = m;
    else
      r = m;
  }
  if (l == s.size())
    return 0;
  else
    return (t[q1 + l] < t[q2 + l]);
}
const bool is_testing = 0;
int main() {
  srand('D' + 'E' + 'N' + 'I' + 'S' + 'S' + 'O' + 'N');
  if (is_testing) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  } else {
  }
  cin >> s;
  for (int i = 1; i <= s.size(); i++) {
    sum[i] = sum[i - 1];
    if (s[i - 1] == '(')
      sum[i]++;
    else
      sum[i]--;
  }
  for (int i = 1; i <= s.size(); i++) {
    if (i == 0)
      pref[i] = sum[0];
    else
      pref[i] = max(pref[i - 1] + sum[i] - sum[i - 1], sum[i] - sum[i - 1]);
    if (i == 0)
      pref2[i] = sum[0];
    else
      pref2[i] = min(pref2[i - 1], sum[i]);
  }
  for (int i = (int)s.size(); i >= 1; i--) {
    if (i == (int)s.size())
      suf[i] = sum[i] - sum[i - 1];
    else
      suf[i] = max(suf[i + 1], sum[s.size()] - sum[i]);
    if (i == (int)s.size())
      suf2[i] = sum[i] - sum[i - 1];
    else
      suf2[i] = min(suf2[i + 1] + sum[i] - sum[i - 1], sum[i] - sum[i - 1]);
  }
  t = s + s;
  build();
  int uk = -1;
  int bal = sum[s.size()];
  if (bal <= 0) {
    if (suf[1] <= 0) uk = 0;
    for (int i = 1; i < s.size(); i++) {
      int ma = max(pref[i], sum[i] + suf[i + 1]);
      if (ma <= 0) {
        if (uk == -1)
          uk = i;
        else {
          if (ok(i, uk)) uk = i;
        }
      }
    }
    for (int i = 0; i < -bal; i++) cout << '(';
    for (int i = 0; i < s.size(); i++) cout << t[uk + i];
    exit(0);
  } else {
    if (pref2[s.size()] >= 0) uk = 0;
    for (int i = s.size(); i >= 2; i--) {
      int ma = min(suf2[i], pref2[i - 1] + (sum[s.size()] - sum[i - 1]));
      if (ma >= 0) {
        if (uk == -1)
          uk = i - 1;
        else {
          if (ok(i - 1, uk)) uk = i - 1;
        }
      }
    }
    for (int i = 0; i < s.size(); i++) cout << t[uk + i];
    for (int i = 0; i < bal; i++) cout << ')';
    exit(0);
  }
}