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 = 200 + 11;
int dp[N][N][N];
pair<pair<int, int>, pair<int, int> > pr[N][N][N];
vector<pair<int, pair<int, int> > > vv;
int n, m;
void up(int l, int r, int k, int ans, int c1, int c2, int c3, int c4) {
  if (k < 0 || k > max(n, m)) return;
  if (dp[l][r][k] != -1) return;
  dp[l][r][k] = ans;
  pr[l][r][k] = make_pair(make_pair(c1, c2), make_pair(c3, c4));
  vv.push_back(make_pair(l, make_pair(r, k)));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s, t;
  cin >> s >> t;
  n = s.size();
  m = t.size();
  s = "." + s;
  t = "." + t;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++)
      for (int bal = 0; bal <= max(n, m); bal++) dp[i][j][bal] = -1;
  dp[0][0][0] = 0;
  vv.push_back(make_pair(0, make_pair(0, 0)));
  for (int j = 0; j < vv.size(); j++) {
    int l = vv[j].first;
    int r = vv[j].second.first;
    int k = vv[j].second.second;
    int ans = dp[l][r][k] + 1;
    up(l, r, k + 1, ans, 1, l, r, k);
    up(l, r, k - 1, ans, -1, l, r, k);
    if (l < n && r < m && s[l + 1] == '(' && t[r + 1] == '(')
      up(l + 1, r + 1, k + 1, ans, 1, l, r, k);
    if (l < n && r < m && s[l + 1] == ')' && t[r + 1] == ')')
      up(l + 1, r + 1, k - 1, ans, -1, l, r, k);
    if (l < n && s[l + 1] == '(') up(l + 1, r, k + 1, ans, 1, l, r, k);
    if (l < n && s[l + 1] == ')') up(l + 1, r, k - 1, ans, -1, l, r, k);
    if (r < m && t[r + 1] == '(') up(l, r + 1, k + 1, ans, 1, l, r, k);
    if (r < m && t[r + 1] == ')') up(l, r + 1, k - 1, ans, -1, l, r, k);
  }
  string ans = "";
  int k = 0;
  while (n != 0 || m != 0 || k != 0) {
    pair<pair<int, int>, pair<int, int> > p = pr[n][m][k];
    if (p.first.first == 1)
      ans += "(";
    else
      ans += ")";
    n = p.first.second;
    m = p.second.first;
    k = p.second.second;
  }
  reverse(ans.begin(), ans.end());
  cout << ans;
}