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 MAX_N = 2000005;
int n, m;
int in[MAX_N];
int inv[MAX_N];
int out[MAX_N], temp[MAX_N];
int pos2bckt[MAX_N];
int bckt[MAX_N], relabel[MAX_N];
int bpos[MAX_N];
void build() {
  for (int i = 0; i < n; i++) out[i] = i;
  sort(out, out + n, [](int a, int bckt) { return in[a] < in[bckt]; });
  for (int i = 0, c = 0; i < n; i++) {
    bckt[i] = c;
    if (i + 1 == n || in[out[i]] != in[out[i + 1]]) c++;
  }
  for (int h = 1; h < n; h <<= 1) {
    for (int i = 0; i < n; i++) pos2bckt[out[i]] = bckt[i];
    for (int i = n - 1; i >= 0; i--) bpos[bckt[i]] = i;
    for (int i = 0; i < n; i++)
      if (out[i] >= n - h) temp[bpos[bckt[i]]++] = out[i];
    for (int i = 0; i < n; i++)
      if (out[i] >= h) temp[bpos[pos2bckt[out[i] - h]]++] = out[i] - h;
    for (int i = 0, c = 0; i < n; i++) {
      relabel[i] = c;
      if (i + 1 == n) break;
      if (bckt[i] != bckt[i + 1])
        c++;
      else if (temp[i + 1] >= n - h || temp[i] >= n - h)
        c++;
      else if (pos2bckt[temp[i + 1] + h] != pos2bckt[temp[i] + h])
        c++;
    }
    memcpy(out, temp, sizeof(temp[0]) * n);
    memcpy(bckt, relabel, sizeof(relabel[0]) * n);
  }
}
char str[MAX_N];
int cnt[MAX_N], mmn[MAX_N], rmmn[MAX_N];
int main() {
  scanf("%s", str);
  while (str[n]) n++;
  for (int i = 0; i < n; i++) in[i] = str[i] == ')';
  for (int i = 0; i < n; i++) in[i + n] = in[i];
  int step = 0, mn = 0;
  for (int i = 0; i < n; i++) {
    if (in[i] == 1)
      step--;
    else
      step++;
    cnt[i + 1] = step;
    if (mn > step) mn = step;
    mmn[i + 1] = mn;
  }
  int p = step;
  for (int i = n - 1; i >= 0; i--) {
    if (in[i] == 1)
      step++;
    else
      step--;
    if (p > step) p = step;
    rmmn[i] = p;
  }
  n *= 2;
  build();
  n /= 2;
  int c[2] = {
      0,
  };
  for (int i = 0; i < n; i++) c[in[i]]++;
  if (c[0] >= c[1]) {
    for (int i = 0; i < 2 * n; i++) {
      if (out[i] < n && rmmn[out[i]] - cnt[out[i]] >= 0 &&
          cnt[n] - cnt[out[i]] + mmn[out[i]] >= 0) {
        for (int j = 0; j < n; j++) str[j] = in[out[i] + j] == 0 ? '(' : ')';
        for (int j = n, k = 0; k < c[0] - c[1]; j++, k++) str[j] = ')';
        break;
      }
    }
  } else {
    for (int i = 0; i < 2 * n; i++) {
      if (out[i] < n && rmmn[out[i]] - cnt[out[i]] >= c[0] - c[1] &&
          cnt[n] - cnt[out[i]] + mmn[out[i]] >= c[0] - c[1]) {
        for (int j = 0; j < c[1] - c[0]; j++) str[j] = '(';
        for (int j = c[1] - c[0], k = 0; k < n; j++, k++)
          str[j] = in[out[i] + k] == 0 ? '(' : ')';
        break;
      }
    }
  }
  puts(str);
  return 0;
}