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;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.push_back(move(x));
  return v;
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  err(++it, args...);
}
int N;
string s;
struct entry {
  int nr[2], p;
} L[2 * 1000013];
int P[2][4 * 1000013], stp;
int order[1000013];
int prefix[1000013];
int total;
int st[2097152];
char ANS[2 * 1000013];
void update(int i, int x, int lo = 0, int hi = -1, int node = 0) {
  if (hi == -1) hi = N;
  if (i < lo || i > hi) return;
  if (lo == hi) {
    st[node] += x;
    return;
  }
  int mid = (lo + hi) / 2;
  update(i, x, lo, mid, 2 * node + 1);
  update(i, x, mid + 1, hi, 2 * node + 2);
  st[node] = min(st[2 * node + 1], st[2 * node + 2]);
}
int query(int s, int e, int lo = 0, int hi = -1, int node = 0) {
  if (hi == -1) hi = N;
  if (e < lo || s > hi) return (1 << 30);
  if (s <= lo && hi <= e) return st[node];
  int mid = (lo + hi) / 2;
  return min(query(s, e, lo, mid, 2 * node + 1),
             query(s, e, mid + 1, hi, 2 * node + 2));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  N = s.size();
  for (int i = 0; i < N; i++) {
    prefix[i + 1] = prefix[i] + (s[i] == '(' ? 1 : -1);
    update(i + 1, prefix[i + 1]);
  }
  total = prefix[N];
  for (int i = 0; i < 2 * N; i++) {
    P[0][i] = (s[i % N] == ')') + 1;
  }
  for (stp = 1; (1 << (stp - 1)) < 2 * N; stp++) {
    int cnt = 1 << (stp - 1);
    int t = stp % 2;
    for (int i = 0; i < 2 * N; i++) {
      L[i].nr[0] = P[!t][i];
      L[i].nr[1] = P[!t][i + cnt];
      L[i].p = i;
    }
    sort(L, L + 2 * N, [](entry a, entry b) {
      return a.nr[0] == b.nr[0] ? a.nr[1] < b.nr[1] : a.nr[0] < b.nr[0];
    });
    int cur = 1;
    for (int i = 0; i < 2 * N; i++) {
      if (i == 0 ||
          (L[i].nr[0] == L[i - 1].nr[0] && L[i].nr[1] == L[i - 1].nr[1])) {
        P[t][L[i].p] = cur;
      } else {
        P[t][L[i].p] = ++cur;
      }
    }
  }
  for (int i = 0; i < N; i++) {
    order[i] = i;
  }
  stp = (stp - 1) % 2;
  sort(order, order + N, [](int a, int b) { return P[stp][a] < P[stp][b]; });
  int a;
  for (int i = 0; i < N; i++) {
    int idx = order[i];
    int amt = query(idx + 1, N) - prefix[idx];
    amt = min(amt, query(1, idx) + total - prefix[idx]);
    int bound = min(total, 0);
    if (amt >= bound) {
      a = idx;
      break;
    }
  }
  int idx = 0;
  if (total < 0) {
    for (int i = 0; i < -total; i++) {
      ANS[idx++] = '(';
    }
  }
  for (int i = a; i < a + N; i++) {
    ANS[idx++] = s[i % N];
  }
  if (total > 0) {
    for (int i = 0; i < total; i++) {
      ANS[idx++] = ')';
    }
  }
  for (int i = 0; i < idx; i++) {
    cout << ANS[i];
  }
  cout << endl;
  return 0;
}