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;
template <class T>
void debug(T a, T b) {
  ;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
namespace std {
template <class S, class T>
ostream& operator<<(ostream& out, const pair<S, T>& a) {
  out << '(' << a.first << ',' << a.second << ')';
  return out;
}
}  // namespace std
long long int readL() {
  long long int res;
  scanf("%I64d", &res);
  return res;
}
void printL(long long int res) { printf("%I64d", res); }
namespace lib {
static const int MAX_K = 2000005;
static const int MAX_N = 2000005;
static int bkt[MAX_K + 1];
static void setBuckets(int* s, int n, int K, bool end) {
  for (int i = 0; i <= K; ++i) bkt[i] = 0;
  for (int i = 0; i < n; ++i) bkt[s[i]]++;
  int sum = 0;
  for (int i = 0; i <= K; ++i) {
    sum += bkt[i];
    bkt[i] = (end ? sum : sum - bkt[i]);
  }
}
static void induceSAL(const vector<bool>& t, int* SA, int* s, int n, int K,
                      bool end) {
  setBuckets(s, n, K, end);
  int j;
  for (int i = 0; i < n; ++i) {
    j = SA[i] - 1;
    if (j >= 0 && !t[j]) SA[bkt[s[j]]++] = j;
  }
}
static void induceSAS(const vector<bool>& t, int* SA, int* s, int n, int K,
                      bool end) {
  setBuckets(s, n, K, end);
  int j;
  for (int i = n - 1; i >= 0; --i) {
    j = SA[i] - 1;
    if (j >= 0 && t[j]) SA[--bkt[s[j]]] = j;
  }
}
static void SA_IS(int* s, int* SA, int n, int K) {
  vector<bool> t(n);
  t[n - 1] = 1;
  t[n - 2] = 0;
  for (int i = n - 3; i >= 0; --i) {
    if (s[i] < s[i + 1] || (s[i] == s[i + 1] && t[i + 1] == 1))
      t[i] = 1;
    else
      t[i] = 0;
  }
  setBuckets(s, n, K, true);
  for (int i = 0; i < n; ++i) SA[i] = -1;
  for (int i = 1; i < n; ++i)
    if ((i > 0 && t[i] && !t[i - 1])) SA[--bkt[s[i]]] = i;
  induceSAL(t, SA, s, n, K, false);
  induceSAS(t, SA, s, n, K, true);
  int n1 = 0;
  for (int i = 0; i < n; ++i)
    if ((SA[i] > 0 && t[SA[i]] && !t[SA[i] - 1])) SA[n1++] = SA[i];
  for (int i = n1; i < n; ++i) SA[i] = -1;
  int rank = 0, prev = -1;
  for (int i = 0; i < n1; ++i) {
    int pos = SA[i];
    bool dif = false;
    for (int d = 0; d < n; ++d) {
      if (prev == -1 || s[pos + d] != s[prev + d] ||
          t[pos + d] != t[prev + d]) {
        dif = true;
        break;
      } else if (d > 0 && ((pos + d > 0 && t[pos + d] && !t[pos + d - 1]) ||
                           (prev + d > 0 && t[prev + d] && !t[prev + d - 1])))
        break;
    }
    if (dif) {
      ++rank;
      prev = pos;
    }
    pos >>= 1;
    SA[n1 + pos] = rank - 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 (rank < n1)
    SA_IS(s1, SA1, n1, rank - 1);
  else
    for (int i = 0; i < n1; ++i) SA1[s1[i]] = i;
  setBuckets(s, n, K, true);
  for (int i = 1, j = 0; i < n; ++i)
    if ((i > 0 && t[i] && !t[i - 1])) 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, j; i >= 0; --i) {
    j = SA[i];
    SA[i] = -1;
    SA[--bkt[s[j]]] = j;
  }
  induceSAL(t, SA, s, n, K, false);
  induceSAS(t, SA, s, n, K, true);
}
static int tmp[MAX_N];
static void SA_IS(char* s, int* SA, int n) {
  for (int i = 0; i < (n); ++i) tmp[i] = s[i];
  SA_IS(tmp, SA, n, 260);
}
};  // namespace lib
static const int MAX_N = 2000005;
int sa[MAX_N];
char s[2000005];
int n;
int hei[2000005], nxt[2000005];
int main() {
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < (n); ++i) s[i + n] = s[i];
  int n2 = n * 2;
  hei[0] = 0;
  for (int i = 0; i < (n2); ++i) {
    hei[i + 1] = hei[i] + (s[i] == '(' ? 1 : -1);
  }
  priority_queue<pair<int, int> > pq;
  for (int i = 0; i < (n2); ++i) nxt[i] = n2;
  int d = hei[n];
  int dif;
  if (d >= 0)
    dif = 0;
  else
    dif = -d;
  for (int i = 0; i < (n2); ++i) {
    while (!pq.empty() && pq.top().first > hei[i] + dif) {
      nxt[pq.top().second] = i;
      pq.pop();
    }
    pq.push(make_pair(hei[i], i));
  }
  lib::SA_IS(s, sa, n * 2 + 1);
  string res;
  int p = -1;
  for (int i = 0; i < (n2 + 1); ++i) {
    if (sa[i] < n && nxt[sa[i]] >= sa[i] + n) {
      p = sa[i];
      break;
    }
  }
  if (d < 0)
    for (int i = 0; i < (-d); ++i) res += '(';
  for (int i = 0; i < (n); ++i) res += s[p + i];
  if (d > 0)
    for (int i = 0; i < (d); ++i) res += ')';
  printf("%s\n", res.c_str());
  return 0;
}