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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class P1272F
{
	static int oo = Integer.MAX_VALUE/2;
	static int[][][] dp;
	static char[] a, b;
	public static void main(String[] args)
	{
		FastScanner scan = new FastScanner();
		a = scan.next().toCharArray();
		b = scan.next().toCharArray();
		dp = new int[401][a.length+1][b.length+1];
		for (int[][] i : dp)
			for (int[] j : i)
				Arrays.fill(j, -1);
		int ans = go(0, 0, 0);
		StringBuilder sb = new StringBuilder();
		int ia = 0, ib = 0;
		int open = 0;
		for (int i = 0; i < ans; i++)
		{
			boolean aopen = ia < a.length ? a[ia] == '(' : false;
			boolean bopen = ib < b.length ? b[ib] == '(' : false;
			int anso = go(open+1, ia + (aopen ? 1 : 0), ib + (bopen ? 1 : 0));
			int ansc = go(open-1, ia + (aopen ? 0 : 1), ib + (bopen ? 0 : 1));
			if (anso <= ansc)
			{
				sb.append("(");
				open++;
				if (aopen)
					ia++;
				if (bopen)
					ib++;
			}
			else
			{
				sb.append(")");
				open--;
				if (!aopen)
					ia++;
				if (!bopen)
					ib++;
			}
		}
		System.out.println(sb);
	}
	private static int go(int open, int ia, int ib)
	{
		ia = Math.min(ia, a.length);
		ib = Math.min(ib, b.length);
		if (open < 0)
			return oo;
		if (ia >= a.length && ib >= b.length)
			return open;
		if (open >= dp.length)
			return oo;
		if (dp[open][ia][ib] >= 0)
			return dp[open][ia][ib];
		
		int ans = Integer.MAX_VALUE;
		boolean aopen = ia < a.length ? a[ia] == '(' : false;
		boolean bopen = ib < b.length ? b[ib] == '(' : false;
		// (
		ans = Math.min(ans, 1 + go(open+1, ia + (aopen ? 1 : 0), ib + (bopen ? 1 : 0)));
		// )
		ans = Math.min(ans, 1 + go(open-1, ia + (aopen ? 0 : 1), ib + (bopen ? 0 : 1)));
		return dp[open][ia][ib] = ans;
	}
	static class FastScanner
	{
		BufferedReader br;
		StringTokenizer st;

		public FastScanner()
		{
			try
			{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e)
			{
				e.printStackTrace();
			}
		}

		public String next()
		{
			if (st.hasMoreTokens())
				return st.nextToken();
			try
			{
				st = new StringTokenizer(br.readLine());
			} catch (Exception e)
			{
				e.printStackTrace();
			}
			return st.nextToken();
		}

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

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

		public String nextLine()
		{
			String line = "";
			try
			{
				line = br.readLine();
			} catch (Exception e)
			{
				e.printStackTrace();
			}
			return line;
		}
	}
}