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 MAX_N = 1000000;
const int MAX_N2 = MAX_N * 2;
const int MAX_E2 = 1 << 22;
const int INF = 1 << 30;
template <typename T, const int MAX_E2>
struct SegTreeMin {
  int e2;
  T nodes[MAX_E2], inf;
  SegTreeMin() {}
  void init(int n, T _inf) {
    inf = _inf;
    for (e2 = 1; e2 < n; e2 <<= 1)
      ;
    fill(nodes, nodes + MAX_E2, inf);
  }
  T &get(int i) { return nodes[e2 - 1 + i]; }
  void set(int i, T v) { get(i) = v; }
  void setall() {
    for (int j = e2 - 2; j >= 0; j--)
      nodes[j] = min(nodes[j * 2 + 1], nodes[j * 2 + 2]);
  }
  T min_range(int r0, int r1, int k, int i0, int i1) {
    if (r1 <= i0 || i1 <= r0) return inf;
    if (r0 <= i0 && i1 <= r1) return nodes[k];
    int im = (i0 + i1) / 2;
    T v0 = min_range(r0, r1, k * 2 + 1, i0, im);
    T v1 = min_range(r0, r1, k * 2 + 2, im, i1);
    return min(v0, v1);
  }
  T min_range(int r0, int r1) { return min_range(r0, r1, 0, 0, e2); }
};
char s[MAX_N2 + 4];
int ords[MAX_N2 + 1];
SegTreeMin<int, MAX_E2> st;
inline unsigned char mask(int i) { return (unsigned char)(1 << (7 - i)); }
inline bool tget(vector<unsigned char> &t, int i) {
  return (t[i / 8] & mask(i % 8)) ? true : false;
}
inline void tset(vector<unsigned char> &t, int i, bool b) {
  if (b)
    t[i / 8] |= mask(i % 8);
  else
    t[i / 8] &= ~mask(i % 8);
}
inline bool isLMS(vector<unsigned char> &t, int i) {
  return (i > 0 && tget(t, i) && !tget(t, i - 1));
}
void getBuckets(int *s, vector<int> &bkt, int n, int k, bool end) {
  bkt.assign(k, 0);
  for (int i = 0; i < n; i++) bkt[s[i]]++;
  for (int i = 0, sum = 0; i < k; i++) {
    sum += bkt[i];
    bkt[i] = end ? sum : sum - bkt[i];
  }
}
void induceSAl(vector<unsigned char> &t, int *SA, int *s, vector<int> &bkt,
               int n, int k, bool end) {
  getBuckets(s, bkt, n, k, end);
  for (int i = 0; i < n; i++) {
    int j = SA[i] - 1;
    if (j >= 0 && !tget(t, j)) SA[bkt[s[j]]++] = j;
  }
}
void induceSAs(vector<unsigned char> &t, int *SA, int *s, vector<int> &bkt,
               int n, int k, bool end) {
  getBuckets(s, bkt, n, k, end);
  for (int i = n - 1; i >= 0; i--) {
    int j = SA[i] - 1;
    if (j >= 0 && tget(t, j)) SA[--bkt[s[j]]] = j;
  }
}
void SA_IS(int *s, int *SA, int n, int k) {
  vector<unsigned char> t(n / 8 + 1);
  tset(t, n - 1, true);
  tset(t, n - 2, false);
  for (int i = n - 3; i >= 0; i--)
    if (s[i] < s[i + 1] || (s[i] == s[i + 1] && tget(t, i + 1)))
      tset(t, i, true);
  vector<int> bkt(k);
  getBuckets(s, bkt, n, k, true);
  for (int i = 0; i < n; i++) SA[i] = -1;
  for (int i = 1; i < n; i++)
    if (isLMS(t, i)) SA[--bkt[s[i]]] = i;
  induceSAl(t, SA, s, bkt, n, k, false);
  induceSAs(t, SA, s, bkt, n, k, true);
  int n1 = 0;
  for (int i = 0; i < n; i++)
    if (isLMS(t, SA[i])) SA[n1++] = SA[i];
  for (int i = n1; i < n; i++) SA[i] = -1;
  int name = 0, prev = -1;
  for (int i = 0; i < n1; i++) {
    int pos = SA[i];
    bool diff = false;
    for (int d = 0; d < n; d++) {
      if (prev == -1 || s[pos + d] != s[prev + d] ||
          tget(t, pos + d) != tget(t, prev + d)) {
        diff = true;
        break;
      } else if (d > 0 && (isLMS(t, pos + d) || isLMS(t, prev + d)))
        break;
    }
    if (diff) name++, prev = pos;
    pos /= 2;
    SA[n1 + pos] = name - 1;
  }
  for (int i = n - 1, j = n - 1; i >= n1; i--)
    if (SA[i] >= 0) SA[j--] = SA[i];
  int *SA1 = SA, *s1 = SA + n - n1;
  if (name < n1)
    SA_IS(s1, SA1, n1, name);
  else
    for (int i = 0; i < n1; i++) SA1[s1[i]] = i;
  bkt.assign(k, 0);
  getBuckets(s, bkt, n, k, true);
  for (int i = 1, j = 0; i < n; i++)
    if (isLMS(t, i)) s1[j++] = i;
  for (int i = 0; i < n1; i++) SA1[i] = s1[SA1[i]];
  for (int i = n1; i < n; i++) SA[i] = -1;
  for (int i = n1 - 1; i >= 0; i--) {
    int j = SA[i];
    SA[i] = -1;
    SA[--bkt[s[j]]] = j;
  }
  induceSAl(t, SA, s, bkt, n, k, false);
  induceSAs(t, SA, s, bkt, n, k, true);
}
void SA_IS(int n, char s[], vector<int> &SA, int k = 256) {
  int *buf0 = new int[n + 1], *buf1 = new int[n + 1];
  for (int i = 0; i < n; i++) buf0[i] = s[i];
  buf0[n] = 0;
  SA_IS(buf0, buf1, n + 1, k);
  SA.resize(n + 1);
  for (int i = 0; i <= n; i++) SA[i] = buf1[i];
}
int main() {
  scanf("%s", s);
  int n = strlen(s), n2 = n * 2;
  copy(s, s + n, s + n);
  vector<int> sa;
  SA_IS(n2, s, sa);
  for (int i = 0; i <= n2; i++) {
    ords[sa[i]] = i;
  }
  st.init(n2 + 1, INF);
  st.set(0, 0);
  int sum = 0;
  for (int i = 0; i < n2; i++) {
    int d = (s[i] == '(') ? 1 : -1;
    st.set(i + 1, st.get(i) + d);
    sum += d;
  }
  st.setall();
  sum /= 2;
  int maxd = -INF, mino = INF, mini = -1;
  for (int i = 0; i < n; i++) {
    int d = st.min_range(i, i + n + 1) - st.get(i);
    if (maxd < d || (maxd == d && mino > ords[i]))
      maxd = d, mino = ords[i], mini = i;
  }
  int on = max(-sum, -maxd), cn = on + sum;
  while (on--) putchar('(');
  for (int i = 0; i < n; i++) putchar(s[i + mini]);
  while (cn--) putchar(')');
  putchar('\n');
  return 0;
}