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;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int N = s.length();
  int d = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == '(')
      d++;
    else
      d--;
  }
  set<pair<int, int> > S1;
  vector<int> Sv(N);
  int sA = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == '(')
      sA++;
    else
      sA--;
    Sv[i] = sA;
    S1.insert(make_pair(sA, i));
  }
  vector<int> Ppos(1, 0);
  int ans = max(((d < 0) ? -(d) : d), -S1.begin()->first);
  sA = 0;
  if (d >= 0) ans = d + max(0, -S1.begin()->first);
  for (int i = 0; i < N - 1; i++) {
    S1.erase(make_pair(Sv[i], i));
    sA = min(sA, Sv[i]);
    int c;
    if (d >= 0)
      c = d + max(0, max(-S1.begin()->first + Sv[i], -sA - Sv[N - 1] + Sv[i]));
    else
      c = max(0, max(-S1.begin()->first + Sv[i], -sA - Sv[N - 1] + Sv[i]));
    if (ans > c) {
      ans = c;
      Ppos.clear();
    }
    if (ans == c) Ppos.push_back(i + 1);
  }
  N *= 2;
  vector<vector<int> > V1(256);
  V1[0].push_back(N);
  for (int i = 0; i < N; i++) V1[s[i % (N / 2)]].push_back(i);
  int K = 5;
  while (1 << (K - 1) < N) K++;
  vector<int> isB(N + 1 + (1 << (K - 1)), 0);
  vector<int> SA(N + 1, N);
  vector<int> Bs(N + 2, N + 1);
  Bs[0] = 0;
  int Btot = -1, q = 0;
  for (int j = 0; j < 256; j++) {
    if (!V1[j].empty()) Bs[++Btot] = q;
    for (unsigned int i = 0; i < V1[j].size(); i++) {
      SA[q] = V1[j][i];
      isB[V1[j][i]] = Btot;
      q++;
    }
  }
  vector<pair<int, int> > tmp(N + 1);
  vector<int> Bs1(N + 1, 0);
  vector<int> nxtB(N + 1, 0), pos(N + 1, 0);
  for (int i = 1; i < K; i++) {
    int q = 1 << (i - 1);
    for (int j = 0; j <= Btot; j++) Bs1[j] = 0;
    for (int j = 0; j <= N; j++) nxtB[j] = isB[SA[j] + q];
    for (int j = 0; j <= Btot; j++)
      if (Bs[j + 1] - Bs[j] > 1)
        for (int k = Bs[j]; k < Bs[j + 1]; k++) Bs1[nxtB[k]]++;
    int s = 0;
    for (int j = 0; j <= Btot; j++) {
      int s2 = Bs1[j] + s;
      Bs1[j] = s;
      s = s2;
    }
    for (int j = 0; j <= Btot; j++)
      if (Bs[j + 1] - Bs[j] > 1)
        for (int k = Bs[j]; k < Bs[j + 1]; k++) pos[k] = Bs1[nxtB[k]]++;
    for (int j = 0; j <= Btot; j++)
      if (Bs[j + 1] - Bs[j] > 1)
        for (int k = Bs[j]; k < Bs[j + 1]; k++) {
          tmp[pos[k]].first = SA[k];
          tmp[pos[k]].second = j;
        }
    for (int j = 0; j < s; j++) pos[j] = Bs[tmp[j].second]++;
    for (int j = 0; j < s; j++) SA[pos[j]] = tmp[j].first;
    for (int j = 0; j <= N; j++) nxtB[j] = isB[SA[j] + q];
    Btot = 0;
    Bs[0] = 0;
    for (int j = 1; j <= N; j++) {
      if (isB[SA[j]] != isB[SA[j - 1]] || nxtB[j] != nxtB[j - 1])
        pos[j] = ++Btot;
      else
        pos[j] = pos[j - 1];
    }
    int p = 0;
    for (int j = 1; j <= N; j++) {
      if (p + 1 == pos[j]) Bs[++p] = j;
      isB[SA[j]] = p;
    }
  }
  vector<int> invP(N + 1);
  for (int i = 0; i <= N; i++) invP[SA[i]] = i;
  int optR = Ppos[0], optP = invP[Ppos[0]];
  for (unsigned int i = 0; i < Ppos.size(); i++)
    if (optP > invP[Ppos[i]]) {
      optR = Ppos[i];
      optP = invP[Ppos[i]];
    }
  string s2;
  for (int i = 0; i < -d; i++) s2 += "(";
  for (int i = optR; i < N / 2; i++) s2 += s[i];
  for (int i = 0; i < optR; i++) s2 += s[i];
  for (int i = 0; i < d; i++) s2 += ")";
  cout << s2 << "\n";
  return 0;
}