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>
using namespace std;
int dp[201][201][201];
string s, t;
string Res = "";
int solve(int i, int j, int op) {
  if (i == s.size() && j == t.size()) return op;
  if (dp[i][j][op] != -1) return dp[i][j][op];
  int x1 = 1e9, x2 = 1e9;
  if (op == 0)
    x1 = solve(i + (i + 1 <= s.size() && s[i] == '('),
               j + (j + 1 <= t.size() && t[j] == '('), op + 1) +
         1;
  else if (i == s.size()) {
    if (t[j] == '(')
      x1 = solve(i, j + 1, op + 1) + 1;
    else
      x1 = solve(i, j + 1, op - 1) + 1;
  } else if (j == t.size()) {
    if (s[i] == '(')
      x1 = solve(i + 1, j, op + 1) + 1;
    else
      x1 = solve(i + 1, j, op - 1) + 1;
  } else {
    if (s[i] == '(' && t[j] == '(')
      x1 = solve(i + 1, j + 1, op + 1) + 1;
    else if (s[i] == ')' && t[j] == ')')
      x1 = solve(i + 1, j + 1, op - 1) + 1;
    else {
      x1 = solve(i + (s[i] == '('), j + (t[j] == '('), op + 1) + 1;
      x2 = solve(i + (s[i] == ')'), j + (t[j] == ')'), op - 1) + 1;
    }
  }
  return dp[i][j][op] = min(x1, x2);
}
void get_path(int i, int j, int op) {
  if (i == s.size() && j == t.size()) return;
  int optimal = dp[i][j][op];
  int x1 = 1e9, x2 = 1e9;
  if (op == 0) {
    get_path(i + (i + 1 <= s.size() && s[i] == '('),
             j + (j + 1 <= t.size() && t[j] == '('), op + 1);
    Res += '(';
  } else if (i == s.size()) {
    if (t[j] == '(') {
      get_path(i, j + 1, op + 1);
      Res += '(';
    } else {
      get_path(i, j + 1, op - 1);
      Res += ')';
    }
  } else if (j == t.size()) {
    if (s[i] == '(') {
      get_path(i + 1, j, op + 1);
      Res += '(';
    } else {
      get_path(i + 1, j, op - 1);
      Res += ')';
    }
  } else {
    if (s[i] == '(' && t[j] == '(') {
      get_path(i + 1, j + 1, op + 1);
      Res += '(';
    } else if (s[i] == ')' && t[j] == ')') {
      get_path(i + 1, j + 1, op - 1);
      Res += ')';
    } else {
      x1 = solve(i + (s[i] == '('), j + (t[j] == '('), op + 1) + 1;
      x2 = solve(i + (s[i] == ')'), j + (t[j] == ')'), op - 1) + 1;
      if (optimal == x1) {
        get_path(i + (s[i] == '('), j + (t[j] == '('), op + 1);
        Res += '(';
      } else {
        get_path(i + (s[i] == ')'), j + (t[j] == ')'), op - 1);
        Res += ')';
      }
    }
  }
}
int main() {
  cin >> s >> t;
  memset(dp, -1, sizeof dp);
  solve(0, 0, 0);
  get_path(0, 0, 0);
  reverse(Res.begin(), Res.end());
  int op = 0, cl = 0;
  for (int i = 0; i < Res.size(); i++) {
    if (Res[i] == '(')
      op++;
    else
      cl++;
  }
  for (int i = 0; i < op - cl; i++) Res += ')';
  cout << Res;
  return 0;
}