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;
string str;
int deq[2000666];
int sp[2000666];
long long v1[2000666], v2[2000666];
long long p1[2000666], p2[2000666];
int a[2000666];
vector<int> P;
bool comp(int i1, int i2, int mval) {
  if (a[i1] != a[i2]) return a[i1] < a[i2];
  int pos, step;
  if (i1 > i2) swap(i1, i2);
  long long m1 = p1[i2 - i1];
  long long m2 = p2[i2 - i1];
  for (step = 1; step <= mval; step <<= 1)
    ;
  for (pos = 0; step; step >>= 1)
    if (i2 + pos + step <= mval + mval) {
      long long val1_first =
          (v1[i1] - v1[i1 + pos + step] + ((long long)666013)) %
          ((long long)666013);
      long long val2_first =
          (v2[i1] - v2[i1 + pos + step] + ((long long)111111)) %
          ((long long)111111);
      long long val1_second =
          ((v1[i2] - v1[i2 + pos + step] + ((long long)666013)) * m1) %
          ((long long)666013);
      long long val2_second =
          ((v2[i2] - v2[i2 + pos + step] + ((long long)111111)) * m2) %
          ((long long)111111);
      if (val1_first == val1_second && val2_first == val2_second) pos += step;
    }
  return a[i1 + pos] < a[i2 + pos];
}
int main() {
  cin >> str;
  int N = str.size(), suma = 0;
  int i;
  for (i = 0; i < N; ++i) {
    a[i + 1] = (str[i] == '(' ? 1 : 0);
    suma += (a[i + 1] == 1 ? 1 : -1);
    a[i + N + 1] = a[i + 1];
  }
  int val_need = min(suma, 0);
  for (i = 1; i <= N + N; ++i) sp[i] = sp[i - 1] + (a[i] == 1 ? 1 : -1);
  int j = 0, st = 1, dr = 0;
  for (i = 1; i <= N; ++i) {
    while (j < i + N - 1) {
      ++j;
      while (dr >= st && sp[deq[dr]] >= sp[j]) --dr;
      deq[++dr] = j;
    }
    while (st <= dr && deq[st] < i) ++st;
    if (sp[deq[st]] - sp[i - 1] >= val_need) P.push_back(i);
  }
  p1[0] = 1;
  p2[0] = 1;
  for (i = 1; i <= N + N; ++i) {
    p1[i] = (p1[i - 1] * 2) % ((long long)666013);
    p2[i] = (p2[i - 1] * (long long)2) % ((long long)111111);
  }
  for (i = N + N; i > 0; --i) {
    v1[i] = (v1[i + 1] + a[i] * p1[N + N - i]) % ((long long)666013);
    v2[i] = (v2[i + 1] + a[i] * p2[N + N - i]) % ((long long)111111);
  }
  int NP = P.size();
  int last_cand = P[0];
  for (i = 1; i < NP; ++i) {
    bool X = comp(last_cand, P[i], N);
    if (X == true) last_cand = P[i];
  }
  for (; suma < 0; ++suma) cout << "(";
  for (i = last_cand; i <= last_cand + N - 1; ++i)
    if (a[i])
      cout << '(';
    else
      cout << ')';
  for (; suma > 0; --suma) cout << ")";
  return 0;
}