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;
int dp[N][N][N << 1];
pair<pair<int, int>, int> p[N][N][N << 1];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = int((s).size()), m = int((t).size());
  for (int i = int(0); i < int(n + 1); ++i)
    for (int j = int(0); j < int(m + 1); ++j)
      for (int k = int(0); k < int(N << 1); ++k) dp[i][j][k] = 1e9;
  dp[0][0][0] = 0;
  queue<pair<pair<int, int>, int> > Q;
  Q.push(make_pair(make_pair(0, 0), 0));
  for (; !Q.empty(); Q.pop()) {
    int x = Q.front().first.first, y = Q.front().first.second,
        d = Q.front().second;
    if (x == n && y == m && !d) break;
    if (d + 1 < (N << 1)) {
      int nxtX = x + (x < n && s[x] == '(');
      int nxtY = y + (y < m && t[y] == '(');
      if (dp[x][y][d] + 1 < dp[nxtX][nxtY][d + 1]) {
        dp[nxtX][nxtY][d + 1] = dp[x][y][d] + 1;
        p[nxtX][nxtY][d + 1] = make_pair(make_pair(x, y), d);
        Q.push(make_pair(make_pair(nxtX, nxtY), d + 1));
      }
    }
    if (d) {
      int nxtX = x + (x < n && s[x] == ')');
      int nxtY = y + (y < m && t[y] == ')');
      if (dp[x][y][d] + 1 < dp[nxtX][nxtY][d - 1]) {
        dp[nxtX][nxtY][d - 1] = dp[x][y][d] + 1;
        p[nxtX][nxtY][d - 1] = make_pair(make_pair(x, y), d);
        Q.push(make_pair(make_pair(nxtX, nxtY), d - 1));
      }
    }
  }
  int i = n, j = m, k = 0;
  string ans = "";
  while (i || j || k) {
    int nxtI = p[i][j][k].first.first;
    int nxtJ = p[i][j][k].first.second;
    int nxtK = p[i][j][k].second;
    if (nxtK < k)
      ans.push_back('(');
    else
      ans.push_back(')');
    i = nxtI, j = nxtJ, k = nxtK;
  }
  reverse((ans).begin(), (ans).end());
  cout << ans << endl;
  return 0;
}