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;
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
template <typename T>
T POW(T B, T printf) {
  if (printf == 0) return 1;
  if (printf & 1)
    return B * POW(B, printf - 1);
  else
    return (POW(B, printf / 2) * POW(B, printf / 2));
}
template <typename T>
T Bigmod(T b, T p, T m) {
  if (p == 0)
    return 1;
  else if (!(p & 1))
    return (Bigmod(b, p / 2, m) * Bigmod(b, p / 2, m)) % m;
  else
    return ((b % m) * Bigmod(b, p - 1, m)) % m;
}
template <typename T>
T Dis(T x1, T y1, T x2, T y2) {
  return sqrt((x1 - x2 * x1 - x2) + (y1 - y2 * y1 - y2));
}
template <typename T>
T Angle(T x1, T y1, T x2, T y2) {
  return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T>
T DIFF(T a, T b) {
  T d = a - b;
  if (d < 0)
    return -d;
  else
    return d;
}
template <typename T>
T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
template <typename T>
T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / gcd(a, b));
}
template <typename T>
T euclide(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = euclide(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = euclide(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = euclide(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <typename T>
void ia(T a[], int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void pa(T a[], int n) {
  for (int i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
template <typename T>
long long int isLeft(T a, T b, T c) {
  return (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y);
}
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
template <class T, class first>
inline T togglebit(T a, first i) {
  T t = 1;
  return (a ^ (t << i));
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int cdigittoint(char ch) { return ch - '0'; }
bool isVowel(char ch) {
  ch = toupper(ch);
  if (ch == 'A' || ch == 'U' || ch == 'I' || ch == 'O' || ch == 'E')
    return true;
  return false;
}
bool isConst(char ch) {
  if (isalpha(ch) && !isVowel(ch)) return true;
  return false;
}
double DEG(double x) { return (180.0 * x) / (2.0 * acos(0.0)); }
double RAD(double x) { return (x * (double)2.0 * acos(0.0)) / (180.0); }
char s[2097157];
int a[2097157];
int Tree[3 * 2097157][2];
int New[2097157][2];
int DP[3 * 2097157], l;
const int N = int(2e6) + 10;
int cmp(int *r, int a, int b, int l) {
  return (r[a] == r[b]) && (r[a + l] == r[b + l]);
}
int wa[N], wb[N], wws[N], wv[N];
int rnk[N], height[N];
void DA(int *r, int *sa, int n, int m) {
  int i, j, p, *x = wa, *y = wb, *t;
  for (i = 0; i < m; i++) wws[i] = 0;
  for (i = 0; i < n; i++) wws[x[i] = r[i]]++;
  for (i = 1; i < m; i++) wws[i] += wws[i - 1];
  for (i = n - 1; i >= 0; i--) sa[--wws[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++) wws[i] = 0;
    for (i = 0; i < n; i++) wws[wv[i]]++;
    for (i = 1; i < m; i++) wws[i] += wws[i - 1];
    for (i = n - 1; i >= 0; i--) sa[--wws[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++;
  }
}
void calheight(int *r, int *sa, int n) {
  int i, j, k = 0;
  for (i = 1; i <= n; i++) rnk[sa[i]] = i;
  for (i = 0; i < n; height[rnk[i++]] = k)
    for (k ? k-- : 0, j = sa[rnk[i] - 1];
         i + k < n && j + k < n && r[i + k] == r[j + k]; k++)
      ;
}
int sa[N], data[N], n, p, q;
void Level(int n) {
  for (int i = 0;; i++)
    if (1 << i >= n) {
      l = i;
      return;
    }
}
void Build(int n) {
  for (int i = 1; i <= n; i++) {
    Tree[i + ((1 << l) - 1)][s[i - 1] - 'a'] = 1;
    DP[i + ((1 << l) - 1)] = height[i];
  }
  for (int idx = ((1 << l) - 1); idx; idx--) {
    int mn = min(Tree[(idx << 1)][0], Tree[((idx << 1) | 1)][1]);
    Tree[idx][0] = Tree[(idx << 1)][0] + Tree[((idx << 1) | 1)][0] - mn;
    Tree[idx][1] = Tree[(idx << 1)][1] + Tree[((idx << 1) | 1)][1] - mn;
    DP[idx] = min(DP[(idx << 1)], DP[((idx << 1) | 1)]);
  }
}
void QueryBalance(int a, int b) {
  int id = a;
  a += ((1 << l) - 1) + 1;
  b += ((1 << l) - 1) + 1;
  int L[30], R[30], p = 0, q = 0;
  while (a <= b) {
    if (a % 2 == 1) L[++p] = a;
    if (b % 2 == 0) R[++q] = b;
    a = (a + 1) >> 1;
    b = (b - 1) >> 1;
  }
  for (int i = 1; i <= p; i++) {
    int mn = min(New[id][0], Tree[L[i]][1]);
    New[id][0] = New[id][0] + Tree[L[i]][0] - mn;
    New[id][1] = New[id][1] + Tree[L[i]][1] - mn;
  }
  for (int i = q; i; i--) {
    int mn = min(New[id][0], Tree[R[i]][1]);
    New[id][0] = New[id][0] + Tree[R[i]][0] - mn;
    New[id][1] = New[id][1] + Tree[R[i]][1] - mn;
  }
  swap(New[id][0], New[id][1]);
}
int QueryMin(int a, int b) {
  if (a == b) return 1000000007;
  a = rnk[a];
  b = rnk[b];
  if (a > b) swap(a, b);
  a += ((1 << l) - 1) + 1;
  b += ((1 << l) - 1);
  int mn = 1000000007;
  while (a <= b) {
    if (a % 2 == 1) mn = min(mn, DP[a]);
    if (b % 2 == 0) mn = min(mn, DP[b]);
    a = (a + 1) >> 1;
    b = (b - 1) >> 1;
  }
  return mn;
}
int main() {
  int l = 0;
  while (1) {
    char x = getchar();
    if (x != '(' && x != ')') {
      s[l + 1] = 0;
      break;
    }
    if (x == '(')
      s[l++] = 'a';
    else
      s[l++] = 'b';
    data[l - 1] = s[l - 1];
  }
  for (int i = 0; i < l; i++) data[i + l] = s[i + l] = s[i];
  s[l + l + 1] = 0;
  DA(data, sa, l + l + 1, 128);
  calheight(data, sa, l + l);
  Level(l + l);
  Build(l + l);
  for (int i = l + l - 1; i >= 0; i--)
    if (s[i] == 'a') a[i] += a[i + 1] + 1;
  int newAdd = (1 << 30) - 1 + (1 << 30);
  int id;
  for (int i = 1; i <= l; i++) {
    QueryBalance(i, i + l - 1);
    if (New[i][0] && New[i][1] && New[i][0] == New[i][1]) continue;
    if (New[i][0] + New[i][1] < newAdd) {
      newAdd = New[i][0] + New[i][1];
      id = i;
    } else if (New[i][0] + New[i][1] == newAdd) {
      int open1 = New[id][0] + min(a[id], l);
      int open2 = New[i][0] + min(a[i], l);
      if (open1 < open2)
        id = i;
      else if (open1 == open2) {
        int x = id + a[id];
        int y = i + a[i];
        int q = QueryMin(x, y) + a[i];
        if (q >= l) {
          if (New[id][1] > New[i][1]) {
            id = i;
          }
        } else {
          x = rnk[id];
          y = rnk[i];
          if (x > y) id = i;
        }
      }
    }
  }
  for (int i = 0; i < New[id][0]; i++) putchar('(');
  for (int i = id; i < id + l; i++)
    if (s[i] == 'a')
      putchar('(');
    else
      putchar(')');
  for (int i = 0; i < New[id][1]; i++) putchar(')');
  printf("\n");
  ;
  return 0;
}