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.*;

public class Main {
    public static void main(String args[]) {new Main().run();}

    FastReader in = new FastReader();
    PrintWriter out = new PrintWriter(System.out);
    void run(){
        work();
        out.flush();
    }
    long mod=1000000007;
    long gcd(long a,long b) {
        return a==0?b:gcd(b%a,a);
    }
    final int inf=Integer.MAX_VALUE/2;
    void work() {
        String s=ns(),t=ns();
        int n=s.length(),m=t.length();
        StringBuilder sb=new StringBuilder();
        int[][][] dp=new int[n+1][m+1][201];
        for(int[][] d1:dp){
            for(int[] d2:d1){
                Arrays.fill(d2,inf);
            }
        }
        int[][][] rec=new int[n+1][m+1][201];
        for(int i=0;i<=n;i++){
            for(int j=0;j<=m;j++){
                for(int k=0;k<=200;k++){
                    if(i==0&&j==0){
                        dp[i][j][k]=k;
                    }else if(i==0){
                        char ch=t.charAt(j-1);
                        if(ch=='('){
                            if(k>0){
                                dp[i][j][k]=dp[i][j-1][k-1]+1;
                                rec[i][j][k]=k-1+1000*(j-1)+1000000*i;;
                            }
                        }else{
                            if(k<200){
                                dp[i][j][k]=dp[i][j-1][k+1]+1;
                                rec[i][j][k]=k+1+1000*(j-1)+1000000*i;;
                            }
                        }
                    }else if(j==0){
                        char ch=s.charAt(i-1);
                        if(ch=='('){
                            if(k>0){
                                dp[i][j][k]=dp[i-1][j][k-1]+1;
                                rec[i][j][k]=k-1+1000*j+1000000*(i-1);
                            }
                        }else{
                            if(k<200){
                                dp[i][j][k]=dp[i-1][j][k+1]+1;
                                rec[i][j][k]=k+1+1000*j+1000000*(i-1);;
                            }
                        }
                    }else{
                        char ch1=s.charAt(i-1);
                        char ch2=t.charAt(j-1);
                        if(ch1=='('&&ch2=='('){
                            if(k>0){
                                dp[i][j][k]=dp[i-1][j-1][k-1]+1;
                                rec[i][j][k]=k-1+1000*(j-1)+1000000*(i-1);
                            }
                        }else if(ch1==')'&&ch2==')'){
                            if(k<200){
                                dp[i][j][k]=dp[i-1][j-1][k+1]+1;
                                rec[i][j][k]=k+1+1000*(j-1)+1000000*(i-1);;
                            }
                        }else{
                            if(ch1=='('){
                                if(k>0){
                                    dp[i][j][k]=dp[i-1][j][k-1]+1;
                                    rec[i][j][k]=k-1+1000*j+1000000*(i-1);
                                }
                            }
                            if(ch1==')'){
                                if(k<200){
                                    dp[i][j][k]=dp[i-1][j][k+1]+1;
                                    rec[i][j][k]=k+1+1000*j+1000000*(i-1);
                                }
                            }
                            if(ch2=='('){
                                if(k>0&&dp[i][j][k]>dp[i][j-1][k-1]+1){
                                    dp[i][j][k]=dp[i][j-1][k-1]+1;
                                    rec[i][j][k]=k-1+1000*(j-1)+1000000*i;
                                }
                            }
                            if(ch2==')'){
                                if(k<200&&dp[i][j][k]>dp[i][j-1][k+1]+1){
                                    dp[i][j][k]=dp[i][j-1][k+1]+1;
                                    rec[i][j][k]=k+1+1000*(j-1)+1000000*i;
                                }
                            }
                        }
                    }
                }
            }
        }
        int min=inf,v=0;
        for(int i=0;i<=200;i++){
            if(dp[n][m][i]+i<min){//已经占用dp[n][m][i]个括号，还需要i个‘）’
                min=dp[n][m][i]+i;
                v=i;
            }
        }
        for(int i=0;i<v;i++)sb.append(')');
        int i=n,j=m;
        while(i!=0||j!=0){
            int cur=rec[i][j][v];
            int nv=cur%1000;
            int nj=cur/1000%1000;
            int ni=cur/1000/1000%1000;
            if(ni!=i){
                sb.append(s.charAt(i-1));
            }else if(nj!=j){
                sb.append(t.charAt(j-1));
            }
            i=ni;j=nj;v=nv;
        }
        for(int p=0;p<v;p++){
            sb.append('(');
        }
        out.println(sb.reverse().toString());
    }

    //input
    @SuppressWarnings("unused")
    private ArrayList<Integer>[] ng(int n, int m) {
        ArrayList<Integer>[] graph=(ArrayList<Integer>[])new ArrayList[n];
        for(int i=0;i<n;i++) {
            graph[i]=new ArrayList<>();
        }
        for(int i=1;i<=m;i++) {
            int s=in.nextInt()-1,e=in.nextInt()-1;
            graph[s].add(e);
            graph[e].add(s);
        }
        return graph;
    }

    private ArrayList<long[]>[] ngw(int n, int m) {
        ArrayList<long[]>[] graph=(ArrayList<long[]>[])new ArrayList[n];
        for(int i=0;i<n;i++) {
            graph[i]=new ArrayList<>();
        }
        for(int i=1;i<=m;i++) {
            long s=in.nextLong()-1,e=in.nextLong()-1,w=in.nextLong();
            graph[(int)s].add(new long[] {e,w});
            graph[(int)e].add(new long[] {s,w});
        }
        return graph;
    }

    private int ni() {
        return in.nextInt();
    }

    private long nl() {
        return in.nextLong();
    }

    private String ns() {
        return in.next();
    }

    private long[] na(int n) {
        long[] A=new long[n];
        for(int i=0;i<n;i++) {
            A[i]=in.nextLong();
        }
        return A;
    }
    private int[] nia(int n) {
        int[] A=new int[n];
        for(int i=0;i<n;i++) {
            A[i]=in.nextInt();
        }
        return A;
    }
}

class FastReader
{
    BufferedReader br;
    StringTokenizer st;

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


    public String next()
    {
        while(st==null || !st.hasMoreElements())//回车，空行情况
        {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

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

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