Problem: You are given two bracket sequences (not necessarily regular) s and t consisting only of characters '(' and ')'. You want to construct the shortest regular bracket sequence that contains both given bracket sequences as subsequences (not necessarily contiguous).

Recall what is the regular bracket sequence:

  * () is the regular bracket sequence; 
  * if S is the regular bracket sequence, then (S) is a regular bracket sequence; 
  * if S and T regular bracket sequences, then ST (concatenation of S and T) is a regular bracket sequence. 



Recall that the subsequence of the string s is such string t that can be obtained from s by removing some (possibly, zero) amount of characters. For example, "coder", "force", "cf" and "cores" are subsequences of "codeforces", but "fed" and "z" are not.

Input

The first line of the input contains one bracket sequence s consisting of no more than 200 characters '(' and ')'.

The second line of the input contains one bracket sequence t consisting of no more than 200 characters '(' and ')'.

Output

Print one line — the shortest regular bracket sequence that contains both given bracket sequences as subsequences (not necessarily contiguous). If there are several answers, you can print any.

Examples

Input


(())(()
()))()


Output


(())()()


Input


)
((


Output


(())


Input


)
)))


Output


((()))


Input


())
(()(()(()(


Output


(()()()(()()))

Solution (in JAVA):

Solution:
// javac f.java && java _

import java.io.*;
import java.util.*;

public class f {
	public static void main(String[] args) { new f(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);
	
	int sn, tn, n;
	int oo = 1 << 16;
	char[] s, t;
	int[][][] dp;
	
	f() {
		s = in.next().toCharArray();
		t = in.next().toCharArray();

		sn = s.length;
		tn = t.length;
		n = sn + tn;

		dp = new int[sn + 1][tn + 1][n];
		for (int i = 0; i <= sn; i++)
			for (int j = 0; j <= tn; j++)
				Arrays.fill(dp[i][j], -1);

		int min = dp(0, 0, 0);
		buildback(0, 0, 0, min);
		out.close();
	}

	void buildback(int l, int r, int x, int seek) {
		if (l == sn && r == tn && x == 0) {
			out.println();
			return;
		}
		if (l == sn && r == tn) {
			out.print(")");
			buildback(l, r, x - 1, seek - 1);
			return;
		}
	
		if (l < sn && r < tn) {
			int lx = s[l] == '(' ? 1 : -1;
			int rx = t[r] == '(' ? 1 : -1;

			if (lx == rx && x + lx >= 0) {
				if (dp[l + 1][r + 1][x + lx] == seek - 1) {
					out.print(s[l]);
					buildback(l + 1, r + 1, x + lx, seek - 1);
					return;
				}
			}
			else if (lx == rx) {
				if (dp[l][r][x + 1] == seek - 1)  {
					out.print("(");
					buildback(l, r, x + 1, seek - 1);
					return;
				}
			}

			if (x + lx >= 0) {
				if (dp[l + 1][r][x + lx] == seek - 1) {
					out.print(s[l]);
					buildback(l + 1, r, x + lx, seek - 1);
					return;
				}
			}
			else if (dp[l][r][x + 1] == seek - 1) {
				out.print("(");
				buildback(l, r, x + 1, seek - 1);
				return;
			}

			if (x + rx >= 0) {
				if (dp[l][r + 1][x + rx] == seek - 1) {
					out.print(t[r]);
					buildback(l, r + 1, x + rx, seek - 1);
					return;
				}
			}
			else if (dp[l][r][x + 1] == seek - 1) {
				out.print("(");
				buildback(l, r, x + 1, seek - 1);
				return;
			}
		}
		else if (l < sn) {
			int lx = s[l] == '(' ? 1 : -1;
			if (x + lx >= 0) {
				if (dp[l + 1][r][x + lx] == seek - 1) {
					out.print(s[l]);
					buildback(l + 1, r, x + lx, seek - 1);
					return;
				}
			}
			else if (dp[l][r][x + 1] == seek - 1) {
				out.print("(");
				buildback(l, r, x + 1, seek - 1);
				return;
			}
		}
		else if (r < tn) {
			int rx = t[r] == '(' ? 1 : -1;
			if (x + rx >= 0) {
				if (dp[l][r + 1][x + rx] == seek - 1) {
					out.print(t[r]);
					buildback(l, r + 1, x + rx, seek - 1);
					return;
				}
			}
			else if (dp[l][r][x + 1] == seek - 1) {
				out.print("(");
				buildback(l, r, x + 1, seek - 1);
				return;
			}
		}
	}
	
	int dp(int l, int r, int x) {
		if (x >= n) return oo;
		if (l == sn && r == tn && x == 0) return dp[l][r][x] = 0;
		if (l == sn && r == tn) return dp[l][r][x] =1 + dp(l, r, x - 1);
		if (dp[l][r][x] != -1) return dp[l][r][x];
	
		int ans = oo;
		if (l < sn && r < tn) {
			int lx = s[l] == '(' ? 1 : -1;
			int rx = t[r] == '(' ? 1 : -1;

			if (lx == rx && x + lx >= 0) ans = min(ans, 1 + dp(l + 1, r + 1, x + lx));
			else if (lx == rx) ans = min(ans, 1 + dp(l, r, x + 1));

			if (x + lx >= 0) ans = min(ans, 1 + dp(l + 1, r, x + lx));
			else ans = min(ans, 1 + dp(l, r, x + 1));

			if (x + rx >= 0) ans = min(ans, 1 + dp(l, r + 1, x + rx));
			else ans = min(ans, 1 + dp(l, r, x + 1));
		}
		else if (l < sn) {
			int lx = s[l] == '(' ? 1 : -1;

			if (x + lx >= 0) ans = min(ans, 1 + dp(l + 1, r, x + lx));
			else ans = min(ans, 1 + dp(l, r, x + 1));
		}
		else if (r < tn) {
			int rx = t[r] == '(' ? 1 : -1;

			if (x + rx >= 0) ans = min(ans, 1 + dp(l, r + 1, x + rx));
			else ans = min(ans, 1 + dp(l, r, x + 1));
		}

		return dp[l][r][x] = ans;
	}

	int min(int a, int b) { if (a < b) return a; return b; }	
	int max(int a, int b) { if (a > b) return a; return b; }	
	long min(long a, long b) { if (a < b) return a; return b; }	
	long max(long a, long b) { if (a > b) return a; return b; }	

	boolean z(int x) { if (x == 0) return true; return false; }
	boolean z(long x) { if (x == 0) return true; return false; }
	
	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}