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 JAVA):

Solution:
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
		String s = in.next();
		int n = s.length();
		int[] b = new int[2*n + 1];
		for (int i = 0; i < 2*n; i++) {
			int cur;
			if (s.charAt(i % n) == '(') {
				cur = +1;
			} else {
				cur = -1;
			}
			b[i + 1] = b[i] + cur;
		}
		MinTree min = new MinTree(b.length);
		for (int i = 0; i < b.length; i++) {
			min.update(i, b[i]);
		}
		int[] s01 = new int[n];
		for (int i = 0; i < n; i++) {
			s01[i] = s.charAt(i) == '(' ? 0 : 1;
		}
		int[] sa = buildSuffixArray(s01);
		int[] pos = new int[sa.length];
		for (int i = 0; i < sa.length; i++) {
			pos[sa[i]] = i;
		}
		int best = -1;
		int add = Math.max(-b[n], 0);
		for (int i = 0; i < n; i++) {
			int delta = min.getMin(i + 1, i + n) - b[i];
			if (delta + add >= 0) {
				if (best < 0 || pos[best] > pos[i]) {
					best = i;
				}
			}
		}
		if (best < 0) {
			throw new AssertionError();
		}
		StringBuilder ans = new StringBuilder();
		for (int i = 0; i < -b[n]; i++) {
			ans.append("(");
		}
		for (int i = best; i < best + n; i++) {
			ans.append(s.charAt(i % n));
		}
		for (int i = 0; i < b[n]; i++) {
			ans.append(")");
		}
		out.println(ans);
    }

	private int[] buildSuffixArray(int[] _s) {
		int[] s = compress(_s);
		int n = s.length;
		int[] am = new int[n];
		for (int x : s) {
			++am[x];
		}
		int[] start = new int[n];
		int numCols = 0;
		int total = 0;
		for (int i = 0; i < n; i++) {
			if (am[i] > 0) {
				start[numCols] = total;
				total += am[i];
				++numCols;
			}
		}
		int[] sa = new int[n];
		int[] col = new int[n];
		int[] tmp = start.clone();
		for (int i = 0; i < n; i++) {
			col[i] = s[i];
			sa[tmp[col[i]]++] = i;
		}
		int len = 1;
		while (len < n) {
			int[] nsa = new int[n];
			int[] ncol = new int[n];
			for (int i = 0; i < n; i++) {
				int j = sa[i] - len;
				if (j < 0) {
					j += n;
				}
				nsa[start[col[j]]++] = j;
			}
			numCols = 1;
			start[0] = 0;
			for (int i = 0; i < n; i++) {
				if (i > 0) {
					int u = nsa[i];
					int v = nsa[i - 1];
					if (col[u] != col[v] || col[(u + len) % n] != col[(v + len) % n]) {
						start[numCols] = i;
						++numCols;
					}
				}
				ncol[nsa[i]] = numCols - 1;
			}
			sa = nsa;
			col = ncol;
			len *= 2;
		}
		return sa;
	}

	private int[] compress(int[] s) {
		int[] sorted = s.clone();
		Arrays.sort(sorted);
		int k = 0;
		for (int i = 0; i < sorted.length; i++) {
			if (i == 0 || sorted[i] != sorted[i - 1]) {
				sorted[k++] = sorted[i];
			}
		}
		int[] res = new int[s.length];
		for (int i = 0; i < s.length; i++) {
			res[i] = Arrays.binarySearch(sorted, 0, k, s[i]);
		}
		return res;
	}

	class MinTree {
		int[] a;
		int n;
		MinTree(int n) {
			this.n = n;
			int k = 1;
			while (k < n) {
				k *= 2;
			}
			a = new int[2 * k];
			Arrays.fill(a, Integer.MAX_VALUE / 2);
		}
		void update(int i, int val) {
			i += n;
			while (true) {
				a[i] = Math.min(a[i], val);
				if (i == 0) {
					break;
				}
				i = (i - 1) / 2;
			}
		}
		int getMin(int l, int r) {
			if (l > r) {
				return Integer.MAX_VALUE / 2;
			}
			l += n;
			r += n;
			if (l == r) {
				return a[l];
			}
			int lm = a[l];
			int rm = a[r];
			while (r - l > 1) {
				if (l % 2 == 1) {
					lm = Math.min(lm, a[l + 1]);
				}
				if (r % 2 == 0) {
					rm = Math.min(rm, a[r - 1]);
				}
				l = (l - 1) / 2;
				r = (r - 1) / 2;
			}
			return Math.min(lm, rm);
		}
	}
}

class FastScanner {

	private BufferedReader in;
	private StringTokenizer st;

	public FastScanner(InputStream stream) {
		in = new BufferedReader(new InputStreamReader(stream));
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(in.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

}