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 INF = 2e7 + 5;
int n, m, len;
char S[maxn];
int A[maxn], B[maxn], ans[maxn << 1];
int F[maxn][maxn][maxn << 1], G[maxn][maxn][maxn << 1],
    H[maxn][maxn][maxn << 1], P[maxn][maxn][maxn << 1];
int main() {
  gets(S + 1);
  n = strlen(S + 1);
  for (int i = 1; i <= n; ++i)
    if (S[i] == '(')
      A[i] = 1;
    else
      A[i] = -1;
  gets(S + 1);
  m = strlen(S + 1);
  for (int i = 1; i <= m; ++i)
    if (S[i] == '(')
      B[i] = 1;
    else
      B[i] = -1;
  len = n + m;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= len; ++k) F[i][j][k] = INF;
  F[0][0][0] = 0;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= len; ++k) {
        for (int tp = -1; tp <= 1; ++tp) {
          if (!tp || F[i][j][k] >= INF) continue;
          int u = i, v = j;
          if (A[u + 1] == tp) ++u;
          if (B[v + 1] == tp) ++v;
          if (k + tp < 0 || k + tp > len) continue;
          if (F[u][v][k + tp] > F[i][j][k] + 1) {
            F[u][v][k + tp] = F[i][j][k] + 1;
            G[u][v][k + tp] = tp, H[u][v][k + tp] = i, P[u][v][k + tp] = j;
          }
        }
      }
  int sans = INF, sp = 0, cnt = 0;
  for (int k = 0; k <= len; ++k)
    if (F[n][m][k] + k < sans) {
      sans = F[n][m][k] + k;
      sp = k;
    }
  for (int i = 1; i <= sp; ++i) ans[++cnt] = ')';
  int u = n, v = m;
  while (u || v || sp) {
    int s = G[u][v][sp], s1 = u, s2 = v;
    if (s == 1)
      ans[++cnt] = '(';
    else
      ans[++cnt] = ')';
    u = H[s1][s2][sp], v = P[s1][s2][sp];
    sp -= s;
  }
  for (int i = cnt; i >= 1; --i) putchar(ans[i]);
  return 0;
}