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:


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

public class F1272 {

	static char[] a, b;

	static int[][][] dp;

	public static int dp(int i, int j, int cnt) {
		int ans = (int) 1e9;
		if (i == -1 && j == -1 && cnt == 0)
			return 0;
		if (cnt > 800)
			return (int) 1e9;
		if (dp[i + 1][j + 1][cnt] != -1)
			return dp[i + 1][j + 1][cnt];
		if (cnt > 0) {
			char c = '(';
			int nxti = i == -1 ? -1 : c == a[i] ? i - 1 : i;
			int nxtj = j == -1 ? -1 : c == b[j] ? j - 1 : j;
			nxti = Math.max(nxti, -1);
			nxtj = Math.max(nxtj, -1);
			ans = Math.min(ans, 1 + dp(nxti, nxtj, cnt - 1));
		}
		if (i != -1 || j != -1) {
			char c = ')';
			int nxti = i == -1 ? -1 : c == a[i] ? i - 1 : i;
			int nxtj = j == -1 ? -1 : c == b[j] ? j - 1 : j;
			ans = Math.min(ans, 1 + dp(nxti, nxtj, cnt + 1));
		}
		return dp[i + 1][j + 1][cnt] = ans;
	}

	static Stack<Character> st;

	public static void trace(int i, int j, int cnt) {
//		System.out.println(i+" "+j+" "+cnt);
		if (i == -1 && j == -1 && cnt == 0)
			return;
		boolean bb = false;
		if (cnt > 0) {
			char c = '(';
			int nxti = i == -1 ? -1 : c == a[i] ? i - 1 : i;
			int nxtj = j == -1 ? -1 : c == b[j] ? j - 1 : j;

			if (dp(i, j, cnt) == 1 + dp(nxti, nxtj, cnt - 1)) {
				st.add(c);
				bb = true;
				trace(nxti, nxtj, cnt - 1);
			}
		}
		if (!bb) {
			char c = ')';
			int nxti = i == -1 ? -1 : c == a[i] ? i - 1 : i;
			int nxtj = j == -1 ? -1 : c == b[j] ? j - 1 : j;
			if (dp(i, j, cnt) == 1 + dp(nxti, nxtj, cnt + 1)) {
				st.add(c);
				trace(nxti, nxtj, cnt + 1);
			}
		}

	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		a = sc.next().toCharArray();
		b = sc.next().toCharArray();
		dp = new int[a.length + 1][b.length + 1][1000];
		for (int[][] x : dp) {
			for (int[] y : x)
				Arrays.fill(y, -1);
		}
		st = new Stack<Character>();
//		pw.println(dp(a.length - 1, b.length - 1, 0));
		trace(a.length - 1, b.length - 1, 0);

		while (!st.isEmpty()) {
			pw.print(st.pop());
		}
		pw.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}