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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Andy Phan
 */
public class f {
    public static void main(String[] args) {
        FS in = new FS(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
        char[] s = (in.next()+"%").toCharArray();
        char[] t = (in.next()+"%").toCharArray();
        
        int sn = s.length-1;
        int tn = t.length-1;
        int mn = sn+tn;
        int[][][] dp = new int[sn+1][tn+1][mn+1];
        for(int i = 0; i <= mn; i++) dp[sn][tn][i] = i;
        for(int i = sn; i >= 0; i--) {
            for(int j = tn; j >= 0; j--) {
                if(i == sn && j == tn) continue;
                for(int k = mn; k >= 0; k--) {
                    dp[i][j][k] = 5*mn;
                    if(k != mn) {
                        dp[i][j][k] = Math.min(dp[i][j][k], dp[i+(s[i] == '(' ? 1 : 0)][j+(t[j] == '(' ? 1 : 0)][k+1]+1);
                    }
                    if((s[i] == ')' || t[j] == ')') && k != 0) {
                        dp[i][j][k] = Math.min(dp[i][j][k], dp[i+(s[i] == ')' ? 1 : 0)][j+(t[j] == ')' ? 1 : 0)][k-1]+1);
                    }
                }
            }
        }
        int i = 0;
        int j = 0;
        int k = 0;
        while(i < sn || j < tn) {
            if(k != mn) {
                if(dp[i][j][k] == dp[i+(s[i] == '(' ? 1 : 0)][j+(t[j] == '(' ? 1 : 0)][k+1]+1) {
                    i = i+(s[i] == '(' ? 1 : 0);
                    j = j+(t[j] == '(' ? 1 : 0);
                    k = k+1;
                    out.print('(');
                    continue;
                }
            }
            i = i+(s[i] == ')' ? 1 : 0);
            j = j+(t[j] == ')' ? 1 : 0);
            k = k-1;
            out.print(')');
        }
        while(k-->0) out.print(')');
        out.println();
        
        out.close();
    }
    
    static class FS {

        BufferedReader in;
        StringTokenizer token;
        
        public FS(InputStream str) {
            in = new BufferedReader(new InputStreamReader(str));
        }
        
        public String next() {
            if (token == null || !token.hasMoreElements()) {
                try {
                    token = new StringTokenizer(in.readLine());
                } catch (IOException ex) {
                }
                return next();
            }
            return token.nextToken();
        }
        
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}