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 SA_IS {
  vector<int> compress(vector<int>& v) {
    set<int> alph(v.begin(), v.end());
    vector<int> dic(alph.begin(), alph.end());
    vector<int> bucket_size(dic.size(), 0);
    for (int i = 0; i < v.size(); i++) {
      v[i] = lower_bound(dic.begin(), dic.end(), v[i]) - dic.begin();
      bucket_size[v[i]]++;
    }
    return bucket_size;
  }

 public:
  static const int L = 0;
  static const int S = 1;
  string my_s;
  vector<int> sa;
  vector<int> lcp;
  struct substring {
    int pos;
    int size;
    vector<int>::iterator str;
    vector<int>::iterator ls;
    substring() {}
    substring(const int pos, const int size, const vector<int>::iterator& str,
              const vector<int>::iterator& ls) {
      this->pos = pos;
      this->size = size;
      this->str = str;
      this->ls = ls;
    }
    bool operator<(const substring& x) const {
      for (int i = 0; i < min(this->size, x.size); i++) {
        if (this->str[i] != x.str[i]) {
          return this->str[i] < x.str[i];
        } else if (this->ls[i] != x.ls[i]) {
          return this->ls[i] == SA_IS::L;
        }
      }
      return this->size < x.size;
    }
    bool operator==(const substring& x) const {
      for (int i = 0; i < min(this->size, x.size); i++) {
        if (this->str[i] != x.str[i]) {
          return false;
        } else if (this->ls[i] != x.ls[i]) {
          return false;
        }
      }
      return this->size == x.size;
    }
    substring operator=(const substring& x) {
      this->pos = x.pos;
      this->size = x.size;
      this->str = x.str;
      this->ls = x.ls;
      return *this;
    }
  };
  vector<int> rec(vector<int> v) {
    v.push_back(-1);
    vector<int> bucket_size = compress(v);
    vector<int> ret(v.size(), -1);
    vector<vector<int>::iterator> bucket(bucket_size.size());
    vector<bool> fixed(v.size(), false);
    vector<vector<bool>::iterator> bucket_fixed(bucket_size.size());
    vector<int> bucket_front(bucket_size.size());
    vector<int> bucket_back(bucket_size.size());
    vector<bool> used(v.size(), false);
    {
      int sum = 0;
      for (int i = 0; i < bucket_size.size(); i++) {
        bucket[i] = ret.begin() + sum;
        bucket_fixed[i] = fixed.begin() + sum;
        bucket_front[i] = 0;
        bucket_back[i] = bucket_size[i] - 1;
        sum += bucket_size[i];
      }
    }
    vector<int> LS(v.size());
    LS.back() = S;
    for (int i = v.size() - 2; i >= 0; i--) {
      if (v[i] < v[i + 1])
        LS[i] = S;
      else if (v[i] > v[i + 1])
        LS[i] = L;
      else
        LS[i] = LS[i + 1];
    }
    vector<int> LMS;
    for (int i = 1; i < v.size(); i++) {
      if (LS[i] != S) continue;
      if (LS[i - 1] == L) LMS.push_back(i);
    }
    LMS.push_back(v.size() - 1);
    vector<pair<substring, int>> LMS_substring;
    for (int i = 0; i < LMS.size() - 1; i++) {
      substring sub(LMS[i], LMS[i + 1] - LMS[i] + 1, v.begin() + LMS[i],
                    LS.begin() + LMS[i]);
      LMS_substring.push_back({sub, LMS_substring.size()});
    }
    if (LMS_substring.size() > 0) {
      vector<pair<substring, int>> LMS_substring_old = LMS_substring;
      sort(LMS_substring.begin(), LMS_substring.end());
      vector<int> LMS_order(LMS_substring.size());
      int cnt = 0;
      LMS_order[LMS_substring[0].second] = cnt;
      cnt++;
      for (int i = 1; i < LMS_substring.size(); i++) {
        if (LMS_substring[i].first == LMS_substring[i - 1].first) {
          LMS_order[LMS_substring[i].second] = cnt - 1;
        } else {
          LMS_order[LMS_substring[i].second] = cnt;
          cnt++;
        }
      }
      if (cnt != LMS_substring.size()) {
        vector<int> new_order = rec(LMS_order);
        LMS_order = vector<int>(new_order.begin() + 1, new_order.end());
        for (int i = 0; i < LMS_substring.size(); i++) {
          LMS_substring[i].first = LMS_substring_old[LMS_order[i]].first;
        }
      }
      for (int i = LMS_substring.size() - 1; i >= 0; i--) {
        int c = v[LMS_substring[i].first.pos];
        bucket[c][bucket_back[c]] = LMS_substring[i].first.pos;
        bucket_back[c]--;
      }
    }
    for (int i = 0; i < bucket_size.size(); i++) {
      for (int j = 0; j < bucket_size[i]; j++) {
        if (bucket[i][j] - 1 < 0) continue;
        if (LS[bucket[i][j] - 1] == L) {
          if (used[bucket[i][j] - 1]) continue;
          used[bucket[i][j] - 1] = true;
          int c = v[bucket[i][j] - 1];
          bucket[c][bucket_front[c]] = bucket[i][j] - 1;
          bucket_fixed[c][bucket_front[c]] = true;
          bucket_front[c]++;
        }
      }
      bucket_back[i] = bucket_size[i] - 1;
    }
    for (int i = 0; i < v.size(); i++) {
      if (fixed[i] == false) {
        ret[i] = -1;
      }
    }
    for (int i = bucket_size.size() - 1; i >= 0; i--) {
      for (int j = bucket_size[i] - 1; j >= 0; j--) {
        if (bucket[i][j] - 1 < 0) continue;
        if (LS[bucket[i][j] - 1] == S) {
          if (used[bucket[i][j] - 1]) continue;
          used[bucket[i][j] - 1] = true;
          int c = v[bucket[i][j] - 1];
          bucket[c][bucket_back[c]] = bucket[i][j] - 1;
          bucket_fixed[c][bucket_back[c]] = true;
          bucket_back[c]--;
        }
      }
    }
    ret[0] = ret.size() - 1;
    return ret;
  }
  vector<int> rec(string& s) {
    vector<int> v(s.begin(), s.end());
    return rec(v);
  }
  void constract_lcp() {
    int n = my_s.size();
    lcp.resize(n + 1);
    vector<int> rank(n + 1);
    for (int i = 0; i <= n; i++) rank[sa[i]] = i;
    int h = 0;
    lcp[0] = 0;
    for (int i = 0; i < n; i++) {
      int j = sa[rank[i] - 1];
      if (h > 0) h--;
      for (; j + h < n && i + h < n; h++) {
        if (my_s[j + h] != my_s[i + h]) break;
      }
      lcp[rank[i] - 1] = h;
    }
  }
  SA_IS(string s) {
    my_s = s;
    sa = rec(s);
  }
  void dbg_print() {
    for (int i = 0; i <= my_s.size(); i++) {
      string p(my_s.begin() + sa[i], my_s.end());
      cerr << p << " " << sa[i] << endl;
    }
  }
};
class SegmentTreeMIN {
  int n;
  vector<int> T;
  int INF;

