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>
#pragma comment(linker, "/STACK:666777216")
using namespace std;
const int N = 1000007;
char st[N];
int n, sum[N], openCnt[N];
struct segTree {
  int T[4 * N];
  void build(int v, int tl, int tr, int *sum) {
    if (tl == tr) {
      T[v] = sum[tl];
      return;
    }
    int tm = (tl + tr) / 2;
    build(2 * v, tl, tm, sum);
    build(2 * v + 1, tm + 1, tr, sum);
    T[v] = min(T[2 * v], T[2 * v + 1]);
  }
  void update(int v, int tl, int tr, int pos, int val) {
    if (tl == tr) {
      T[v] = val;
      return;
    }
    int tm = (tl + tr) / 2;
    if (pos <= tm)
      update(2 * v, tl, tm, pos, val);
    else
      update(2 * v + 1, tm + 1, tr, pos, val);
    T[v] = min(T[2 * v], T[2 * v + 1]);
  }
  int get(int v, int tl, int tr, int l, int r) {
    if (r < l) return N;
    if (tl == l && tr == r) return T[v];
    int tm = (tl + tr) / 2;
    if (r <= tm) return get(2 * v, tl, tm, l, r);
    if (l > tm) return get(2 * v + 1, tm + 1, tr, l, r);
    return min(get(2 * v, tl, tm, l, tm),
               get(2 * v + 1, tm + 1, tr, tm + 1, r));
  }
} tree;
inline int get(int l, int r, int *sum) {
  if (l > r) return 0;
  if (l == 0) return sum[r];
  return sum[r] - sum[l - 1];
}
int open[N], close[N];
inline int code(char c) { return c == '(' ? 0 : 1; }
struct SA {
  int pos[N], tpos[N], cnt[N], rev[N];
  int C[21][N];
  void build() {
    memset(cnt, 0, sizeof cnt);
    for (int i = 0; i < (n); ++i) ++cnt[code(st[i])];
    for (int i = 0; i < (n); ++i) {
      if (i) cnt[i] += cnt[i - 1];
    }
    for (int i = n - 1; i >= 0; --i) {
      pos[i] = --cnt[code(st[i])];
    }
    for (int i = 0; i < (n); ++i) {
      C[0][i] = code(st[i]);
    }
    for (int h = 1, lev = 0; h < n; h <<= 1, ++lev) {
      for (int i = 0; i < (n); ++i) {
        tpos[i] = pos[(i + h) % n];
      }
      memset(cnt, 0, sizeof cnt);
      for (int i = 0; i < (n); ++i) ++cnt[C[lev][i]];
      for (int i = 0; i < (n); ++i) {
        if (i) cnt[i] += cnt[i - 1];
      }
      for (int i = 0; i < (n); ++i) {
        rev[tpos[i]] = i;
      }
      for (int i = n - 1; i >= 0; --i) {
        int ind = rev[i];
        pos[ind] = --cnt[C[lev][ind]];
      }
      for (int i = 0; i < (n); ++i) {
        rev[pos[i]] = i;
      }
      C[lev + 1][rev[0]] = 0;
      for (int i = 1, cur = 0; i < n; ++i) {
        if (C[lev][rev[i - 1]] != C[lev][rev[i]] ||
            C[lev][(rev[i - 1] + h) % n] != C[lev][(rev[i] + h) % n])
          ++cur;
        C[lev + 1][rev[i]] = cur;
      }
    }
  }
} sa;
bool checkOpen(int i, int j) {
  if (i < j) return get(i, j, openCnt) == j - i + 1;
  return get(i, n - 1, openCnt) + get(0, j, openCnt) ==
         n - 1 - i + 1 + j - 0 + 1;
}
int cmp(int i, int j, int len) {
  for (int h = 19; h >= 0; --h) {
    if ((1 << h) > len) continue;
    if (sa.C[h][i] < sa.C[h][j]) return -1;
    if (sa.C[h][i] > sa.C[h][j]) return 1;
    i = (i + (1 << h)) % n;
    j = (j + (1 << h)) % n;
  }
  return 0;
}
bool compare(int i, int j) {
  int op1 = open[i] - min(open[i], open[j]);
  int op2 = open[j] - min(open[i], open[j]);
  int cl1 = close[i];
  int cl2 = close[j];
  if (op1 != 0) {
    if (!checkOpen(j, (j + op1) % n)) return true;
    j = (j + op1) % n;
  }
  if (op2 != 0) {
    if (!checkOpen(i, (i + op2) % n)) return false;
    i = (i + op2) % n;
  }
  int res = cmp(i, j, n - max(op1, op2));
  if (res == -1) return true;
  if (res == 1) return false;
  return cl1 <= cl2;
}
void solve() {
  scanf("%s", st);
  n = strlen(st);
  for (int i = 0; i < (n); ++i) {
    int psum = (i ? sum[i - 1] : 0);
    if (st[i] == '(')
      sum[i] = psum + 1;
    else
      sum[i] = psum - 1;
    int popen = (i ? openCnt[i - 1] : 0);
    if (st[i] == '(')
      openCnt[i] = popen + 1;
    else
      openCnt[i] = popen;
  }
  tree.build(1, 0, n - 1, sum);
  int totalBal = sum[n - 1];
  for (int i = 0; i < (n); ++i) {
    int min1 = tree.get(1, 0, n - 1, i, n - 1) - get(0, i - 1, sum);
    int min2 = tree.get(1, 0, n - 1, 0, i - 1) + get(i, n - 1, sum);
    int mini = min(min1, min2);
    if (mini >= 0) {
      close[i] = totalBal;
    } else {
      open[i] = -mini;
      if (totalBal + open[i] < 0)
        open[i] += -(totalBal + open[i]);
      else
        close[i] = totalBal + open[i];
    }
  }
  int minAdd = N + N;
  for (int i = 0; i < (n); ++i) {
    minAdd = min(minAdd, open[i] + close[i]);
  }
  sa.build();
  int best = -1;
  for (int i = 0; i < (n); ++i) {
    if (open[i] + close[i] != minAdd) continue;
    if (best == -1 || compare(i, best)) {
      best = i;
    }
  }
  for (int i = 0; i < (open[best]); ++i) putchar('(');
  for (int i = best; i < n; ++i) {
    putchar(st[i]);
  }
  for (int i = 0; i < best; ++i) {
    putchar(st[i]);
  }
  for (int i = 0; i < (close[best]); ++i) putchar(')');
}
int rd() { return (((long long)rand() << 16) ^ rand()) % 1000000000; }
void testGen() {
  FILE *f = fopen("input.txt", "w");
  fclose(f);
}
int main() {
  cerr << fixed;
  cerr.precision(5);
  solve();
  return 0;
}