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 CPP):

Solution:
#include <bits/stdc++.h>
const int N = 1000006;
const int M = 1000 * 1000 * 1000 + 7;
using namespace std;
void debug(string var, int val) { cout << var << " : " << val << endl; }
int gcd(int f, int s) {
  if (s == 0)
    return f;
  else
    return gcd(s, f % s);
}
string s, s1;
int dp[201][201][500];
int calc(int ind, int ind1, int r) {
  if (ind == s.length() && ind1 == s1.length()) return dp[ind][ind1][r] = r;
  int& rem = dp[ind][ind1][r];
  if (rem != -1) return rem;
  rem = 1e9;
  if (ind == s.length()) {
    if (s1[ind1] == '(')
      rem = min(rem, calc(ind, ind1 + 1, r + 1) + 1);
    else {
      if (r > 0)
        rem = min(rem, calc(ind, ind1 + 1, r - 1) + 1);
      else
        rem = min(rem, calc(ind, ind1, r + 1) + 1);
    }
  } else if (ind1 == s1.length()) {
    if (s[ind] == '(')
      rem = min(rem, calc(ind + 1, ind1, r + 1) + 1);
    else {
      if (r > 0)
        rem = min(rem, calc(ind + 1, ind1, r - 1) + 1);
      else
        rem = min(rem, calc(ind, ind1, r + 1) + 1);
    }
  } else {
    if (s[ind] == s1[ind1]) {
      if (s[ind] == '(')
        rem = min(rem, calc(ind + 1, ind1 + 1, r + 1) + 1);
      else {
        if (r > 0)
          rem = min(rem, min(rem, calc(ind + 1, ind1 + 1, r - 1) + 1));
        else
          rem = min(rem, min(rem, calc(ind, ind1, r + 1) + 1));
      }
    } else {
      if (s[ind] == '(') {
        rem = min(rem, calc(ind + 1, ind1, r + 1) + 1);
        if (r > 0) rem = min(rem, calc(ind, ind1 + 1, r - 1) + 1);
      } else {
        rem = min(rem, calc(ind, ind1 + 1, r + 1) + 1);
        if (r > 0) rem = min(rem, calc(ind + 1, ind1, r - 1) + 1);
      }
    }
  }
  return rem;
}
string ans = "";
int abuhijleh;
void buildPath(int ind, int ind1, int r) {
  if (ind == s.length() && ind1 == s1.length()) {
    for (int i = 0; i < abuhijleh; i++) ans += ")";
    return;
  }
  abuhijleh--;
  if (s.length() != ind && s1.length() != ind1 &&
      dp[ind + 1][ind1 + 1][r + 1] == abuhijleh && s[ind] == '(' &&
      s1[ind1] == '(') {
    ans += "(";
    buildPath(ind + 1, ind1 + 1, r + 1);
    return;
  }
  if (s.length() != ind && dp[ind + 1][ind1][r + 1] == abuhijleh &&
      s[ind] == '(') {
    ans += "(";
    buildPath(ind + 1, ind1, r + 1);
    return;
  }
  if (s1.length() != ind1 && dp[ind][ind1 + 1][r + 1] == abuhijleh &&
      s1[ind1] == '(') {
    ans += "(";
    buildPath(ind, ind1 + 1, r + 1);
    return;
  }
  if (dp[ind][ind1][r + 1] == abuhijleh && r == 0) {
    ans += "(";
    buildPath(ind, ind1, r + 1);
    return;
  }
  if (r > 0 && s.length() != ind && s1.length() != ind1 &&
      dp[ind + 1][ind1 + 1][r - 1] == abuhijleh && s[ind] == ')' &&
      s1[ind1] == ')') {
    ans += ")";
    buildPath(ind + 1, ind1 + 1, r - 1);
    return;
  }
  if (r > 0 && s.length() != ind && dp[ind + 1][ind1][r - 1] == abuhijleh &&
      s[ind] == ')') {
    ans += ")";
    buildPath(ind + 1, ind1, r - 1);
    return;
  }
  if (r > 0 && s1.length() != ind1 && dp[ind][ind1 + 1][r - 1] == abuhijleh &&
      s1[ind1] == ')') {
    ans += ")";
    buildPath(ind, ind1 + 1, r - 1);
    return;
  }
}
int main() {
  cin >> s >> s1;
  memset(dp, -1, sizeof dp);
  abuhijleh = calc(0, 0, 0);
  buildPath(0, 0, 0);
  cout << ans << endl;
  return 0;
}