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;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s, t;
  cin >> s >> t;
  int n = s.size(), m = t.size();
  vector<vector<vector<int>>> dp0(
      n + 1, vector<vector<int>>(m + 1, vector<int>(n + m + 5, 1 << 29)));
  vector<vector<vector<pair<pair<int, int>, int>>>> dp1(
      n + 1, vector<vector<pair<pair<int, int>, int>>>(
                 m + 1, vector<pair<pair<int, int>, int>>(
                            n + m + 5, make_pair(make_pair(-1, -1), -1))));
  dp0[0][0][0] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= n + m; k++) {
        if (dp0[i][j][k] == (1 << 29)) continue;
        int x = i, y = j;
        if (i < n && s[i] == '(') x++;
        if (j < m && t[j] == '(') y++;
        if (dp0[x][y][k + 1] > (dp0[i][j][k] + 1)) {
          dp0[x][y][k + 1] = dp0[i][j][k] + 1;
          dp1[x][y][k + 1] = make_pair(make_pair(i, j), k);
        }
        x = i, y = j;
        if (i < n && s[i] == ')') x++;
        if (j < m && t[j] == ')') y++;
        if (k > 0 && dp0[x][y][k - 1] > (dp0[i][j][k] + 1)) {
          dp0[x][y][k - 1] = dp0[i][j][k] + 1;
          dp1[x][y][k - 1] = make_pair(make_pair(i, j), k);
        }
      }
    }
  }
  int res = 1 << 29;
  int x = n, y = m, z = 0;
  for (int k = 0; k <= n + m; k++) {
    if (res > (dp0[n][m][k] + k)) {
      res = dp0[n][m][k] + k;
      z = k;
    }
  }
  string str;
  for (int i = 0; i < z; i++) str.push_back(')');
  while (x != 0 || y != 0 || z != 0) {
    if (dp1[x][y][z].second == z) {
      str.push_back(')');
      str.push_back('(');
    } else if (dp1[x][y][z].second < z) {
      str.push_back('(');
    } else {
      str.push_back(')');
    }
    int nx = dp1[x][y][z].first.first;
    int ny = dp1[x][y][z].first.second;
    int nz = dp1[x][y][z].second;
    x = nx, y = ny, z = nz;
  }
  reverse(str.begin(), str.end());
  cout << str << "\n";
  return 0;
}