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>
struct State {
  int16_t val;
  int16_t prev_i, prev_j, prev_balance;
  char best_ch;
  State() {}
  State(int32_t val_, int32_t prev_i_, int32_t prev_j_, int32_t prev_balance_,
        char best_ch_) {
    val = val_;
    prev_i = prev_i_;
    prev_j = prev_j_;
    prev_balance = prev_balance_;
    best_ch = best_ch_;
  }
  void relax(State& other, int32_t i, int32_t j, int32_t prev_balance_,
             char ch) {
    if (other.val == INT16_MAX) return;
    if (val == INT16_MAX || other.val < val - 1) {
      val = other.val + 1;
      prev_i = i;
      prev_j = j;
      prev_balance = prev_balance_;
      best_ch = ch;
    }
  }
};
int main() {
  std::string str1, str2;
  std::cin >> str1 >> str2;
  int32_t n = str1.size(), m = str2.size();
  State*** dp = new State**[n + 1];
  for (int32_t i = 0; i <= n; i++) {
    dp[i] = new State*[m + 1];
    for (int32_t j = 0; j <= m; j++) dp[i][j] = new State[1000];
  }
  dp[0][0][0] = {0, -1, -1, -1, ' '};
  for (int32_t i = 0; i <= n; i++) {
    for (int32_t j = 0; j <= m; j++) {
      for (int32_t k = 0; k < 1000; k++) {
        if (i == 0 && j == 0 && k == 0) continue;
        dp[i][j][k] = {INT16_MAX, -1, -1, -1, ' '};
        if (k < 1000 - 1) {
          if (i > 0 && str1[i - 1] == ')')
            dp[i][j][k].relax(dp[i - 1][j][k + 1], i - 1, j, k + 1, ')');
          if (j > 0 && str2[j - 1] == ')')
            dp[i][j][k].relax(dp[i][j - 1][k + 1], i, j - 1, k + 1, ')');
          if ((i > 0 && str1[i - 1] == ')') && (j > 0 && str2[j - 1] == ')'))
            dp[i][j][k].relax(dp[i - 1][j - 1][k + 1], i - 1, j - 1, k + 1,
                              ')');
        }
        if (k != 0) {
          if (i > 0 && str1[i - 1] == '(')
            dp[i][j][k].relax(dp[i - 1][j][k - 1], i - 1, j, k - 1, '(');
          if (j > 0 && str2[j - 1] == '(')
            dp[i][j][k].relax(dp[i][j - 1][k - 1], i, j - 1, k - 1, '(');
          if ((i > 0 && str1[i - 1] == '(') && (j > 0 && str2[j - 1] == '('))
            dp[i][j][k].relax(dp[i - 1][j - 1][k - 1], i - 1, j - 1, k - 1,
                              '(');
        }
      }
      if ((i == n || str1[i] == '(') && (j == m || str2[j] == '(')) {
        for (int32_t k = 1000 - 1; k >= 0; k--) {
          dp[i][j][k].relax(dp[i][j][k + 1], i, j, k + 1, ')');
        }
      }
      if ((i == n || str1[i] == ')') && (j == m || str2[j] == ')')) {
        for (int32_t k = 1; k < 1000; k++) {
          dp[i][j][k].relax(dp[i][j][k - 1], i, j, k - 1, '(');
        }
      }
    }
  }
  int32_t cur_i = n, cur_j = m, cur_balance = 0;
  std::string answer;
  while (cur_i != 0 || cur_j != 0 || cur_balance != 0) {
    answer.push_back(dp[cur_i][cur_j][cur_balance].best_ch);
    int32_t cur_i_ = dp[cur_i][cur_j][cur_balance].prev_i;
    int32_t cur_j_ = dp[cur_i][cur_j][cur_balance].prev_j;
    int32_t cur_balance_ = dp[cur_i][cur_j][cur_balance].prev_balance;
    cur_i = cur_i_;
    cur_j = cur_j_;
    cur_balance = cur_balance_;
  }
  std::reverse(answer.begin(), answer.end());
  std::cout << answer;
  return 0;
}