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

public class F {

	private static Scanner in;
	private static String s;
	private static String t;
	private static int[][][] dp;
	
	public static void main(String[] args) {
		in = new Scanner(System.in);
		s = in.next();
		t = in.next();
		int n = s.length();
		int m = t.length();
		dp = new int[n+1][m+1][n+m+2];
		for(int i=0; i<dp.length; i++) {
			for(int j=0; j<dp[0].length; j++) {
				Arrays.fill(dp[i][j], -1);
			}
		}
		int i = 0;
		int j = 0;
		int open = 0;
		StringBuilder sb = new StringBuilder();
		
		while(i!=n || j!=m) {
			int count1 = (i<s.length() && s.charAt(i)==')'?1:0);
			int count2 = (j<t.length() && t.charAt(j)==')'?1:0);
//			if (count1+count2!=0)
			if (solve(i, j, open)==1+solve(i+count1, j+count2, open-1)) {
				sb.append(')');
				i+=count1;
				j+=count2;
				open--;
			}
			count1 = (i<s.length() && s.charAt(i)=='('?1:0);
			count2 = (j<t.length() && t.charAt(j)=='('?1:0);
//			if (count1+count2!=0)
			if (solve(i, j, open)==1+solve(i+count1, j+count2, open+1)) {
				sb.append('(');
				i+=count1;
				j+=count2;
				open++;
			}
		}
		for(int x=0; x<open; x++) {
			sb.append(')');
		}
//		System.out.println(solve(0, 0, 0));
		System.out.println(sb.toString());
	}
	
	private static int solve(int i, int j, int open) {
		if (open>s.length()+t.length()) return (int)1e9;
//		System.out.println(i+" "+j+" "+open);
		if (open<0) return (int)1e9;
		if (i==s.length() && j==t.length()) {
			return open;
		}
		
		if (dp[i][j][open]!=-1) return dp[i][j][open];
		
		int ans = (int)1e9;

		int count1 = (i<s.length() && s.charAt(i)==')'?1:0);
		int count2 = (j<t.length() && t.charAt(j)==')'?1:0);
//		if (count1+count2!=0)
		ans = Math.min(ans, 1+solve(i+count1, j+count2, open-1));
		count1 = (i<s.length() && s.charAt(i)=='('?1:0);
		count2 = (j<t.length() && t.charAt(j)=='('?1:0);
//		if (count1+count2!=0)
		ans = Math.min(ans, 1+solve(i+count1, j+count2, open+1));
		
		return dp[i][j][open]=ans;
		
	}

}