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() {
  string s, t;
  cin >> s >> t;
  int dp[s.size() + 1][t.size() + 1][201];
  for (int i = 0; i < s.size() + 1; i++)
    for (int j = 0; j < t.size() + 1; j++)
      for (int k = 0; k < 201; k++) dp[i][j][k] = 10000;
  dp[0][0][0] = 0;
  tuple<int, int, int> trace[s.size() + 1][t.size() + 1][201];
  for (int i = 0; i < s.size() + 1; i++)
    for (int j = 0; j < t.size() + 1; j++)
      for (int k = 0; k < 201; k++) {
        if (k + 1 <= 200) {
          int ni;
          if (i < s.size() && s[i] == '(')
            ni = i + 1;
          else
            ni = i;
          int nj;
          if (j < t.size() && t[j] == '(')
            nj = j + 1;
          else
            nj = j;
          if (dp[ni][nj][k + 1] > dp[i][j][k] + 1) {
            dp[ni][nj][k + 1] = dp[i][j][k] + 1;
            trace[ni][nj][k + 1] = make_tuple(i, j, k);
          }
        }
        if (k - 1 >= 0) {
          int ni;
          if (i < s.size() && s[i] == ')')
            ni = i + 1;
          else
            ni = i;
          int nj;
          if (j < t.size() && t[j] == ')')
            nj = j + 1;
          else
            nj = j;
          if (dp[ni][nj][k - 1] > dp[i][j][k] + 1) {
            dp[ni][nj][k - 1] = dp[i][j][k] + 1;
            trace[ni][nj][k - 1] = make_tuple(i, j, k);
          }
        }
      }
  string ans = "";
  int now_i = s.size();
  int now_j = t.size();
  int now_k;
  int m = 10000;
  for (int k = 0; k < 201; k++) m = min(m, dp[s.size()][t.size()][k] + k);
  for (int k = 0; k < 201; k++)
    if (dp[s.size()][t.size()][k] + k == m) now_k = k;
  for (int k = 0; k < now_k; k++) ans += ')';
  while (true) {
    int prev_i = get<0>(trace[now_i][now_j][now_k]);
    int prev_j = get<1>(trace[now_i][now_j][now_k]);
    int prev_k = get<2>(trace[now_i][now_j][now_k]);
    if (now_k - prev_k > 0)
      ans += '(';
    else
      ans += ')';
    now_i = prev_i;
    now_j = prev_j;
    now_k = prev_k;
    if (now_i == 0 && now_j == 0 && now_k == 0) break;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}