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;
inline int add(int a, int b) {
  a += b;
  return a >= 1000000007 ? a - 1000000007 : a;
}
inline int sub(int a, int b) {
  a -= b;
  return a < 0 ? a + 1000000007 : a;
}
inline int mul(int a, int b) { return (long long int)a * b % 1000000007; }
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool Cheek(int N, int pos) { return (bool)(N & (1 << pos)); }
string s1, s2, ans = "";
int len1, len2, dp[205][205][205];
int FuN(int pos1, int pos2, int open) {
  if (pos1 >= len1 && pos2 >= len2) return dp[pos1][pos2][open] = open;
  if (dp[pos1][pos2][open] != -1) return dp[pos1][pos2][open];
  int ret1 = (1 << 28), ret2 = (1 << 28);
  if (pos1 < len1 && pos2 < len2 && s1[pos1] == s2[pos2]) {
    if (s1[pos1] == '(')
      ret1 = 1 + FuN(pos1 + 1, pos2 + 1, open + 1);
    else {
      if (open > 0)
        ret2 = 1 + FuN(pos1 + 1, pos2 + 1, open - 1);
      else
        ret2 = 2 + FuN(pos1 + 1, pos2 + 1, open);
    }
  } else {
    if ((pos1 < len1 && s1[pos1] == '(') || (pos2 < len2 && s2[pos2] == '('))
      ret1 = 1 + FuN(pos1 + (pos1 < len1 && s1[pos1] == '('),
                     pos2 + (pos2 < len2 && s2[pos2] == '('), open + 1);
    if ((pos1 < len1 && s1[pos1] == ')') || (pos2 < len2 && s2[pos2] == ')')) {
      if (open > 0)
        ret2 = 1 + FuN(pos1 + (pos1 < len1 && s1[pos1] == ')'),
                       pos2 + (pos2 < len2 && s2[pos2] == ')'), open - 1);
      else
        ret2 = 2 + FuN(pos1 + (pos1 < len1 && s1[pos1] == ')'),
                       pos2 + (pos2 < len2 && s2[pos2] == ')'), open);
    }
  }
  return dp[pos1][pos2][open] = min(ret1, ret2);
}
void Print(int pos1, int pos2, int open) {
  if (pos1 >= len1 && pos2 >= len2) {
    for (int i = 1; i <= open; i++) printf(")");
    printf("\n");
    return;
  }
  int ret1 = (1 << 28), ret2 = (1 << 28), pr = 0;
  if (pos1 < len1 && pos2 < len2 && s1[pos1] == s2[pos2]) {
    if (s1[pos1] == '(')
      ret1 = 1 + dp[pos1 + 1][pos2 + 1][open + 1];
    else {
      if (open > 0)
        ret2 = 1 + dp[pos1 + 1][pos2 + 1][open - 1];
      else
        ret2 = 2 + dp[pos1 + 1][pos2 + 1][open], pr = 1;
    }
    if (ret1 <= ret2) {
      printf("(");
      Print(pos1 + 1, pos2 + 1, open + 1);
    } else {
      if (!pr) {
        printf(")");
        Print(pos1 + 1, pos2 + 1, open - 1);
      } else {
        printf("()");
        Print(pos1 + 1, pos2 + 1, open);
      }
    }
  } else {
    if ((pos1 < len1 && s1[pos1] == '(') || (pos2 < len2 && s2[pos2] == '('))
      ret1 = 1 + dp[pos1 + (pos1 < len1 && s1[pos1] == '(')]
                   [pos2 + (pos2 < len2 && s2[pos2] == '(')][open + 1];
    if ((pos1 < len1 && s1[pos1] == ')') || (pos2 < len2 && s2[pos2] == ')')) {
      if (open > 0)
        ret2 = 1 + dp[pos1 + (pos1 < len1 && s1[pos1] == ')')]
                     [pos2 + (pos2 < len2 && s2[pos2] == ')')][open - 1];
      else
        ret2 = 2 + dp[pos1 + (pos1 < len1 && s1[pos1] == ')')]
                     [pos2 + (pos2 < len2 && s2[pos2] == ')')][open],
        pr = 1;
    }
    if (ret1 <= ret2) {
      printf("(");
      Print(pos1 + (pos1 < len1 && s1[pos1] == '('),
            pos2 + (pos2 < len2 && s2[pos2] == '('), open + 1);
    } else {
      if (!pr) {
        printf(")");
        Print(pos1 + (pos1 < len1 && s1[pos1] == ')'),
              pos2 + (pos2 < len2 && s2[pos2] == ')'), open - 1);
      } else {
        printf("()");
        Print(pos1 + (pos1 < len1 && s1[pos1] == ')'),
              pos2 + (pos2 < len2 && s2[pos2] == ')'), open);
      }
    }
  }
}
void Solve(int t) {
  int i, j, k, ans;
  cin >> s1 >> s2;
  len1 = (int)s1.size();
  len2 = (int)s2.size();
  memset(dp, -1, sizeof(dp));
  ans = FuN(0, 0, 0);
  Print(0, 0, 0);
}
int main() {
  int t, T;
  T = 1;
  for (__typeof(t) t = 1; t <= T; t++) {
    Solve(t);
  }
  return 0;
}