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:
//Created by Aminul on 12/12/2019.

import java.io.*;
import java.util.*;

import static java.lang.Math.*;

public class F {
    static int n, m, dp[][][];
    static char brackets[] = {'(', ')'}, a[], b[];

    public static void main(String[] args) throws Exception {
        new Thread(null ,new Runnable(){
            public void run(){
                try{solveIt();} catch(Exception e){e.printStackTrace(); System.exit(1);}
            }
        },"Main",1<<28).start();
    }
    
    public static void solveIt() throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        a = in.next().toCharArray();
        b = in.next().toCharArray();
        n = a.length;
        m = b.length;

        dp = new int[n + 1][m + 1][250];
        for (int a[][] : dp) for (int b[] : a) Arrays.fill(b, -1);


        int minLen = solve(0, 0, 0);
        StringBuilder result = new StringBuilder();
        getString(0, 0, 0, result);

        pw.println(result.toString());
        pw.close();
    }

    static int solve(int i, int j, int sum) {
        int res = (int) 1e8;
        if (sum >= 250) return res;
        if (i >= n && j >= m) {
            return sum;
        }
        if (dp[i][j][sum] != -1) return dp[i][j][sum];

        for (char bracket : brackets) {
            int newSum = sum + (bracket == '(' ? 1 : -1);
            if (newSum >= 0) {
                if (i < n && j < m && bracket == a[i] && bracket == b[j]) {
                    res = min(res, 1 + solve(i + 1, j + 1, newSum));
                } else if (i < n && bracket == a[i]) {
                    res = min(res, 1 + solve(i + 1, j, newSum));
                } else if (j < m && bracket == b[j]) {
                    res = min(res, 1 + solve(i, j + 1, newSum));
                } else {
                    res = min(res, 1 + solve(i, j, newSum));
                }
            }
        }
        return dp[i][j][sum] = res;
    }

    static void getString(int i, int j, int sum, StringBuilder sb) {
        if (sum >= 250) return;
        if (i >= n && j >= m) {
            while (sum > 0) {
                sb.append(")");
                sum--;
            }
            return;
        }
        int minVal = solve(i, j, sum);
        for (char bracket : brackets) {
            int newSum = sum + (bracket == '(' ? 1 : -1);
            if (newSum >= 0) {
                if (i < n && j < m && bracket == a[i] && bracket == b[j]) {
                    int res = 1 + solve(i + 1, j + 1, newSum);
                    if (res == minVal) {
                        sb.append(bracket);
                        getString(i + 1, j + 1, newSum, sb);
                        return;
                    }
                } else if (i < n && bracket == a[i]) {
                    int res = 1 + solve(i + 1, j, newSum);
                    if (res == minVal) {
                        sb.append(bracket);
                        getString(i + 1, j, newSum, sb);
                        return;
                    }
                } else if (j < m && bracket == b[j]) {
                    int res = 1 + solve(i, j + 1, newSum);
                    if (res == minVal) {
                        sb.append(bracket);
                        getString(i, j + 1, newSum, sb);
                        return;
                    }
                } else {
                    int res = 1 + solve(i, j, newSum);
                    if (res == minVal) {
                        sb.append(bracket);
                        getString(i, j, newSum, sb);
                        return;
                    }
                }
            }
        }
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}