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 N = 1010101;
namespace SA {
const static int N = ::N << 1;
int sa[N], rk[N], ht[N], s[N << 1], t[N << 1], p[N], cnt[N], cur[N];
void sais(int n, int m, int *s, int *t, int *p) {
  int n1 = t[n - 1] = 0, ch = rk[0] = -1, *s1 = s + n;
  for (int i = n - 2; ~i; i--)
    t[i] = s[i] == s[i + 1] ? t[i + 1] : s[i] > s[i + 1];
  for (int i = 1; i < n; i++)
    rk[i] = t[i - 1] && !t[i] ? (p[n1] = i, n1++) : -1;
  std::fill_n(sa, n, -1);
  std::fill_n(cnt, m, 0);
  for (int i = 0; i < n; i++) cnt[s[i]]++;
  for (int i = 1; i < m; i++) cnt[i] += cnt[i - 1];
  for (int i = 0; i < m; i++) cur[i] = cnt[i] - 1;
  for (int i = n1 - 1; ~i; i--) sa[cur[s[p[i]]]--] = p[i];
  for (int i = 1; i < m; i++) cur[i] = cnt[i - 1];
  for (int i = 0; i < n; i++)
    if (sa[i] > 0 && t[sa[i] - 1]) sa[cur[s[sa[i] - 1]]++] = sa[i] - 1;
  for (int i = 0; i < m; i++) cur[i] = cnt[i] - 1;
  for (int i = n - 1; ~i; i--)
    if (sa[i] > 0 && !t[sa[i] - 1]) sa[cur[s[sa[i] - 1]]--] = sa[i] - 1;
  for (int i = 0, x, y; i < n; i++)
    if (~(x = rk[sa[i]])) {
      if (ch < 1 || p[x + 1] - p[x] != p[y + 1] - p[y])
        ch++;
      else
        for (int j = p[x], k = p[y]; j <= p[x + 1]; j++, k++)
          if ((s[j] << 1 | t[j]) != (s[k] << 1 | t[k])) {
            ch++;
            break;
          }
      s1[y = x] = ch;
    }
  if (ch + 1 < n1)
    sais(n1, ch + 1, s1, t + n, p + n1);
  else
    for (int i = 0; i < n1; i++) sa[s1[i]] = i;
  for (int i = 0; i < n1; i++) s1[i] = p[sa[i]];
  std::fill_n(sa, n, -1);
  std::fill_n(cnt, m, 0);
  for (int i = 0; i < n; i++) cnt[s[i]]++;
  for (int i = 1; i < m; i++) cnt[i] += cnt[i - 1];
  for (int i = 0; i < m; i++) cur[i] = cnt[i] - 1;
  for (int i = n1 - 1; ~i; i--) sa[cur[s[s1[i]]]--] = s1[i];
  for (int i = 1; i < m; i++) cur[i] = cnt[i - 1];
  for (int i = 0; i < n; i++)
    if (sa[i] > 0 && t[sa[i] - 1]) sa[cur[s[sa[i] - 1]]++] = sa[i] - 1;
  for (int i = 0; i < m; i++) cur[i] = cnt[i] - 1;
  for (int i = n - 1; ~i; i--)
    if (sa[i] > 0 && !t[sa[i] - 1]) sa[cur[s[sa[i] - 1]]--] = sa[i] - 1;
}
template <typename T>
int mapCharToInt(int n, const T *str) {
  int m = *max_element(str, str + n);
  std::fill_n(rk, m + 1, 0);
  for (int i = 0; i < n; i++) rk[str[i]] = 1;
  for (int i = 0; i < m; i++) rk[i + 1] += rk[i];
  for (int i = 0; i < n; i++) s[i] = rk[str[i]] - 1;
  return rk[m];
}
template <typename T>
void suffixArray(int n, const T *str) {
  int m = mapCharToInt(++n, str);
  sais(n, m, s, t, p);
  for (int i = 0; i < n; i++) rk[sa[i]] = i;
  for (int i = 0, h = ht[0] = 0; i < n - 1; i++) {
    int j = sa[rk[i] - 1];
    while (i + h < n && j + h < n && s[i + h] == s[j + h]) h++;
    if (ht[rk[i]] = h) h--;
  }
}
};  // namespace SA
string s;
int n, ans;
int cnt[2], pre[N], mpre[N], msuf[N], in[N << 1];
void solve() {
  int add = (cnt[0] < cnt[1]) ? (cnt[1] - cnt[0]) : 0;
  for (int _ = (1); _ < (n << 1 | 1); _++) {
    int i = SA::sa[_];
    if (i >= n) continue;
    ++i;
    int t = min(msuf[i] - pre[i - 1], mpre[i - 1] + pre[n] - pre[i - 1]) + add;
    if (t >= 0) {
      ans = i;
      return;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> s;
  n = (int)s.size();
  s = " " + s;
  for (int i = (1); i < (n + 1); i++) {
    ++cnt[s[i] == ')'];
    int t = (s[i] == '(') ? 1 : -1;
    pre[i] = pre[i - 1] + t;
  }
  mpre[1] = pre[1];
  for (int i = (2); i < (n + 1); i++) mpre[i] = min(mpre[i - 1], pre[i]);
  msuf[n] = pre[n];
  for (int i = n - 1; i; --i) msuf[i] = min(msuf[i + 1], pre[i]);
  for (int i = (1); i < (n + 1); i++) in[i - 1] = (s[i] == ')') + 1;
  for (int i = (1); i < (n + 1); i++) in[n + i - 1] = (s[i] == ')') + 1;
  in[n << 1] = 0;
  SA::suffixArray<int>(n << 1, in);
  solve();
  while (cnt[0] < cnt[1]) cout << "(", ++cnt[0];
  for (int i = (ans); i < (n + 1); i++) cout << s[i];
  for (int i = (1); i < (ans); i++) cout << s[i];
  while (cnt[0] > cnt[1]) cout << ")", ++cnt[1];
  return 0;
}