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;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
long long gcd(long long x, long long y) {
  while (y) {
    long long t = x % y;
    x = y;
    y = t;
  }
  return x;
}
long long inv(long long x) { return powmod(x, 1000000007 - 2); }
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int wa[4001000], wb[4001000], wx[4001000], wv[4001000];
int cmp(int *r, int a, int b, int l) {
  return r[a + l] == r[b + l] && r[a] == r[b];
}
void da(char *r, int *sa, int n, int m) {
  int *x = wa, *y = wb, *t;
  int i, j, k, p;
  for (i = 0; i < m; ++i) wx[i] = 0;
  for (i = 0; i < n; ++i) ++wx[x[i] = r[i]];
  for (i = 1; i < m; ++i) wx[i] += wx[i - 1];
  for (i = n - 1; i >= 0; --i) sa[--wx[x[i]]] = i;
  for (j = 1, p = 1; p < n; j *= 2, m = p) {
    for (p = 0, i = n - j; i < n; ++i) y[p++] = i;
    for (i = 0; i < n; ++i)
      if (sa[i] >= j) y[p++] = sa[i] - j;
    for (i = 0; i < n; ++i) wv[i] = x[y[i]];
    for (i = 0; i < m; ++i) wx[i] = 0;
    for (i = 0; i < n; ++i) ++wx[wv[i]];
    for (i = 1; i < m; ++i) wx[i] += wx[i - 1];
    for (i = n - 1; i >= 0; --i) sa[--wx[wv[i]]] = y[i];
    for (t = x, x = y, y = t, p = 1, x[sa[0]] = 0, i = 1; i < n; ++i)
      x[sa[i]] = cmp(y, sa[i - 1], sa[i], j) ? p - 1 : p++;
  }
}
int Rank[4001000], sa[4001000], height[4001000];
void calheight(char *r, int n) {
  int i, j, k = 0;
  for (i = 0; i <= n; ++i) Rank[sa[i]] = i;
  for (i = 0; i < n; height[Rank[i++]] = k)
    for (k ? k-- : 0, j = sa[Rank[i] - 1]; r[i + k] == r[j + k]; k++)
      ;
}
char s[4001000];
char ans[4001000];
bool can[4001000];
void fckn(int x, int n) {
  deque<pair<int, int> > q;
  int tag = 0, cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 0)
      cnt++;
    else
      cnt--;
    while (q.size() && q.back().second >= cnt) q.pop_back();
    q.push_back(make_pair(i, cnt));
  }
  for (int i = 0; i < n; i++) {
    while (q.size() && q.front().first < i) {
      q.pop_front();
    }
    if (q.front().second - tag >= x) can[i] = true;
    if (s[i] == 0)
      tag++;
    else
      tag--;
    while (q.size() && q.back().second >= cnt + tag) q.pop_back();
    q.push_back(make_pair(i + n, cnt + tag));
  }
}
int main() {
  scanf("%s", s);
  int n = strlen(s);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      cnt++, s[i] = 0;
    else
      cnt--, s[i] = 1;
    s[i + n] = s[i];
  }
  fckn(min(0, cnt), n);
  s[2 * n] = 2;
  da(s, sa, 2 * n + 1, 3);
  int i = 0, top = 0;
  for (; sa[i] >= n || !can[sa[i]]; i++)
    ;
  i = sa[i];
  while (cnt < 0) {
    ans[top++] = '(';
    cnt++;
  }
  for (int j = 0; j < n; j++) ans[top++] = s[i + j] == 0 ? '(' : ')';
  while (cnt > 0) {
    ans[top++] = ')';
    cnt--;
  }
  ans[top++] = '\0';
  puts(ans);
  return 0;
}