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 MAXN = 1000006;
struct SuffixArray {
  const int L;
  string s;
  vector<int> SA;
  inline bool leq(int a1, int a2, int b1, int b2) {
    return (a1 < b1 || a1 == b1 && a2 <= b2);
  }
  inline bool leq(int a1, int a2, int a3, int b1, int b2, int b3) {
    return (a1 < b1 || a1 == b1 && leq(a2, a3, b2, b3));
  }
  void radixPass(int* a, int* b, int* r, int n, int K) {
    int* c = new int[K + 1];
    for (int i = 0; i < K + 1; ++i) c[i] = 0;
    for (int i = 0; i < n; ++i) c[r[a[i]]]++;
    for (int i = 0, sum = 0; i <= K; i++) {
      int t = c[i];
      c[i] = sum;
      sum += t;
    }
    for (int i = 0; i < n; ++i) b[c[r[a[i]]]++] = a[i];
    delete[] c;
  }
  SuffixArray(const string& s) : L(s.length()), s(s) {
    SA.resize(L);
    if (L == 1)
      SA[0] = 0;
    else {
      int *sa = new int[L], *v = new int[L + 3];
      int K = 255;
      for (int i = 0; i < L; ++i) v[i] = int(s[i]);
      v[L] = v[L + 1] = v[L + 2] = 0;
      constructSA(v, sa, L, K);
      for (int i = 0; i < L; ++i) SA[i] = sa[i];
      delete[] v;
      delete[] sa;
    }
  }
  void constructSA(int* s, int* SA, int n, int K) {
    int n0 = (n + 2) / 3, n1 = (n + 1) / 3, n2 = n / 3, n02 = n0 + n2;
    int* s12 = new int[n02 + 3];
    s12[n02] = s12[n02 + 1] = s12[n02 + 2] = 0;
    int* SA12 = new int[n02 + 3];
    SA12[n02] = SA12[n02 + 1] = SA12[n02 + 2] = 0;
    int* s0 = new int[n0];
    int* SA0 = new int[n0];
    for (int i = 0, j = 0; i < n + (n0 - n1); i++)
      if (i % 3 != 0) s12[j++] = i;
    radixPass(s12, SA12, s + 2, n02, K);
    radixPass(SA12, s12, s + 1, n02, K);
    radixPass(s12, SA12, s, n02, K);
    int name = 0, c0 = -1, c1 = -1, c2 = -1;
    for (int i = 0; i < n02; ++i) {
      if (s[SA12[i]] != c0 || s[SA12[i] + 1] != c1 || s[SA12[i] + 2] != c2) {
        name++;
        c0 = s[SA12[i]];
        c1 = s[SA12[i] + 1];
        c2 = s[SA12[i] + 2];
      }
      if (SA12[i] % 3 == 1)
        s12[SA12[i] / 3] = name;
      else
        s12[SA12[i] / 3 + n0] = name;
    }
    if (name < n02) {
      constructSA(s12, SA12, n02, name);
      for (int i = 0; i < n02; ++i) s12[SA12[i]] = i + 1;
    } else
      for (int i = 0; i < n02; ++i) SA12[s12[i] - 1] = i;
    for (int i = 0, j = 0; i < n02; i++)
      if (SA12[i] < n0) s0[j++] = 3 * SA12[i];
    radixPass(s0, SA0, s, n0, K);
    for (int p = 0, t = n0 - n1, k = 0; k < n; k++) {
      int i = (SA12[t] < n0 ? SA12[t] * 3 + 1 : (SA12[t] - n0) * 3 + 2);
      int j = SA0[p];
      if (SA12[t] < n0 ? leq(s[i], s12[SA12[t] + n0], s[j], s12[j / 3])
                       : leq(s[i], s[i + 1], s12[SA12[t] - n0 + 1], s[j],
                             s[j + 1], s12[j / 3 + n0])) {
        SA[k] = i;
        t++;
        if (t == n02)
          for (k++; p < n0; p++, k++) SA[k] = SA0[p];
      } else {
        SA[k] = j;
        p++;
        if (p == n0)
          for (k++; t < n02; t++, k++)
            SA[k] = (SA12[t] < n0 ? SA12[t] * 3 + 1 : (SA12[t] - n0) * 3 + 2);
      }
    }
    delete[] s12;
    delete[] SA12;
    delete[] SA0;
    delete[] s0;
  }
  vector<int> getSuffixArray() { return SA; }
};
int contagem[MAXN];
int L[MAXN], R[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  while (cin >> s) {
    string t = s + s;
    SuffixArray sa(t);
    vector<int> v = sa.getSuffixArray();
    int cnt = 0;
    int mini = 0;
    for (int i = 0; i < (int)s.size(); ++i) {
      contagem[i] = cnt;
      if (s[i] == '(')
        cnt++;
      else
        cnt--;
      mini = min(mini, cnt);
    }
    contagem[(int)s.size()] = cnt;
    L[0] = contagem[0];
    for (int i = 1; i < (int)s.size() + 1; ++i)
      L[i] = min(contagem[i], L[i - 1]);
    R[(int)s.size()] = contagem[(int)s.size()];
    for (int i = (int)s.size() - 1; i >= 0; i--)
      R[i] = min(contagem[i], R[i + 1]);
    string resp = "";
    if (cnt > 0) {
      int k = -1;
      for (int i = 0; i < (int)v.size(); ++i) {
        if (v[i] >= (int)s.size()) continue;
        if (L[v[i]] + cnt < contagem[v[i]]) continue;
        if (R[v[i]] < contagem[v[i]]) continue;
        k = v[i];
        break;
      }
      for (int i = 0; i < (int)s.size(); ++i) {
        resp += s[(k + i) % (int)s.size()];
      }
      while (cnt > 0) {
        resp += ")";
        cnt--;
      }
    } else {
      int k = -1;
      for (int i = 0; i < (int)v.size(); ++i) {
        if (v[i] >= (int)s.size()) continue;
        if (L[v[i]] < contagem[v[i]]) continue;
        if (R[v[i]] - cnt < contagem[v[i]]) continue;
        k = v[i];
        break;
      }
      while (cnt < 0) {
        resp += "(";
        cnt++;
      }
      for (int i = 0; i < (int)s.size(); ++i) {
        resp += s[(k + i) % (int)s.size()];
      }
    }
    cout << resp << endl;
  }
}