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>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
template <typename T>
inline T Abs(T x) {
  return (x >= 0) ? x : -x;
}
template <typename T>
inline T sqr(T x) {
  return x * x;
}
template <typename T>
inline string toStr(T x) {
  stringstream st;
  st << x;
  string s;
  st >> s;
  return s;
}
template <typename T>
inline int bit(T mask, int b) {
  return (b >= 0 && (mask & (T(1) << b)) != 0) ? 1 : 0;
}
inline int nextInt() {
  int x;
  if (scanf("%d", &x) != 1) throw;
  return x;
}
inline long long nextInt64() {
  long long x;
  if (scanf("%lld", &x) != 1) throw;
  return x;
}
inline double nextDouble() {
  double x;
  if (scanf("%lf", &x) != 1) throw;
  return x;
}
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
const int MAXN = 3001000;
struct state {
  state() {}
  state(int a, int b, int i) : a(a), b(b), id(i) {}
  bool operator<(const state& s) const {
    if (a != s.a) return a < s.a;
    if (b != s.b) return b < s.b;
    return id < s.id;
  }
  bool operator!=(const state& s) const { return a != s.a || b != s.b; }
  int a, b, id;
};
int n, b[MAXN], fw[MAXN], p[MAXN];
multiset<int> ms;
state v[MAXN];
char s[MAXN];
struct answer {
  answer(int b, int a, int i) : before(b), after(a), id(i) {}
  bool operator<(const answer& a) const {
    if (before + after != a.before + a.after)
      return before + after < a.before + a.after;
    if (before + fw[id] != a.before + fw[a.id])
      return before + fw[id] > a.before + fw[a.id];
    return p[(id + fw[id]) % n] < p[(a.id + fw[a.id]) % n];
  }
  int before, after, id;
};
int getms(int v) {
  int prv = (v == 0) ? 0 : b[v - 1];
  return max(0, prv - (*ms.begin()));
}
int sum(int before, int v) {
  int prv = (v == 0) ? 0 : b[v - 1];
  return b[v + n - 1] - prv + before;
}
void go(int v) {
  ms.erase(ms.find(b[v]));
  ms.insert(b[v + n]);
}
int main() {
  cout.setf(ios::fixed);
  cout.precision(10);
  double _startTime = clock();
  scanf(" %s", s);
  n = int(strlen(s));
  for (int i = 0; i < (int)(n); i++) {
    s[i + n] = s[i];
  }
  int bal = 0;
  for (int i = 0; i < (int)(2 * n); i++) {
    if (s[i] == '(') {
      p[i] = 0;
      ++bal;
    } else {
      p[i] = 1;
      --bal;
    }
    b[i] = bal;
  }
  for (int i = (int)(n)-1; i >= 0; i--) {
    ms.insert(b[i]);
    if (s[i] == '(') {
      fw[i] = fw[i + 1] + 1;
    }
  }
  int k = 1;
  while (k < n) {
    for (int i = 0; i < (int)(n); i++) {
      v[i] = state(p[i], p[(i + k) % n], i);
    }
    int cur = 0;
    sort(v, v + n);
    for (int i = 0; i < (int)(n); i++) {
      p[v[i].id] = cur;
      if (v[i] != v[i + 1]) {
        ++cur;
      }
    }
    if (cur == n - 1) break;
    k *= 2;
  }
  answer ans(INF, INF, -1);
  for (int i = 0; i < (int)(n); i++) {
    int before = getms(i);
    answer cur(before, sum(before, i), i);
    ans = min(ans, cur);
    go(i);
  };
  cout << string(size_t(ans.before), '(');
  for (int i = 0; i < (int)(n); i++) {
    cout << s[ans.id + i];
  }
  cout << string(size_t(ans.after), ')') << endl;
  cerr << "Elapsed " << (clock() - _startTime) / CLOCKS_PER_SEC << " s" << endl;
  return 0;
};