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;
bool home = 1;
signed realMain();
signed main() {
  home = 0;
  if (home) {
    freopen("tony_stark", "r", stdin);
  } else {
    ios::sync_with_stdio(0);
    cin.tie(0);
  }
  realMain();
}
const int N = (int)1e6 + 7;
string s;
int n, f[N], c[N], ord[N];
struct T {
  int i;
  int c1;
  int c2;
};
vector<T> so(vector<T> v) {
  int n = (int)v.size();
  for (int i = 0; i <= n; i++) {
    f[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    f[v[i].c2]++;
  }
  for (int i = 1; i <= n; i++) {
    f[i] += f[i - 1];
  }
  vector<T> v2(n);
  for (int i = n - 1; i >= 0; i--) {
    v2[--f[v[i].c2]] = v[i];
  }
  for (int i = 0; i <= n; i++) {
    f[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    f[v2[i].c1]++;
  }
  for (int i = 1; i <= n; i++) {
    f[i] += f[i - 1];
  }
  for (int i = n - 1; i >= 0; i--) {
    v[--f[v2[i].c1]] = v2[i];
  }
  return v;
}
bool operator<(T a, T b) {
  if (a.c1 != b.c1) {
    return a.c1 < b.c1;
  } else {
    return a.c2 < b.c2;
  }
}
int baltotal, a[N], sum[N], pre[N], suf[N];
signed realMain() {
  cin >> s;
  n = (int)s.size();
  int raz = -1;
  for (int i = 1; i <= n; i++) {
    if (s[i - 1] == '(')
      baltotal++;
    else
      baltotal--;
    a[i] = (s[i - 1] == '(') ? +1 : -1;
    sum[i] = sum[i - 1] + a[i];
  }
  pre[1] = sum[1];
  for (int i = 2; i <= n; i++) {
    pre[i] = min(pre[i - 1], sum[i]);
  }
  suf[n] = sum[n];
  for (int i = n - 1; i >= 1; i--) {
    suf[i] = min(suf[i + 1], sum[i]);
  }
  for (int i = 0; i < n; i++) {
    c[i] = s[i];
    f[c[i]]++;
  }
  for (int i = 1; i < N; i++) {
    f[i] += f[i - 1];
  }
  for (int i = 0; i < n; i++) {
    ord[--f[c[i]]] = i;
  }
  map<int, int> trn;
  for (int i = 0; i < n; i++) {
    trn[c[i]] = 0;
  }
  int curtrn = 0;
  for (auto &it : trn) {
    it.second = curtrn++;
  }
  for (int i = 0; i < n; i++) {
    c[i] = trn[c[i]];
  }
  for (int len = 1; len <= n; len *= 2) {
    vector<T> v;
    for (int i = 0; i < n; i++) {
      v.push_back({i, c[i], c[(i + len) % n]});
    }
    v = so(v);
    for (int i = 0; i < n; i++) {
      ord[i] = v[i].i;
    }
    c[v[0].i] = 0;
    for (int i = 1; i < n; i++) {
      c[v[i].i] = c[v[i - 1].i] + (v[i - 1] < v[i]);
    }
  }
  for (int j = 0; j < n; j++) {
    bool ok = 1;
    int cur = max(0, -baltotal), init = cur;
    if (j + 1 <= n && cur + suf[j + 1] - sum[j] < 0) {
      ok = 0;
    }
    cur = init + sum[n] - sum[j];
    if (j && cur + pre[j] < 0) {
      ok = 0;
    }
    if (!ok) {
      continue;
    }
    if (raz == -1 || c[j] < c[raz]) {
      raz = j;
    }
  }
  while (baltotal < 0) {
    cout << "(";
    baltotal++;
  }
  for (int i = 0; i < n; i++) {
    cout << s[(i + raz) % n];
  }
  while (baltotal > 0) {
    cout << ")";
    baltotal--;
  }
  cout << "\n";
  return 0;
}