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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FTwoBracketSequences solver = new FTwoBracketSequences();
        solver.solve(1, in, out);
        out.close();
    }

    static class FTwoBracketSequences {
        static char[] first;
        static char[] second;
        static Integer[][][] memo;
        static StringBuilder s = new StringBuilder();

        public static int dp(int i, int j, int k) {
            if (i == first.length && second.length == j)
                return k;
            if (memo[i][j][k] != null)
                return memo[i][j][k];
            if (k == 0) {
                int ans;
                if (first.length > i && j < second.length && first[i] == '(' & second[j] == '(')
                    ans = 1 + dp(i + 1, j + 1, 1);
                else if (i < first.length && first[i] == '(')
                    ans = 1 + dp(i + 1, j, 1);
                else if (j < second.length && second[j] == '(')
                    ans = 1 + dp(i, j + 1, 1);
                else
                    ans = 1 + dp(i, j, 1);
                return memo[i][j][k] = ans;
            } else {
                if (i < first.length && j < second.length && first[i] == second[j]) {
                    int open = first[i] == '(' ? 1 + dp(i + 1, j + 1, k + 1) : 1 + dp(i + 1, j + 1, k - 1);
                    return memo[i][j][k] = open;
                } else {
                    int takeFirst = (int) 1e9, takeSecond = (int) 1e9;
                    if (i < first.length)
                        takeFirst = first[i] == '(' ? 1 + dp(i + 1, j, k + 1) : 1 + dp(i + 1, j, k - 1);
                    if (j < second.length)
                        takeSecond = second[j] == '(' ? 1 + dp(i, j + 1, k + 1) : 1 + dp(i, j + 1, k - 1);
                    return memo[i][j][k] = Math.min(takeFirst, takeSecond);
                }
            }
        }

        public static void trace(int i, int j, int k) {
            if (i == first.length && second.length == j) {
                while (k-- > 0)
                    s.append(')');
                return;
            }
            if (k == 0) {
                s.append('(');
                if (first.length > i && j < second.length && first[i] == '(' & second[j] == '(') {
                    trace(i + 1, j + 1, 1);
                    return;
                } else if (i < first.length && first[i] == '(') {
                    trace(i + 1, j, 1);
                    return;
                } else if (j < second.length && second[j] == '(')
                    trace(i, j + 1, 1);
                else
                    trace(i, j, 1);
            } else {
                int cur = dp(i, j, k);
                if (i < first.length && j < second.length && first[i] == second[j]) {
                    if (first[i] == '(') {
                        s.append('(');
                        trace(i + 1, j + 1, k + 1);
                        return;
                    } else {
                        s.append(')');
                        trace(i + 1, j + 1, k - 1);
                        return;
                    }
                } else {
                    int takeFirst = (int) 1e9, takeSecond = (int) 1e9;
                    if (i < first.length)
                        takeFirst = first[i] == '(' ? 1 + dp(i + 1, j, k + 1) : 1 + dp(i + 1, j, k - 1);
                    if (j < second.length)
                        takeSecond = second[j] == '(' ? 1 + dp(i, j + 1, k + 1) : 1 + dp(i, j + 1, k - 1);
                    if (cur == takeFirst) {
                        if (first[i] == '(') {
                            s.append('(');
                            trace(i + 1, j, k + 1);
                            return;
                        } else {
                            s.append(')');
                            trace(i + 1, j, k - 1);
                            return;
                        }
                    } else {
                        if (second[j] == '(') {
                            s.append('(');
                            trace(i, j + 1, k + 1);
                            return;
                        } else {
                            s.append(')');
                            trace(i, j + 1, k - 1);
                            return;
                        }
                    }
                }
            }
        }

        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            s = new StringBuilder();
            first = sc.next().toCharArray();
            second = sc.next().toCharArray();
            memo = new Integer[201][201][403];
            trace(0, 0, 0);
            pw.println(s.toString());
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

    }
}