 public:
  SegmentTreeMIN(int size) {
    INF = 1 << 29;
    n = 1;
    while (n < size) n <<= 1;
    T.resize(2 * n - 1);
    fill(T.begin(), T.end(), INF);
  }
  void update(int k, int val) {
    k += n - 1;
    T[k] = val;
    while (k > 0) {
      k = (k - 1) / 2;
      T[k] = min(T[k * 2 + 1], T[k * 2 + 2]);
    }
  }
  int RMQ(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b)
      return T[k];
    else {
      int val_left = RMQ(a, b, k * 2 + 1, l, (l + r) / 2);
      int val_right = RMQ(a, b, k * 2 + 2, (l + r) / 2, r);
      return min(val_left, val_right);
    }
  }
  int size() { return n; }
};
int main() {
  string s;
  cin >> s;
  int n = s.size();
  s += s;
  SA_IS sa(s);
  vector<int> arr(2 * n);
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == '(') {
      arr[i] = 1;
    } else {
      arr[i] = -1;
    }
    if (i > 0) arr[i] += arr[i - 1];
  }
  SegmentTreeMIN seg(2 * n);
  for (int i = 0; i < 2 * n; i++) {
    seg.update(i, arr[i]);
  }
  int index = -1;
  int len = 1 << 30;
  int xx = 0;
  int yy = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (sa.sa[i] > n) continue;
    int x = min(0, seg.RMQ(sa.sa[i], sa.sa[i] + n, 0, 0, seg.size()) -
                       (sa.sa[i] > 0 ? arr[sa.sa[i] - 1] : 0));
    int y = max(0, arr[sa.sa[i] + n - 1] -
                       (sa.sa[i] > 0 ? arr[sa.sa[i] - 1] : 0) + abs(x));
    if (len > abs(x) + abs(y) + n) {
      index = i;
      len = abs(x) + abs(y) + n;
      xx = abs(x);
      yy = abs(y);
    }
  }
  string ans;
  for (int j = 0; j < xx; j++) {
    printf("(");
  }
  cout << s.substr(sa.sa[index], n);
  for (int j = 0; j < yy; j++) {
    printf(")");
  }
  printf("\n");
  return 0;
}