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.*;
import java.lang.reflect.Array;
import java.util.*;

import static java.lang.Math.*;

public class Main {
    int N = 202;
    int INF = Integer.MAX_VALUE / 2;

    void run() throws IOException {
        char[] a = next().toCharArray();
        char[] b = next().toCharArray();
        int n = a.length;
        int m = b.length;
        point[][][] p = new point[n + 1][m + 1][2 * N];
        int[][][] dp = new int[n + 1][m + 1][2 * N];
        for (int i = 0; i <= n; ++i) {
            for (int j = 0; j <= m; ++j) {
                for (int bal = 0; bal < 2 * N; ++bal) {
                    dp[i][j][bal] = INF;
                }
            }
        }

        dp[0][0][0] = 0;
        for (int i = 0; i <= n; ++i) {
            for (int j = 0; j <= m; ++j) {
                for (int bal = 0; bal < 2 * N; ++bal) {
                    if (dp[i][j][bal] == INF) continue;

                    int nxti = i + (i < n && a[i] == '(' ? 1 : 0);
                    int nxtj = j + (j < m && b[j] == '(' ? 1 : 0);
                    if (bal + 1 < 2 * N && dp[nxti][nxtj][bal + 1] > dp[i][j][bal] + 1) {
                        dp[nxti][nxtj][bal + 1] = dp[i][j][bal] + 1;
                        p[nxti][nxtj][bal + 1] = new point(i, j, bal, '(');
                    }

                    nxti = i + (i < n && a[i] == ')' ? 1 : 0);
                    nxtj = j + (j < m && b[j] == ')' ? 1 : 0);
                    if (bal > 0 && dp[nxti][nxtj][bal - 1] > dp[i][j][bal] + 1) {
                        dp[nxti][nxtj][bal - 1] = dp[i][j][bal] + 1;
                        p[nxti][nxtj][bal - 1] = new point(i, j, bal, ')');
                    }
                }
            }
        }

        int ci = n, cj = m, cbal = 0;
        for (int bal = 0; bal < 2 * N; ++bal) {
            if (dp[n][m][bal] + bal < dp[n][m][cbal] + cbal) {
                cbal = bal;
            }
        }
        String res = "";
        for (int i = 0; i < cbal; i++) {
            res += ')';
        }
        while (ci > 0 || cj > 0 || cbal != 0) {
            int nci = p[ci][cj][cbal].a;
            int ncj = p[ci][cj][cbal].b;
            int ncbal = p[ci][cj][cbal].c;
            res += p[ci][cj][cbal].d;
            ci = nci;
            cj = ncj;
            cbal = ncbal;
        }
        char[] x = res.toCharArray();
        int l = 0;
        int r = x.length - 1;
        while (l < r) {
            char s = x[l];
            x[l] = x[r];
            x[r] = s;
            l++;
            r--;
        }
        for (int i = 0; i < x.length; i++) {
            pw.print(x[i]);
        }
        pw.close();
    }

    class point {
        int a, b, c;
        char d;

        public point(int a, int b, int c, char d) {
            this.a = a;
            this.b = b;
            this.c = c;
            this.d = d;
        }
    }

    long mod = (long) 1e9 + 7;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    //BufferedReader br = new BufferedReader(new FileReader("qual.in"));

    StringTokenizer st = new StringTokenizer("");
    PrintWriter pw = new PrintWriter(System.out);
    //PrintWriter pw = new PrintWriter("qual.out");

    int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    String next() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public Main() throws FileNotFoundException {
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}