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.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Code {
	static int[][][] dp = new int[250][250][500];
	static String[] bracket = new String[405];
	static char[]res = new char[500];
	public static int f(String s1,String s2,int a,int b,int c) {
		if(c>300)return dp[a][b][c] =c;
		if(a==s1.length()&&b==s2.length()) {
			//System.out.println(bracket[c]);
			return dp[a][b][c] = c;
		}
		if(dp[a][b][c]!=0)return dp[a][b][c];
		if(a<s1.length()&&b<s2.length()) {
			int t2=0;
			if(c>0) {
				t2 = 1 + (f(s1,s2,(s1.charAt(a)==')')?a+1:a,(s2.charAt(b)==')')?b+1:b,c-1));
			}
			int t1 = 1+(f(s1,s2,(s1.charAt(a)=='(')?a+1:a,(s2.charAt(b)=='(')?b+1:b,c+1));
			if(t2==0)t2= t1;
			if(t1<t2) {
				return dp[a][b][c] = t1;
			}
			else {

				return dp[a][b][c] = t2;
			}
		}else if(a<s1.length()&&b>=s2.length()) {
			int t2 = 0;
			if(c>0) {
				
				t2 = 1+(f(s1,s2,(s1.charAt(a)==')')?a+1:a,b,c-1));
			}
			int t1 =1+(f(s1,s2,(s1.charAt(a)=='(')?a+1:a,b,c+1));
			if(t2==0)
				t2=t1;
			
			if(t1<t2) {
				return dp[a][b][c] =t1;
				
			}
			else {
				return dp[a][b][c] =t2;
			}
		}else if(a>=s1.length()&&b<s2.length()) {
			int t2 = 0;
			if(c>0) {
				t2 =1+(f(s1,s2,a,(s2.charAt(b)==')')?b+1:b,c-1));
			}
			int t1 =1+(f(s1,s2,a,(s2.charAt(b)=='(')?b+1:b,c+1));
			if(t2==0)
				t2=t1;
			
			if(t1<t2) {
				return dp[a][b][c] =t1;
			}else {
				return dp[a][b][c] =t2;
			}
		}
		return dp[a][b][c] = 0;
	}
	public static void Tracedp(String s1,String s2,int a,int b,int c) {
		if(c>300)return ;
		if(a==s1.length()&&b==s2.length()) {
			System.out.println(bracket[c]);
			return;
		}
		if(a<s1.length()&&b<s2.length()) {
			int t2=0;
			if(c>0) {
				t2 = 1 + dp[(s1.charAt(a)==')')?a+1:a][(s2.charAt(b)==')')?b+1:b][c-1];
			}
			int t1 = 1 + dp[(s1.charAt(a)=='(')?a+1:a][(s2.charAt(b)=='(')?b+1:b][c+1];
			if(dp[a][b][c]==t1) {
				System.out.print("(");
				Tracedp(s1, s2, (s1.charAt(a)=='(')?a+1:a, (s2.charAt(b)=='(')?b+1:b, c+1);
			}
			else {
				System.out.print(")");
				Tracedp(s1, s2, (s1.charAt(a)==')')?a+1:a, (s2.charAt(b)==')')?b+1:b, c-1);
			}
		}else if(a<s1.length()&&b>=s2.length()) {
			int t2 = 0;
			if(c>0) {
				
				t2 = 1+dp[(s1.charAt(a)==')')?a+1:a][b][c-1];
			}
			int t1 =1+dp[(s1.charAt(a)=='(')?a+1:a][b][c+1];
			
			if(dp[a][b][c]==t1) {
				System.out.print("(");
				Tracedp(s1, s2, (s1.charAt(a)=='(')?a+1:a,b, c+1);
			}
			else {
				System.out.print(")");
				Tracedp(s1, s2, (s1.charAt(a)==')')?a+1:a, b, c-1);
			}
		}else if(a>=s1.length()&&b<s2.length()) {
			int t2 = 0;
			if(c>0) {
				t2 =1+dp[a][(s2.charAt(b)==')')?b+1:b][c-1];
			}
			int t1 =1+dp[a][(s2.charAt(b)=='(')?b+1:b][c+1];
			
			if(dp[a][b][c]==t1) {
				System.out.print("(");
				Tracedp(s1, s2, a, (s2.charAt(b)=='(')?b+1:b, c+1);
			}else {
				System.out.print(")");
				Tracedp(s1, s2, a, (s2.charAt(b)==')')?b+1:b, c-1);
			}
		}
	}
	public static void main(String[] args) throws IOException{
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s1 = sc.next();
		String s2 = sc.next();

		bracket[0] = "";
		for(int i=1;i<bracket.length;i++) {
			bracket[i] = bracket[i-1]+")";
		}
		int t =f(s1,s2,0,0,0);
		//System.out.println(t);
		Tracedp(s1, s2, 0, 0, 0);
		pw.flush();
		pw.close();
	}
}
class A1 implements Comparable<A1>{
	long a;long b;long value;
	public A1(long f,long g) {
		a = f;
		b = g;
		value = a*b;
	}
	@Override
	public int compareTo(A1 o) {
		// TODO Auto-generated method stub
		if(value>o.value)return 1;
		if(value<o.value)return -1;
		return 0;
	}
}
class Scanner {
    StringTokenizer st;
    BufferedReader br;

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

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

    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();
        
    }
}