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 {
      static class pair implements Comparable<pair>{
        int x;
        int y;
        public pair(int x, int y){
            this.x=x;
            this.y=y;
        }
        public int compareTo(pair p){
            return (x-p.x==0)?y-p.y:x-p.x;
        }}
     static char[] a,b;
     static int [][][]dp;
    static StringBuilder str;
     public static int solve( int i, int j , int need){
         if(i==a.length&&j==b.length&&need==0) return 0;
         if(need>=500) return (int) 1e9;
         if(dp[i][j][need]==-2) return (int)1e9;
         if(dp[i][j][need]!=-1) return dp[i][j][need];
         dp[i][j][need]= -2;
             int take = 1+solve((i==a.length)?i:(a[i]=='(')?Math.min(i+1,a.length):i,(j==b.length)?j:(b[j]=='(')?Math.min(j+1,b.length):j,need +1);
             int leave =(need>0)? 1+solve((i==a.length)?i:(a[i]==')')?Math.min(i+1,a.length):i,(j==b.length)?j:(b[j]==')')?Math.min(j+1,b.length):j,need -1):Integer.MAX_VALUE;
        return dp[i][j][need] = Math.min(take,leave);
     }
      public static void trace( int i, int j , int need){
         if(i==a.length&&j==b.length&&need==0) return;
         int req = solve(i,j,need);
         if( 1+dp[(i==a.length)?i:(a[i]=='(')?Math.min(i+1,a.length):i][(j==b.length)?j:(b[j]=='(')?Math.min(j+1,b.length):j][need +1]==dp[i][j][need]){
            str.append("(");
             trace((i==a.length)?i:(a[i]=='(')?Math.min(i+1,a.length):i,(j==b.length)?j:(b[j]=='(')?Math.min(j+1,b.length):j,need +1);
             return;
         }else{
             str.append(")"); 
         trace((i==a.length)?i:(a[i]==')')?Math.min(i+1,a.length):i,(j==b.length)?j:(b[j]==')')?Math.min(j+1,b.length):j,need -1);}
     }
  public static void main(String[] args) throws IOException,InterruptedException{
	BufferedReader	 br = new BufferedReader(new InputStreamReader(System.in));
	PrintWriter out = new PrintWriter(System.out);
     	// String s = br.readLine();
        // char[] arr=s.toCharArray();
        // ArrayList<Integer> arrl = new ArrayList<Integer>(); 
        // TreeSet<Integer> ts1 = new TreeSet<Integer>(); 
        // HashSet<Integer> h = new HashSet<Integer>(); 
        // HashMap<Integer, Integer> map= new HashMap<>(); 
        // PriorityQueue<String> pQueue = new PriorityQueue<String>(); 
        // LinkedList<String> object = new LinkedList<String>(); 
        // StringBuilder str = new StringBuilder(); 
 	  //  StringTokenizer   st = new StringTokenizer(br.readLine());
 	  // 	  n = Integer.parseInt(st.nextToken());
 	  String s = br.readLine();
 	  a = s.toCharArray(); 
 	  String t = br.readLine();
 	  b = t.toCharArray();
 	   	dp = new int[201][201][500];
 	   	for(int i=0; i<201; i++) 	  
 	   	for(int j=0; j<201; j++) 	  
 	   	  Arrays.fill(dp[i][j],-1);
 	   int ans =solve(0,0,0);
 	    str = new StringBuilder(); 
 	   trace(0,0,0);
 	   out.print(str);
 	   	  out.flush();
	}
    
}