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:
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x1272F
   {
      static int[][][] dp;
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         String input1 = infile.readLine();
         String input2 = infile.readLine();
         char[] a = input1.toCharArray();
         char[] b = input2.toCharArray();
         int N = a.length;
         int M = b.length;
         dp = new int[N+M+5][N+1][M+1];
         //I have a brain tumor
         //bal, # of processed chars for each string
         Node[][][] parent = new Node[N+M+5][N+1][M+1];
         for(int i=0; i <= N+M; i++)
            for(int a1=0; a1 <= N; a1++)
               for(int b1=0; b1 <= M; b1++)
                  dp[i][a1][b1] = 6969;
         dp[0][0][0] = 0;
         for(int i=0; i <= N; i++)   
            for(int j=0; j <= M; j++)
               for(int bal=0; bal <= N+M; bal++)
                  if(dp[bal][i][j] != 6969)
                  {
                     int x = N;
                     if(i < N)
                        x = i+Math.max(0, val(a[i]));
                     int y = M;
                     if(j < M)
                        y = j+Math.max(0, val(b[j]));
                     if(dp[bal+1][x][y] > dp[bal][i][j]+1)
                     {
                        dp[bal+1][x][y] = dp[bal][i][j]+1;
                        parent[bal+1][x][y] = new Node(bal,i,j);
                     }
                     x = N;
                     if(i < N)
                        x = i+Math.max(0, -1*val(a[i]));
                     y = M;
                     if(j < M)
                        y = j+Math.max(0, -1*val(b[j]));
                     if(bal > 0 && dp[bal-1][x][y] > dp[bal][i][j]+1)
                     {
                        dp[bal-1][x][y] = dp[bal][i][j]+1;
                        parent[bal-1][x][y] = new Node(bal,i,j);
                     }
                  }
         int curr = 0;
         for(int i=1; i <= N+M; i++)
            if(dp[i][N][M]+i < dp[curr][N][M]+curr)
               curr = i;
         int d = curr;
         int e = N;
         int f = M;
         StringBuilder sb = new StringBuilder();
         for(int i=0; i < curr; i++)
            sb.append(")");
         while(parent[d][e][f] != null)
         {
            Node par = parent[d][e][f];
            if(par.bal < d)
               sb.append("(");
            else
               sb.append(")");
            d = par.bal;
            e = par.x;
            f = par.y;
         }
         //System.out.println(dp[curr][N][M]+curr);
         System.out.println(sb.reverse());
      }
      public static int val(char c)
      {
         if(c == '(')
            return 1;
         return -1;
      }
   }
   class Node
   {
      public int bal;
      public int x;
      public int y;
      
      public Node(int a, int b, int c)
      {
         bal = a;
         x = b;
         y = c;
      }
   }