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 N = 2e6 + 6;
char s[N];
int p1[N];
int p2[N];
int s1[N];
int s2[N];
long long X1 = 277, X2 = 2887;
long long M1 = 1444444447, M2 = 1777777777;
long long x1[N], x2[N];
struct hasher {
  vector<long long> h1, h2;
  hasher() {}
  string s;
  hasher(char *str) {
    s = str;
    int n = s.length();
    h1.assign(n + 1, 0);
    for (int i = n - 1; i >= 0; --i) {
      h1[i] = (h1[i + 1] * X1 + s[i]) % M1;
    }
  }
  long long get(int l, int r) {
    return ((h1[l] - h1[r + 1] * x1[r - l + 1] % M1 + M1) % M1);
  }
};
int cmp(hasher &s1, int i1, int j1, hasher &s2, int i2, int j2) {
  int l = 0, r = min(j1 - i1 + 1, j2 - i2 + 1) + 1;
  while (l < r) {
    int m = (l + r) >> 1;
    if (s1.get(i1, i1 + m - 1) == s2.get(i2, i2 + m - 1))
      l = m + 1;
    else
      r = m;
  }
  --l;
  if (i1 + l > j1 && i2 + l > j2) return 0;
  if (i1 + l > j1) return -1;
  if (i2 + l > j2) return 1;
  return s1.s[i1 + l] < s2.s[i2 + l] ? -1 : 1;
}
hasher h, ho, hz;
int n;
void calc(int i, int &il, int &ir) {
  int op = p2[i];
  int zp = i - p1[i] - op;
  int zs = s2[i + 1];
  int os = n - i - s1[i + 1] - zs;
  il = zs;
  ir = op;
  if (os > zp)
    ir += os - zp;
  else
    il += zp - os;
}
bool cmp(int i, int j, int len) {
  int il, ir, jl, jr;
  calc(i, il, ir);
  calc(j, jl, jr);
  int im = len - il - ir;
  int jm = len - jl - jr;
  int k = 0;
  for (;;) {
    if (k < il) {
      if (k < jl) {
        k = min(il, jl);
        continue;
      } else if (k < jl + jm) {
        int d = min(il - k, jl + jm - k);
        int dif = cmp(ho, 0, d - 1, h, j + (k - jl), j + (k - jl) + d - 1);
        if (dif) return dif < 0;
        k += d;
        continue;
      } else {
        return true;
      }
    } else if (k < il + im) {
      if (k < jl) {
        int d = min(jl - k, il + im - k);
        int dif = cmp(h, i + (k - il), i + (k - il) + d - 1, ho, 0, d - 1);
        if (dif) return dif < 0;
        k += d;
        continue;
      } else if (k < jl + jm) {
        int d = min(il + im - k, jl + jm - k);
        int dif = cmp(h, i + (k - il), i + (k - il) + d - 1, h, j + (k - jl),
                      j + (k - jl) + d - 1);
        if (dif) return dif < 0;
        k += d;
        continue;
      } else {
        int d = min(il + im - k, len - k);
        int dif = cmp(h, i + (k - il), i + (k - il) + d - 1, hz, 0, d - 1);
        if (dif) return dif < 0;
        k += d;
        continue;
      }
    } else if (k < len) {
      if (k < jl) {
        return false;
      } else if (k < jl + jm) {
        int d = min(len - k, jl + jm - k);
        int dif = cmp(hz, 0, d - 1, h, j + (k - jl), j + (k - jl) + d - 1);
        if (dif) return dif < 0;
        k += d;
        continue;
      } else {
        k = len;
        continue;
      }
    } else
      return false;
  }
}
char e[N];
string ans;
string func(string &s) {
  string res;
  int m = 0;
  for (int i = 0; i < s.length(); ++i)
    if (s[i] == '(') {
      ++m;
    } else {
      if (!m)
        res += "(";
      else
        --m;
    }
  res += s;
  while (m--) res += ")";
  return res;
}
int main() {
  for (int i = x1[0] = 1; i < N; ++i) x1[i] = x1[i - 1] * X1 % M1;
  gets(s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) s[i + n] = s[i];
  for (int i = n; i; --i) {
    if (s[i] == '(') {
      if (s2[i + 1]) {
        s1[i] = s1[i + 1] + 2;
        s2[i] = s2[i + 1] - 1;
      } else {
        s1[i] = s1[i + 1];
        s2[i] = s2[i + 1];
      }
    } else {
      s1[i] = s1[i + 1];
      s2[i] = s2[i + 1] + 1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (s[i] == ')') {
      if (p2[i - 1]) {
        p1[i] = p1[i - 1] + 2;
        p2[i] = p2[i - 1] - 1;
      } else {
        p1[i] = p1[i - 1];
        p2[i] = p2[i - 1];
      }
    } else {
      p1[i] = p1[i - 1];
      p2[i] = p2[i - 1] + 1;
    }
  }
  int x = n * 10;
  vector<int> pos;
  for (int i = 0; i < n; ++i) {
    int op = p2[i];
    int zp = i - p1[i] - op;
    int zs = s2[i + 1];
    int os = n - i - s1[i + 1] - zs;
    int len = zs + op + max(os, zp) - min(os, zp) + n;
    if (x > len) {
      pos.clear();
      x = len;
    }
    if (x == len) {
      pos.push_back(i);
    }
    int sl, sr;
    calc(i, sl, sr);
  }
  h = hasher(s + 1);
  for (int i = 0; i < n * 2; ++i) e[i] = '(';
  ho = hasher(e);
  for (int i = 0; i < n * 2; ++i) e[i] = ')';
  hz = hasher(e);
  int res = pos[0];
  for (int k = 1; k < pos.size(); ++k)
    if (cmp(pos[k], res, x)) res = pos[k];
  int sl, sr;
  calc(res, sl, sr);
  for (int i = 0; i < sl; ++i) printf("(");
  for (int i = 0; i < x - sl - sr; ++i) printf("%c", s[res + i + 1]);
  for (int i = 0; i < sr; ++i) printf(")");
  return 0;
}