You are given a string S of length N consisting of `(` and `)`. Your task is to insert some number of `(` and `)` into S to obtain a correct bracket sequence.
Here, a correct bracket sequence is defined as follows:

* `()` is a correct bracket sequence.
* If X is a correct bracket sequence, the concatenation of `(`, X and `)` in this order is also a correct bracket sequence.
* If X and Y are correct bracket sequences, the concatenation of X and Y in this order is also a correct bracket sequence.
* Every correct bracket sequence can be derived from the rules above.



Find the shortest correct bracket sequence that can be obtained. If there is more than one such sequence, find the lexicographically smallest one.

Constraints

* The length of S is N.
* 1 ≤ N ≤ 100
* S consists of `(` and `)`.

Input

Input is given from Standard Input in the following format:


N
S


Output

Print the lexicographically smallest string among the shortest correct bracket sequences that can be obtained by inserting some number of `(` and `)` into S.

Examples

Input

3
())


Output

(())


Input

6
)))())


Output

(((()))())


Input

8
))))((((


Output

(((())))(((())))
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import java.util.stream.Collectors;

public class Main {

	public static void main(String args[]) {
		FastScanner cin = new FastScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(FastScanner cin, PrintWriter cout) {
		assert solve(8, "))))((((").equals("(((())))(((())))");
		assert solve(3, "())").equals("(())");
		assert solve(6, ")))())").equals("(((()))())");
		int n = cin.nextInt();
		String s = cin.next();
		String ans = solve(n, s);
		cout.println(ans);
	}

	private static String solve(int n, String s) {
		int[] dep = new int[s.length() + 1];
		int d = 0;
		dep[0] = d;
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c == '(') {
				d += 1;
			} else if (c == ')') {
				d -= 1;
			} else {
				throw new IllegalArgumentException();
			}
			dep[i + 1] = d;
		}
		int mind = Arrays.stream(dep).min().getAsInt();
		List<Integer> modDep = Arrays.stream(dep).map(x -> x - mind).boxed().collect(Collectors.toList());
		modDep.add(0, 0);
		modDep.add(0);

		StringBuilder ans = new StringBuilder();
		for (int i = 1; i < modDep.size(); i++) {
			int prev = modDep.get(i - 1);
			int cur = modDep.get(i);
			for (int j = 0; j < cur - prev; j++)
				ans.append('(');
			for (int j = 0; j < prev - cur; j++)
				ans.append(')');
		}
		return ans.toString();
	}

	/**
	 * How to read input in Java — tutorial <br />
	 * By Flatfoot<br />
	 * http://codeforces.com/blog/entry/7018
	 */
	static class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new IllegalStateException(e);
				}
			return st.nextToken();
		}

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				throw new IllegalStateException(e);
			}
			return str;
		}

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

}
