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.*;
import java.math.BigInteger;
import java.util.*;

public class A {
	FastScanner in;
	PrintWriter out;

	private class StringHash {
		private int[] val1, val2;
		private HashHelper helper;
		String s;

		public StringHash(int[] val1, int[] val2, HashHelper helper, String s) {
			super();
			this.val1 = val1;
			this.val2 = val2;
			this.helper = helper;
			this.s = s;
		}

		public int getIntHash(int l, int r) {
			long result = val1[r + 1] - val1[l] * 1L * helper.pow1[r - l + 1];
			result %= helper.MOD1;
			if (result < 0) {
				result += helper.MOD1;
			}
			return (int) result;
		}

		public long getLongHash(int l, int r) {
			long res;
			{
				long result = val1[r + 1] - val1[l] * 1L
						* helper.pow1[r - l + 1];
				result %= helper.MOD1;
				if (result < 0) {
					result += helper.MOD1;
				}
				res = result;
			}
			{
				long result = val2[r + 1] - val2[l] * 1L
						* helper.pow2[r - l + 1];
				result %= helper.MOD2;
				if (result < 0) {
					result += helper.MOD2;
				}
				res = (res << 32) ^ result;
			}
			return res;
		}
	}

	private class HashHelper {
		final Random rnd = new Random();
		final int BILLION = (int) 1e9;
		final int MUL = 239;
		final int MOD1 = BigInteger
				.valueOf(BILLION + rnd.nextInt(BILLION / 10))
				.nextProbablePrime().intValue();
		final int MOD2 = BigInteger
				.valueOf(BILLION + rnd.nextInt(BILLION / 10))
				.nextProbablePrime().intValue();
		int[] pow1, pow2;

		public HashHelper(final int n) {
			pow1 = new int[n];
			pow2 = new int[n];
			pow1[0] = pow2[0] = 1;
			for (int i = 1; i < n; i++) {
				pow1[i] = (int) (pow1[i - 1] * 1L * MUL % MOD1);
				pow2[i] = (int) (pow2[i - 1] * 1L * MUL % MOD2);
			}
		}

		StringHash generateHash(String s) {
			return new StringHash(generateIntHash(s, MOD1), generateIntHash(s,
					MOD2), this, s);
		}

		public int compareInt(StringHash s1, int from1, int to1, StringHash s2,
				int from2, int to2) {
			int len = Math.min(to1 - from1, to2 - from2) + 1;
			int l = 0, r = len + 1;
			while (r - l > 1) {
				int mid = (l + r) >>> 1;
				if (s1.getIntHash(from1, from1 + mid - 1) == s2.getIntHash(
						from2, from2 + mid - 1)) {
					l = mid;
				} else {
					r = mid;
				}
			}
			if (l == len) {
				if (to1 - from1 == to2 - from2) {
					return 0;
				}
				return (to1 - from1) - (to2 - from2);
			}
			return s1.s.charAt(from1 + l) - s2.s.charAt(from2 + l);
		}

		public int compareLong(StringHash s1, int from1, int to1,
				StringHash s2, int from2, int to2) {
			int len = Math.min(to1 - from1, to2 - from2) + 1;
			int l = 0, r = len + 1;
			while (r - l > 1) {
				int mid = (l + r) >>> 1;
				if (s1.getLongHash(from1, from1 + mid - 1) == s2.getLongHash(
						from2, from2 + mid - 1)) {
					l = mid;
				} else {
					r = mid;
				}
			}
			if (l == len) {
				if (to1 - from1 == to2 - from2) {
					return 0;
				}
				return (to1 - from1) - (to2 - from2);
			}
			return s1.s.charAt(from1 + l) - s2.s.charAt(from2 + l);
		}

		private int[] generateIntHash(String s, int MOD) {
			int[] result = new int[s.length() + 1];
			for (int i = 0; i < s.length(); i++) {
				result[i + 1] = (int) ((result[i] * 1L * MUL + s.charAt(i)) % MOD);
			}
			return result;
		}
	}

	void solve() {
		String s = in.next();
		int n = s.length();
		s = s + s;
		HashHelper helper = new HashHelper(s.length() + 1);
		StringHash hash = helper.generateHash(s);
		int[] bal = new int[n + n - 1];
		for (int i = 0; i < n + n - 1; i++) {
			if (s.charAt(i) == '(') {
				bal[i]++;
			} else {
				bal[i]--;
			}
			if (i > 0) {
				bal[i] += bal[i - 1];
			}
		}
		int cur = s.length() - 1;
		int[] balanceChange = new int[n];
		int[] qPos = new int[n + n];
		int[] qValue = new int[n + n];
		int qSz = 0, qFrom = 0;
		for (int pos = n - 1; pos >= 0; pos--) {
			while (cur != pos) {
				cur--;
				int value = bal[cur];
				while (qSz > qFrom && qValue[qSz - 1] >= value) {
					qSz--;
				}
				qValue[qSz] = value;
				qPos[qSz] = cur;
				qSz++;
			}
			while (qPos[qFrom] >= pos + n) {
				qFrom++;
			}
			int prevBalance = pos > 0 ? bal[pos - 1] : 0;
			balanceChange[pos] = qValue[qFrom] - prevBalance;
		}
		int cntOpen = 0;
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == '(') {
				cntOpen++;
			} else {
				cntOpen--;
			}
		}
		int maxBalanceChange = 0;
		if (cntOpen < 0) {
			maxBalanceChange = cntOpen;
		}
		int bestCandidate = -1;
		for (int i = 0; i < n; i++) {
			if (balanceChange[i] >= maxBalanceChange) {
				if (bestCandidate != -1) {
					if (helper.compareInt(hash, i, i + n - 1, hash,
							bestCandidate, bestCandidate + n - 1) >= 0) {
						continue;
					}
				}
				bestCandidate = i;
			}
		}
		if (bestCandidate < 0) {
			throw new AssertionError();
		}
		for (int i = 0; i < -cntOpen; i++) {
			out.print("(");
		}
		for (int i = 0; i < n; i++) {
			out.print(s.charAt(i + bestCandidate));
		}
		for (int i = 0; i < cntOpen; i++) {
			out.print(")");
		}
	}

	void run() {
		try {
			in = new FastScanner(new File("A.in"));
			out = new PrintWriter(new File("A.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		new A().runIO();
	}
}