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.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    static final int UNCALC = -1, N = 900, INF = (int) 1e9, vis = -2;
    static char[] s, t;
    static int n, m;
    static int[][][] memo;
    static StringBuilder ans;

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        s = sc.next().toCharArray();
        t = sc.next().toCharArray();
        n = s.length;
        m = t.length;
        memo = new int[n + 1][m + 1][N];
        for (int[][] a : memo)
            for (int[] b : a)
                Arrays.fill(b, UNCALC);
        ans = new StringBuilder();
        trace(0,0,0);
        out.println(ans);
        out.flush();
        out.close();
    }

    static void trace(int i, int j, int open) {
        if (i == n && j == m && open == 0) return;
        int best = dp(i, j, open);
        if (1 + dp(getNextS(i, '('), getNextT(j, '('), open + 1) == best) {
            ans.append("(");
            trace(getNextS(i, '('), getNextT(j, '('), open + 1);
            return;
        }
        ans.append(")");
        trace(getNextS(i, ')'), getNextT(j, ')'), open - 1);

    }

    static int dp(int i, int j, int open) {
        if (open >= N) return INF;
        if (i == n && j == m && open == 0) return 0;
        if (memo[i][j][open] == vis) return INF;
        if (memo[i][j][open] != UNCALC) return memo[i][j][open];
        memo[i][j][open] = vis;
        int min = 1 + dp(getNextS(i, '('), getNextT(j, '('), open + 1);
        if (open != 0) min = Math.min(min, 1 + dp(getNextS(i, ')'), getNextT(j, ')'), open - 1));
        return memo[i][j][open] = min;
    }

    static int getNextS(int i, char x) {
        if (i == n) return i;
        return s[i] == x ? (i + 1) : i;
    }

    static int getNextT(int i, char x) {
        if (i == m) return i;
        return t[i] == x ? (i + 1) : i;
    }


    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

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


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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

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

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }


        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}