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;
constexpr int inf = 1001001001;
int dp[205][205][805];
int main() {
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < 205; i++) {
    for (int j = 0; j < 205; j++) {
      for (int k = 0; k < 805; k++) {
        dp[i][j][k] = inf;
      }
    }
  }
  dp[0][0][0] = 0;
  for (int i = 0; i <= s.size(); i++) {
    for (int j = 0; j <= t.size(); j++) {
      for (int k = 0; k <= 799; k++) {
        dp[i][j][k + 1] = min(dp[i][j][k + 1], dp[i][j][k] + 1);
        if (i < s.size() && s[i] == '(') {
          dp[i + 1][j][k + 1] = min(dp[i + 1][j][k + 1], dp[i][j][k] + 1);
        }
        if (j < t.size() && t[j] == '(') {
          dp[i][j + 1][k + 1] = min(dp[i][j + 1][k + 1], dp[i][j][k] + 1);
        }
        if (i < s.size() && s[i] == '(' && j < t.size() && t[j] == '(') {
          dp[i + 1][j + 1][k + 1] =
              min(dp[i + 1][j + 1][k + 1], dp[i][j][k] + 1);
        }
      }
      for (int k = 800; k >= 1; k--) {
        dp[i][j][k - 1] = min(dp[i][j][k - 1], dp[i][j][k] + 1);
        if (i < s.size() && s[i] == ')') {
          dp[i + 1][j][k - 1] = min(dp[i + 1][j][k - 1], dp[i][j][k] + 1);
        }
        if (j < t.size() && t[j] == ')') {
          dp[i][j + 1][k - 1] = min(dp[i][j + 1][k - 1], dp[i][j][k] + 1);
        }
        if (i < s.size() && s[i] == ')' && j < t.size() && t[j] == ')') {
          dp[i + 1][j + 1][k - 1] =
              min(dp[i + 1][j + 1][k - 1], dp[i][j][k] + 1);
        }
      }
    }
  }
  int now = dp[s.size()][t.size()][0];
  int l = (int)s.size(), r = (int)t.size(), sum = 0;
  string ans = "";
  for (int i = now - 1; i >= 0; i--) {
    bool flag = false;
    for (int j = -1; j <= 0; j++) {
      for (int k = -1; k <= 0; k++) {
        for (int m = -1; m <= 1; m += 2) {
          if (0 <= l + j && 0 <= r + k && 0 <= sum + m) {
            bool ok = true;
            if (j == -1 && m == -1 && s[l + j] == ')') {
              ok = false;
            }
            if (j == -1 && m == 1 && s[l + j] == '(') {
              ok = false;
            }
            if (k == -1 && m == -1 && t[r + k] == ')') {
              ok = false;
            }
            if (k == -1 && m == 1 && t[r + k] == '(') {
              ok = false;
            }
            if (ok && dp[l + j][r + k][sum + m] == i) {
              if (m == -1) {
                ans += '(';
              } else {
                ans += ')';
              }
              l += j;
              r += k;
              sum += m;
              flag = true;
            }
          }
          if (flag) {
            break;
          }
        }
        if (flag) {
          break;
        }
      }
      if (flag) {
        break;
      }
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}