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 GCC optimize("Ofast,no-stack-protector")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct suff_arr {
  vector<int> p, c, np, nc, h;
  string s;
  int n;
  suff_arr(string &s) {
    this->s = s;
    this->n = s.size();
    build();
  }
  int mode1(int a, int k) { return (a + (1 << (k - 1))) % n; }
  int mode2(int a, int k) { return (a - (1 << (k - 1)) + n) % n; }
  bool prov(int i, int j, int k) {
    return c[i] != c[j] || c[mode1(i, k)] != c[mode1(j, k)];
  }
  void build() {
    p.resize(n), c = nc = np = h = p;
    vector<pair<char, int>> in;
    for (int i = 0; i < s.size(); i++) in.push_back({s[i], i});
    sort(in.begin(), in.end());
    for (int i = 0; i < in.size(); i++) p[i] = in[i].second;
    int g = h[0] = c[p[0]] = 0, k = 1;
    for (int i = 1; i < n; i++) {
      if (in[i].first != in[i - 1].first) g++, h[g] = i;
      c[p[i]] = g;
    }
    while ((1 << (k - 1)) < n) {
      for (int i = 0; i < n; i++) {
        int v = mode2(p[i], k);
        np[h[c[v]]++] = v;
      }
      g = h[0] = nc[np[0]] = 0;
      for (int i = 1; i < n; i++) {
        if (prov(np[i], np[i - 1], k)) g++, h[g] = i;
        nc[np[i]] = g;
      }
      c = nc, p = np, k++;
      if (g == n) break;
    }
  }
};
struct que {
  stack<pair<int, int>> s1, s2;
  void add(int x) {
    int ane = 1e9;
    if (s1.size()) ane = min(ane, s1.top().second);
    s1.push({x, min(ane, x)});
  }
  void res() {
    while (s1.size()) {
      int g = s1.top().first;
      s1.pop();
      int ane = 1e9;
      if (s2.size()) ane = min(ane, s2.top().second);
      s2.push({g, min(ane, g)});
    }
  }
  int mi() {
    int ane1 = 1e9, ane2 = 1e9;
    if (s1.size()) ane1 = min(ane1, s1.top().second);
    if (s2.size()) ane2 = min(ane2, s2.top().second);
    return min(ane1, ane2);
  }
  int gy() {
    if (!s2.size()) res();
    int x = s2.top().first;
    return x;
  }
  int del() {
    if (!s2.size()) res();
    int x = s2.top().first;
    s2.pop();
    return x;
  }
};
const int maxn = 1e6 + 113;
bool used[maxn];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.setf(ios::fixed);
  cout.precision(0);
  string s;
  cin >> s;
  int yt = s.size();
  int b1 = 0, b2 = 0;
  int de = 0, su = 0, lasty = 0;
  que mu;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '(') {
      b1++;
      su++;
    } else {
      b2++;
      su--;
    }
    mu.add(su);
    lasty = su;
  }
  int vs = max(b2 - b1, 0);
  for (int i = 0; i < s.size(); i++) {
    int u = mu.mi();
    if (u + de >= -vs) used[i] = 1;
    if (s[i] == '(')
      de--;
    else
      de++;
    mu.del();
    mu.add(lasty - de);
  }
  suff_arr mg(s);
  int pos;
  for (int i = 0; i < s.size(); i++)
    if (used[mg.p[i]]) {
      pos = mg.p[i];
      break;
    }
  string h;
  for (int i = pos; i < s.size(); i++) h.push_back(s[i]);
  for (int i = 0; i < pos; i++) h.push_back(s[i]);
  while (b1 < b2) {
    cout << "(";
    b1++;
  }
  cout << h;
  while (b1 > b2) {
    cout << ")";
    b2++;
  }
}