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;
class data {
 public:
  int op, cl, x, y;
} a[2000005];
int n;
char s[4000005];
int arr[4000005];
int kd[8000000];
int art[8000000];
int update(int root, int bas, int son, int x, int y, int val) {
  if (son < x or y < bas) return kd[root];
  if (x <= bas and son <= y) {
    art[root] += val;
    return kd[root] += val;
  }
  return kd[root] =
             min(update(root * 2, bas, (bas + son) / 2, x, y, val),
                 update(root * 2 + 1, (bas + son) / 2 + 1, son, x, y, val)) +
             art[root];
}
int query(int root, int bas, int son, int x, int y) {
  if (son < x or y < bas) return 1000000007LL;
  if (x <= bas and son <= y) return kd[root];
  return min(query(root * 2, bas, (bas + son) / 2, x, y),
             query(root * 2 + 1, (bas + son) / 2 + 1, son, x, y)) +
         art[root];
}
long long int h[4000005], pows[4000005] = {1}, OP[4000005], CL[4000005];
long long int f(int x, int y) {
  return (h[y] - h[x - 1] * pows[y - x + 1] + 1000000007LL * 1000000007LL) %
         1000000007LL;
}
long long int giveHash(data A, int x) {
  if (x <= A.op) return OP[x];
  if (x <= A.op + n)
    return (OP[A.op] * pows[x - A.op] + f(A.x, A.x + x - A.op - 1)) %
           1000000007LL;
  return (OP[A.op] * pows[x - A.op] + f(A.x, A.y) * pows[x - A.op - n] +
          CL[x - A.op - n]) %
         1000000007LL;
}
char giveChar(data A, int x) {
  if (x <= A.op) return '(';
  if (x <= A.op + n) return s[A.x + x - A.op - 1];
  return ')';
}
int lcp(data A, data B) {
  int bas = 0, son = min(A.op + n + A.cl, B.op + n + B.cl), orta;
  while (bas < son) {
    orta = (bas + son) / 2 + 1;
    if (giveHash(A, orta) == giveHash(B, orta))
      bas = orta;
    else
      son = orta - 1;
  }
  return bas;
}
bool cmp(data A, data B) {
  int u1, u2;
  u1 = A.op + n + A.cl;
  u2 = B.op + n + B.cl;
  if (u1 != u2) return u1 < u2;
  int l = lcp(A, B);
  if (l == u1) return 1;
  return giveChar(A, l + 1) == '(';
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int R = 0;
  for (long long int i = 1; i <= n; i++) {
    s[i + n] = s[i];
    R += arr[i] = arr[i + n] = (s[i] == '(' ? 1 : -1);
  }
  for (long long int i = n + 1; i <= 2 * n; i++)
    update(1, 1, 2 * n, i, 2 * n, arr[i]);
  for (long long int i = n; i >= 1; i--) {
    int mini = query(1, 1, 2 * n, i + 1, i + n);
    a[i].op = max(0, -mini);
    a[i].cl = R + a[i].op;
    a[i].x = i + 1;
    a[i].y = i + n;
    update(1, 1, 2 * n, i, i + n - 1, arr[i]);
  }
  for (long long int i = 1; i <= 4000001; i++)
    h[i] = (h[i - 1] * 9973 + s[i]) % 1000000007LL,
    pows[i] = (pows[i - 1] * 9973) % 1000000007LL,
    OP[i] = (OP[i - 1] * 9973 + '(') % 1000000007LL,
    CL[i] = (CL[i - 1] * 9973 + ')') % 1000000007LL;
  data res = a[1];
  for (long long int i = 2; i <= n; i++)
    if (cmp(a[i], res)) res = a[i];
  string result;
  for (long long int i = 1; i <= res.op; i++) result += '(';
  for (long long int i = res.x; i <= res.y; i++) result += s[i];
  for (long long int i = 1; i <= res.cl; i++) result += ')';
  if (s[1] == '(' and s[4] == '(' and s[6] == '(' and s[2] == ')' and
      s[3] == ')' and n >= 100000) {
  }
  printf("%s\n", result.c_str());
}