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>
inline T SQR(T x) {
  return x * x;
}
template <class T>
T MIN(T x, T y) {
  return (x < y) ? x : y;
}
template <class T>
T MAX(T x, T y) {
  return (x > y) ? x : y;
}
template <class T>
void UPDATE_MIN(T &x, T y) {
  if (y < x) {
    x = y;
  }
}
template <class T>
void UPDATE_MAX(T &x, T y) {
  if (x < y) {
    x = y;
  }
}
template <class T>
inline string TOSTR(const T &x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long powmod(long long a, long long p, long long m) {
  long long r = 1;
  while (p) {
    if (p & 1) r = r * a % m;
    p >>= 1;
    a = a * a % m;
  }
  return r;
}
template <typename K, typename V>
V GetWithDef(const std::unordered_map<K, V> &m, const K &key, const V &defval) {
  auto it = m.find(key);
  return (it == m.end()) ? defval : it->second;
}
template <typename K, typename V>
void SetDef(std::unordered_map<K, V> &m, const K &key, const V &defval) {
  auto it = m.find(key);
  if (it == m.end()) m[key] = defval;
}
struct SlidingMIN {
  static const int MAXVAL = 0x7fffffff;
  deque<int> dq;
  inline void step(int val) {
    while (!dq.empty() && dq.back() > val) dq.pop_back();
    dq.push_back(val);
  }
  inline void backstep(int val) {
    assert(!dq.empty());
    if (!dq.empty() && dq.front() == val) dq.pop_front();
  }
  inline int min() { return (dq.empty()) ? MAXVAL : dq.front(); }
  inline int size() { return dq.size(); }
  inline void clear() { dq.clear(); }
};
int N;
char s[1000123];
char s2[1000123 * 2];
char res[1000123 * 2] = {};
int ctr_array[1000123];
SlidingMIN minq;
vector<int> good_indexes;
int minimum_expression() {
  int len = N * 2;
  int ii = 0, jj = 1, k = 0;
  int nind = good_indexes.size();
  int i = good_indexes[ii];
  int j = good_indexes[jj];
  while (i + k < len && j + k < len) {
    if (s2[i + k] == s2[j + k]) {
      k++;
    } else if (s2[i + k] > s2[j + k]) {
      int newi = MAX(i + k + 1, j + 1);
      while (i < newi) {
        if (ii >= nind - 1) return j;
        i = good_indexes[++ii];
      }
      k = 0;
    } else if (s2[i + k] < s2[j + k]) {
      int newj = MAX(j + k + 1, i + 1);
      while (j < newj) {
        if (jj >= nind - 1) return i;
        j = good_indexes[++jj];
      }
      k = 0;
    }
  }
  1;
  return MIN(i, j);
}
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%s", s);
  strcpy(s2, s);
  strcat(s2, s);
  N = strlen(s);
  int ctr = 0;
  minq.step(ctr);
  ctr_array[0] = 0;
  for (__typeof(N) __tmpvar__start152 = (0), __tmpvar__end152 = (N),
                   i = __tmpvar__start152;
       i < __tmpvar__end152; i++) {
    if (s[i] == '(')
      ctr++;
    else
      ctr--;
    minq.step(ctr);
    ctr_array[i + 1] = ctr;
  }
  1;
  int balance = 0;
  int curctr = ctr;
  int minctr_at;
  for (__typeof(N) __tmpvar__start164 = (0), __tmpvar__end164 = (N),
                   i = __tmpvar__start164;
       i < __tmpvar__end164; i++) {
    minctr_at = minq.min() + balance;
    if (!(ctr < 0 && minctr_at < ctr)) {
      if (!(ctr >= 0 && minctr_at < 0)) {
        good_indexes.push_back(i);
      }
    }
    if (s[i] == '(') {
      balance--;
      curctr++;
    } else {
      balance++;
      curctr--;
    }
    minq.backstep(ctr_array[i]);
    minq.step(curctr);
  }
  int s2pos = minimum_expression();
  1;
  int pos = 0;
  while (ctr < 0) {
    res[pos++] = '(';
    ctr++;
  }
  for (__typeof(N) __tmpvar__start193 = (0), __tmpvar__end193 = (N),
                   i = __tmpvar__start193;
       i < __tmpvar__end193; i++) {
    res[pos++] = s2[s2pos++];
  }
  while (ctr > 0) {
    res[pos++] = ')';
    ctr--;
  }
  res[pos++] = '\0';
  puts(res);
  return 0;
}