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;
const int MAXN = 205;
const int MAXM = 1000005;
const int HASHSIZE = 2000003;
const int INF = 0x7fffffff;
const int mod = 1e8;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar('0' + x % 10);
}
struct node {
  int i, j, dis;
  string ans;
  bool operator<(const node& n1) const {
    return (ans.length() + dis) > (n1.ans.length() + n1.dis);
  }
};
char a[MAXN], b[MAXN];
int dp[203][203][203];
queue<node> q;
priority_queue<node> q2;
void bfs(int la, int lb) {
  q.push({0, 0, 0});
  while (!q.empty()) {
    node now = q.front();
    q.pop();
    if (now.i == la || now.j == lb) {
      q2.push(now);
      continue;
    }
    int l = 0, r = 0;
    if (a[now.i] == '(') l++;
    if (b[now.j] == '(') r++;
    if (now.dis <= la && now.ans.length() + 1 + now.dis + 1 <
                             dp[now.i + l][now.j + r][now.dis + 1]) {
      dp[now.i + l][now.j + r][now.dis + 1] =
          now.ans.length() + 1 + now.dis + 1;
      q.push({now.i + l, now.j + r, now.dis + 1, now.ans + '('});
    }
    l = 0, r = 0;
    if (!now.dis) continue;
    if (a[now.i] == ')') l++;
    if (b[now.j] == ')') r++;
    if (now.ans.length() + now.dis < dp[now.i + l][now.j + r][now.dis - 1]) {
      dp[now.i + l][now.j + r][now.dis - 1] = now.ans.length() + now.dis;
      q.push({now.i + l, now.j + r, now.dis - 1, now.ans + ')'});
    }
  }
  while (!q2.empty()) {
    node now = q2.top();
    q2.pop();
    if (now.i == la && now.j == lb) {
      while (now.dis) {
        now.ans += ')';
        now.dis--;
      }
      cout << now.ans << "\n";
      return;
    }
    if (now.i == la) {
      if (b[now.j] == '(') {
        now.dis++;
        now.j++;
        now.ans += '(';
        q2.push(now);
      } else if (b[now.j] == ')' && now.dis) {
        now.dis--;
        now.j++;
        now.ans += ')';
        q2.push(now);
      } else {
        now.j++;
        now.ans += "()";
        q2.push(now);
      }
    } else {
      if (a[now.i] == '(') {
        now.dis++;
        now.i++;
        now.ans += '(';
        q2.push(now);
      } else if (a[now.i] == ')' && now.dis) {
        now.dis--;
        now.i++;
        now.ans += ')';
        q2.push(now);
      } else {
        now.i++;
        now.ans += "()";
        q2.push(now);
      }
    }
  }
}
signed main() {
  scanf("%s%s", a, b);
  int la = strlen(a), lb = strlen(b);
  if (la < lb) swap(a, b), swap(la, lb);
  memset(dp, 0x7f, sizeof(dp));
  bfs(la, lb);
  return 0;
}