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 Abs(const T& x) {
  return x < 0 ? -x : x;
}
template <class T>
inline T Sqr(const T& x) {
  return x * x;
}
namespace NSuffixArray {
void ZipValues(vector<int>& input) {
  vector<pair<int, int> > tmp;
  for (size_t i = 0; i < input.size(); ++i) {
    tmp.push_back(make_pair(input[i], i));
  }
  sort(tmp.begin(), tmp.end());
  int classes = 0;
  for (size_t i = 0; i < tmp.size(); ++i) {
    if (i == 0 || tmp[i].first != tmp[i - 1].first) {
      ++classes;
    }
    input[tmp[i].second] = classes - 1;
  }
}
void CalcAndAggCnt(const vector<int>& cl, vector<int>& cnt) {
  cnt.assign(cl.size(), 0);
  for (size_t i = 0; i < cl.size(); ++i) {
    ++cnt[cl[i]];
  }
  for (size_t i = 0; i < cnt.size(); ++i) {
    cnt[i] += i > 0 ? cnt[i - 1] : 0;
  }
}
inline int SoftMod(int a, int n) {
  return a < 0 ? n + a : (a >= n ? a - n : a);
}
vector<int> SortedShifts(vector<int> input) {
  ZipValues(input);
  int n = input.size(), classes = 0;
  vector<int> sa(n, 0), nsa(n, 0), cnt(n, 0);
  vector<int> cl = input, oldcl(n, 0);
  CalcAndAggCnt(cl, cnt);
  for (int i = 0; i < n; ++i) {
    sa[--cnt[cl[i]]] = i;
  }
  for (int h = 1; h < n; h <<= 1) {
    CalcAndAggCnt(cl, cnt);
    for (int i = 0; i < n; ++i) {
      nsa[i] = SoftMod(sa[i] - h, n);
    }
    for (int i = n - 1; i >= 0; --i) {
      sa[--cnt[cl[nsa[i]]]] = nsa[i];
    }
    classes = 0;
    oldcl.swap(cl);
    for (int i = 0; i < n; ++i) {
      if (classes == 0 || oldcl[sa[i]] > oldcl[sa[i - 1]] ||
          oldcl[SoftMod(sa[i] + h, n)] > oldcl[SoftMod(sa[i - 1] + h, n)]) {
        ++classes;
      }
      cl[sa[i]] = classes - 1;
    }
  }
  return sa;
}
vector<int> SortedShifts(const string& input) {
  vector<int> arrayInput(input.begin(), input.end());
  return SortedShifts(arrayInput);
}
vector<int> SortedArray(vector<int> array) {
  int mn = array[0];
  for (size_t i = 1; i < array.size(); ++i) {
    if (array[i] < mn) {
      mn = array[i];
    }
  }
  --mn;
  array.push_back(mn);
  auto sorted = SortedShifts(array);
  for (size_t i = 0; i < sorted.size(); ++i) {
    if (array[sorted[i]] == mn) {
      sorted.erase(sorted.begin() + i);
      break;
    }
  }
  return sorted;
}
vector<int> SortedArray(const string& s) {
  vector<int> arrayInput(s.begin(), s.end());
  return SortedArray(arrayInput);
}
}  // namespace NSuffixArray
struct TParInfo {
  int AddLeft;
  int AddRight;
  int SortedPos;
  int Shift;
};
int main() {
  ios_base::sync_with_stdio(false);
  string s;
  cin >> s;
  vector<int> sortedShifts = NSuffixArray::SortedShifts(s);
  vector<int> shiftPos(s.length());
  for (size_t i = 0; i < sortedShifts.size(); ++i) {
    shiftPos[sortedShifts[i]] = i;
  }
  vector<int> balance(s.length() + 1, 0);
  for (size_t i = 1; i <= s.length(); ++i) {
    balance[i] += balance[i - 1] + (s[i - 1] == '(' ? +1 : -1);
  }
  vector<int> leftMin(s.length() + 1, 0);
  vector<int> rightMin(s.length() + 1, 0);
  for (size_t i = 1; i <= s.length(); ++i) {
    leftMin[i] = min(balance[i], leftMin[i - 1]);
  }
  rightMin[s.length()] = balance[s.length()];
  for (int i = static_cast<int>(s.length()) - 1; i >= 0; --i) {
    rightMin[i] = min(balance[i], rightMin[i + 1]);
  }
  TParInfo bestInfo;
  bestInfo.AddLeft = s.length() * 4;
  bestInfo.AddRight = s.length() * 4;
  vector<TParInfo> parInfo(s.length());
  for (size_t i = 0; i < s.length(); ++i) {
    TParInfo& info = parInfo[i];
    info.AddLeft = info.AddRight = 0;
    info.SortedPos = shiftPos[i];
    info.Shift = i;
    int rMin = rightMin[i] - balance[i];
    int lMin = leftMin[i] + (balance[s.length()] - balance[i]);
    int totalMin = min(lMin, rMin);
    if (totalMin < 0) {
      info.AddLeft = -totalMin;
    }
    if (info.AddLeft + balance[s.length()] > 0) {
      info.AddRight = info.AddLeft + balance[s.length()];
    }
    if (info.AddLeft + info.AddRight < bestInfo.AddLeft + bestInfo.AddRight) {
      bestInfo = info;
    }
  }
  for (size_t i = 0; i < s.length(); ++i) {
    TParInfo& info = parInfo[i];
    if (bestInfo.AddLeft + bestInfo.AddRight == info.AddLeft + info.AddRight) {
      if (bestInfo.SortedPos > info.SortedPos) {
        bestInfo = info;
      }
    }
  }
  for (int i = 0; i < bestInfo.AddLeft; ++i) {
    cout << '(';
  }
  rotate(s.begin(), s.begin() + bestInfo.Shift, s.end());
  cout << s;
  for (int i = 0; i < bestInfo.AddRight; ++i) {
    cout << ')';
  }
  cout << endl;
  return 0;
}