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 N = 205;
struct three {
  int i, j, k;
  three() {}
  three(int _i, int _j, int _k) {
    i = _i;
    j = _j;
    k = _k;
  }
};
int dp[2 * N][N][N];
three trace[2 * N][N][N];
string s, t;
int n, m;
bool umax(int &a, int b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
void gogo() {
  cin >> s >> t;
  n = ((int)(s).size()), m = ((int)(t).size());
  s = ' ' + s, t = ' ' + t;
  for (int i = 0; i <= 400; ++i)
    for (int j = 0; j <= n; ++j)
      for (int k = 0; k <= 200; ++k) {
        dp[i][j][k] = -1;
      }
  dp[0][0][0] = 0;
  for (int i = 0; i <= 400; ++i) {
    for (int j = 0; j <= n; ++j) {
      for (int k = 0; k <= 200; ++k) {
        int cur = dp[i][j][k];
        if (cur == -1) continue;
        if (s[j + 1] == '(') {
          if (umax(dp[i + 1][j + 1][k + 1],
                   dp[i][j][k] + (t[cur + 1] == '('))) {
            trace[i + 1][j + 1][k + 1] = three(i, j, k);
          }
        } else {
          if (umax(dp[i + 1][j][k + 1], dp[i][j][k] + (t[cur + 1] == '('))) {
            trace[i + 1][j][k + 1] = three(i, j, k);
          }
        }
        if (k == 0) continue;
        if (s[j + 1] == ')') {
          if (umax(dp[i + 1][j + 1][k - 1],
                   dp[i][j][k] + (t[cur + 1] == ')'))) {
            trace[i + 1][j + 1][k - 1] = three(i, j, k);
          }
        } else {
          if (umax(dp[i + 1][j][k - 1], dp[i][j][k] + (t[cur + 1] == ')'))) {
            trace[i + 1][j][k - 1] = three(i, j, k);
          }
        }
      }
    }
  }
  int res = 1e9;
  for (int i = 0; i <= 2 * (n + m); ++i) {
    if (dp[i][n][0] >= m) {
      res = i;
      break;
    }
  }
  string ans = "";
  int i = res, j = n, k = 0;
  while (1) {
    three tmp = trace[i][j][k];
    if (k - tmp.k == 1)
      ans += '(';
    else
      ans += ')';
    i = tmp.i;
    j = tmp.j;
    k = tmp.k;
    if (i == 0) break;
  }
  reverse((ans).begin(), (ans).end());
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if (fopen("sol"
            ".inp",
            "r")) {
    freopen(
        "sol"
        ".inp",
        "r", stdin);
    freopen(
        "sol"
        ".out",
        "w", stdout);
  }
  gogo();
  return 0;
}