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;
bool hadDebugEnv = false;
bool isDebugEnv = false;
bool isDebug() {
  if (!hadDebugEnv) {
    hadDebugEnv = true;
    isDebugEnv = (getenv("SWATMAD_CF_DEBUG") != NULL);
  }
  return isDebugEnv;
}
chrono::high_resolution_clock::time_point timeStart;
const int INF = numeric_limits<int>::max();
const long long LLINF = numeric_limits<long long>::max();
std::bitset<32> bits(int x) { return std::bitset<32>(x); }
template <class F, class S>
ostream& operator<<(ostream& o, const pair<F, S>& p) {
  return o << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& a);
template <class C>
void csp(ostream& o, const C& c) {
  bool f = 1;
  for (const auto& x : c) {
    if (!f) o << ", ";
    f = 0;
    o << x;
  }
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& a) {
  o << "[";
  csp(o, a);
  o << "]";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const deque<T>& a) {
  o << "[";
  csp(o, a);
  o << "]";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const vector<vector<T>>& a) {
  for (const auto& x : a) {
    o << "[";
    csp(o, x);
    o << "]\n";
  }
  return o;
}
template <class T, class R>
ostream& operator<<(ostream& o, const map<T, R>& a) {
  o << "{";
  csp(o, a);
  o << "}";
  return o;
}
template <class T, class R>
ostream& operator<<(ostream& o, const unordered_map<T, R>& a) {
  o << "{";
  csp(o, a);
  o << "}";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const set<T>& a) {
  o << "{";
  csp(o, a);
  o << "}";
  return o;
}
template <class T>
ostream& operator<<(ostream& o, const unordered_set<T>& a) {
  o << "{";
  csp(o, a);
  o << "}";
  return o;
}
vector<int> sufArray(const string& s) {
  vector<int> p(s.length(), 0);
  vector<int> c(s.length(), 0);
  set<char> alphabet;
  map<char, int> id;
  for (const auto& x : s) {
    alphabet.insert(x);
  }
  int maxId = 0;
  for (const auto& x : alphabet) {
    id[x] = maxId++;
  }
  vector<int> cnt(alphabet.size(), 0);
  for (int i = 0; i < (int)(s.length()); ++i) {
    ++cnt[id[s[i]]];
  }
  if (isDebug()) {
    cerr << cnt << endl;
  };
  for (int i = (int)(1); i < (int)(alphabet.size()); ++i) {
    cnt[i] += cnt[i - 1];
  }
  for (int i = 0; i < (int)(s.length()); ++i) {
    p[--cnt[id[s[i]]]] = i;
  }
  c[p[0]] = 0;
  int classes = 1;
  for (int i = (int)(1); i < (int)(s.length()); ++i) {
    if (s[p[i]] != s[p[i - 1]]) {
      ++classes;
    }
    c[p[i]] = classes - 1;
  }
  vector<int> pn(s.length(), 0);
  vector<int> cn(s.length(), 0);
  for (int h = 0; (1 << h) < s.length(); ++h) {
    for (int i = 0; i < (int)(s.length()); ++i) {
      pn[i] = p[i] - (1 << h);
      if (pn[i] < 0) {
        pn[i] += s.length();
      }
    }
    cnt.assign(classes, 0);
    for (int i = 0; i < (int)(s.length()); ++i) {
      ++cnt[c[pn[i]]];
    }
    for (int i = (int)(1); i < (int)(classes); ++i) {
      cnt[i] += cnt[i - 1];
    }
    for (int i = (int)(s.length()) - 1; i >= 0; --i) {
      p[--cnt[c[pn[i]]]] = pn[i];
    }
    cn[p[0]] = 0;
    classes = 1;
    for (int i = (int)(1); i < (int)(s.length()); ++i) {
      int mid1 = (p[i] + (1 << h)) % s.length();
      int mid2 = (p[i - 1] + (1 << h)) % s.length();
      if (c[p[i]] != c[p[i - 1]] || c[mid1] != c[mid2]) {
        ++classes;
      }
      cn[p[i]] = classes - 1;
    }
    c = cn;
  }
  return p;
}
int main() {
  if (isDebug()) {
    timeStart = chrono::high_resolution_clock::now();
  };
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  string s;
  cin >> s;
  vector<int> lex = sufArray(s);
  if (isDebug()) {
    cerr << lex << endl;
  };
  vector<int> nbad(s.length(), 0);
  vector<int> lbad(s.length(), 0);
  vector<int> rbad(s.length(), 0);
  vector<bool> bad(s.length(), false);
  vector<int> l;
  l.reserve(s.length());
  int numL = 0;
  int numR = 0;
  for (int i = 0; i < (int)(s.length()); ++i) {
    if (s[i] == '(') {
      l.push_back(i);
    } else {
      if (!l.empty()) {
        l.pop_back();
      } else {
        bad[i] = true;
        ++numR;
      }
    }
  }
  for (const auto& x : l) {
    bad[x] = true;
    ++numL;
  }
  nbad[0] = numL + numR;
  lbad[0] = numL;
  rbad[0] = numR;
  int minBad = nbad[0];
  for (int i = 0; i < (int)(s.length() - 1); ++i) {
    if (isDebug()) {
      cerr << "Iter " << i << endl;
    };
    if (isDebug()) {
      cerr << l << endl;
    };
    if (bad[i]) {
      if (s[i] == '(') {
        --numL;
      } else {
        --numR;
      }
    }
    if (isDebug()) {
      cerr << "Current " << numL << " " << numR << endl;
    };
    if (s[i] == '(') {
      ++numL;
      l.push_back(i);
    } else {
      if (numL > 0) {
        --numL;
        bad[l.back()] = false;
        l.pop_back();
      } else {
        ++numR;
      }
    }
    nbad[i + 1] = numL + numR;
    lbad[i + 1] = numL;
    rbad[i + 1] = numR;
    minBad = min(minBad, nbad[i + 1]);
  }
  if (isDebug()) {
    cerr << bad << endl;
  };
  if (isDebug()) {
    cerr << nbad << endl;
  };
  if (isDebug()) {
    cerr << lbad << endl;
  };
  if (isDebug()) {
    cerr << rbad << endl;
  };
  if (isDebug()) {
    cerr << minBad << endl;
  };
  for (const auto& x : lex) {
    if (x >= s.length()) {
      continue;
    }
    if (nbad[x] == minBad) {
      if (isDebug()) {
        cerr << x << endl;
      };
      for (int i = 0; i < (int)(rbad[x]); ++i) {
        printf("(");
      }
      for (int i = 0; i < (int)(s.length()); ++i) {
        int j = (x + i) % s.length();
        printf("%c", s[j]);
      }
      for (int i = 0; i < (int)(lbad[x]); ++i) {
        printf(")");
      }
      printf("\n");
      break;
    }
  }
  if (isDebug()) {
    cerr << "Time check: "
         << double(chrono::duration_cast<chrono::milliseconds>(
                       chrono::high_resolution_clock::now() - timeStart)
                       .count()) /
                1000
         << endl;
  };
  return 0;
}