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;
const int Mod = 1000000007;
class mint {
 public:
  int first;
  mint(long long second = 0) {
    second %= Mod;
    first = (int)second;
  }
};
mint operator+(mint a, mint b) {
  a.first += b.first;
  if (a.first >= Mod) a.first -= Mod;
  return a;
}
mint operator-(mint a, mint b) {
  a.first -= b.first;
  if (a.first < 0) a.first += Mod;
  return a;
}
mint operator*(mint a, mint b) { return mint((long long)a.first * b.first); }
bool operator==(mint a, mint b) { return a.first == b.first; }
bool operator!=(mint a, mint b) { return a.first != b.first; }
pair<int, int> operator+(pair<int, int> a, pair<int, int> b) {
  if (a.second < b.first)
    b.first -= a.second, a.second = 0;
  else
    a.second -= b.first, b.first = 0;
  return {a.first + b.first, a.second + b.second};
}
pair<int, int> F(char c) {
  if (c == '(')
    return {0, 1};
  else
    return {1, 0};
}
string s;
int l;
pair<int, int> Pref[1000015], Suff[1000015];
mint _H[1000015], *H = _H + 1;
mint HP = 101;
mint Hpot[1000015];
mint HL[1000015], HR[1000015];
mint Hash(int lo, int hi) {
  if (lo < 0) return HL[hi - lo + 1];
  if (lo > 2000000) return HR[hi - lo + 1];
  return H[hi] - H[lo - 1] * Hpot[hi - lo + 1];
}
mint Hash(pair<int, int> t) { return Hash(t.first, t.first + t.second - 1); }
mint Hash(int t) { return Hash(t, t); }
int LCP(int a, int b, int MaxLen) {
  int lo = 0, hi = MaxLen, mid = (lo + hi + 1) / 2;
  while (lo != hi) {
    if (Hash(a, a + mid - 1) == Hash(b, b + mid - 1))
      lo = mid;
    else
      hi = mid - 1;
    mid = (lo + hi + 1) / 2;
  }
  return lo;
}
vector<pair<int, int> > Func(int id) {
  pair<int, int> t = Suff[l - id] + Pref[id];
  return {{-2000000, t.first}, {id, l - id}, {0, id}, {3000000, t.second}};
}
bool Cmp(int id1, int id2) {
  if (id2 == -1) return true;
  vector<pair<int, int> > V1 = Func(id1), V2 = Func(id2);
  vector<int> Vp = {0};
  for (int i = 0, j = V1[0].second; i < 4; ++i, j += V1[i].second)
    Vp.push_back(j);
  for (int i = 0, j = V2[0].second; i < 4; ++i, j += V2[i].second)
    Vp.push_back(j);
  sort(Vp.begin(), Vp.end());
  vector<pair<int, int> > VV1, VV2;
  int tmp = 0;
  for (int i = 0, j = 1; i < 4; ++i) {
    while (j < (int)Vp.size() && Vp[j] <= tmp + V1[i].second) {
      VV1.push_back({V1[i].first + Vp[j - 1] - tmp, Vp[j] - Vp[j - 1]});
      ++j;
    }
    tmp += V1[i].second;
  }
  tmp = 0;
  for (int i = 0, j = 1; i < 4; ++i) {
    while (j < (int)Vp.size() && Vp[j] <= tmp + V2[i].second) {
      VV2.push_back({V2[i].first + Vp[j - 1] - tmp, Vp[j] - Vp[j - 1]});
      ++j;
    }
    tmp += V2[i].second;
  }
  for (int i = (int)(0); i < (int)(Vp.size() - 1); ++i)
    if (Hash(VV1[i]) != Hash(VV2[i])) {
      tmp = LCP(VV1[i].first, VV2[i].first, VV1[i].second);
      return Hash(VV1[i].first + tmp).first < Hash(VV2[i].first + tmp).first;
    }
  return false;
}
int main() {
  Hpot[0] = 1;
  for (int i = (int)(1); i < (int)(1000005); ++i)
    Hpot[i] = Hpot[i - 1] * HP, HL[i] = HL[i - 1] * HP + ')',
    HR[i] = HR[i - 1] * HP + '(';
  cin >> s;
  l = (int)s.size();
  for (int i = (int)(0); i < (int)(l); ++i) H[i] = H[i - 1] * HP + s[i];
  for (int i = (int)(0); i < (int)(l); ++i) Pref[i + 1] = Pref[i] + F(s[i]);
  for (int i = (int)(0); i < (int)(l); ++i)
    Suff[i + 1] = F(s[l - i - 1]) + Suff[i];
  int MinLen = l * 2;
  for (int i = (int)(0); i < (int)(l + 1); ++i) {
    pair<int, int> t = Suff[l - i] + Pref[i];
    MinLen = min(MinLen, l + t.first + t.second);
  }
  cerr << "MinLen"
       << " = " << MinLen << endl;
  int Best = -1;
  for (int i = (int)(0); i < (int)(l + 1); ++i) {
    pair<int, int> t = Suff[l - i] + Pref[i];
    if (MinLen != l + t.first + t.second) continue;
    if (Cmp(i, Best)) Best = i;
  }
  pair<int, int> r = Suff[l - Best] + Pref[Best];
  for (int i = (int)(0); i < (int)(r.first); ++i) cout << "(";
  cout << string(s.begin() + Best, s.end())
       << string(s.begin(), s.begin() + Best);
  for (int i = (int)(0); i < (int)(r.second); ++i) cout << ")";
  cout << endl;
  return 0;
}