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 = 210;
const int inf = 0x3f3f3f3f;
char s[N], t[N];
int n, m;
int dp[N][N][N * 2];
struct state {
  int i, j, k;
  state() {}
  state(int _i, int _j, int _k) : i(_i), j(_j), k(_k) {}
};
state pre[N][N][N * 2];
string ans;
inline void upd(int i, int j, int k, int _i, int _j, int _k) {
  if (_i < 0 || _j < 0 || _i > n || _j > m || _k > n + m || _k < 0) return;
  if (dp[i][j][k] > dp[_i][_j][_k] + 1) {
    dp[i][j][k] = dp[_i][_j][_k] + 1;
    pre[i][j][k] = state(_i, _j, _k);
  }
}
int main() {
  scanf("%s", s);
  scanf("%s", t);
  n = strlen(s), m = strlen(t);
  memset(dp, inf, sizeof(dp));
  dp[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) {
        upd(i, j, k, i - (i && s[i - 1] == '('), j - (j && t[j - 1] == '('),
            k - 1);
        upd(i, j, k, i - (i && s[i - 1] == ')'), j - (j && t[j - 1] == ')'),
            k + 1);
      }
    }
  }
  int p1 = n, p2 = m, pk = 0;
  for (int k = 0; k <= n + m; ++k) {
    if (dp[n][m][pk] + pk > dp[n][m][k] + k) {
      pk = k;
    }
  }
  for (int i = 0; i < pk; ++i) ans += ")";
  while (p1 || p2 || pk) {
    state now = pre[p1][p2][pk];
    if (pk == now.k)
      ans += ")(";
    else if (pk < now.k)
      ans += ")";
    else
      ans += "(";
    p1 = now.i;
    p2 = now.j;
    pk = now.k;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}