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;
void testCase() {}
int dp[202][202][404];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string str1, str2;
  cin >> str1 >> str2;
  int n = str1.size();
  int m = str2.size();
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 400; k >= 0; k--) {
        if (i == 0 && j == 0)
          dp[i][j][k] = k;
        else if (i == 0) {
          if (str2[j - 1] == '(') {
            if (k == 0)
              dp[i][j][k] = 1e9;
            else
              dp[i][j][k] = dp[i][j - 1][k - 1] + 1;
          } else {
            if (k == 400)
              dp[i][j][k] = 1e9;
            else
              dp[i][j][k] = 1 + dp[i][j - 1][k + 1];
          }
        } else if (j == 0) {
          if (str1[i - 1] == '(') {
            if (k == 0)
              dp[i][j][k] = 1e9;
            else
              dp[i][j][k] = dp[i - 1][j][k - 1] + 1;
          } else {
            if (k == 400)
              dp[i][j][k] = 1e9;
            else
              dp[i][j][k] = 1 + dp[i - 1][j][k + 1];
          }
        } else if (str1[i - 1] == str2[j - 1]) {
          if (str1[i - 1] == '(') {
            if (k == 0)
              dp[i][j][k] = 1e9;
            else
              dp[i][j][k] = 1 + dp[i - 1][j - 1][k - 1];
          } else {
            if (k == 400)
              dp[i][j][k] = 1e9;
            else
              dp[i][j][k] = 1 + dp[i - 1][j - 1][k + 1];
          }
        } else {
          dp[i][j][k] = 1e9;
          if (str1[i - 1] == '(') {
            if (k > 0) dp[i][j][k] = min(dp[i][j][k], 1 + dp[i - 1][j][k - 1]);
          } else {
            if (k <= 400)
              dp[i][j][k] = min(dp[i][j][k], 1 + dp[i - 1][j][k + 1]);
          }
          if (str2[j - 1] == '(') {
            if (k > 0) dp[i][j][k] = min(dp[i][j][k], 1 + dp[i][j - 1][k - 1]);
          } else {
            if (k <= 400)
              dp[i][j][k] = min(dp[i][j][k], 1 + dp[i][j - 1][k + 1]);
          }
        }
      }
    }
  }
  int lyhin = 1e9;
  int parask = -1;
  for (int i = 0; i <= 400; i++) {
    if (i + dp[n][m][i] < lyhin) {
      lyhin = i + dp[n][m][i];
      parask = i;
    }
  }
  string ans = "";
  for (int i = 0; i < parask; i++) ans += ")";
  int I = n, J = m, K = parask;
  while (I > 0 && J > 0) {
    if (str1[I - 1] == str2[J - 1]) {
      if (str1[I - 1] == '(') {
        ans += "(";
        K--;
      } else {
        ans += ")";
        K++;
      }
      I--;
      J--;
    } else {
      if (str1[I - 1] == '(') {
        if (K != 0 && dp[I - 1][J][K - 1] < dp[I][J - 1][K + 1]) {
          ans += "(";
          K--;
          I--;
        } else {
          ans += ")";
          K++;
          J--;
        }
      } else {
        if (K != 0 && dp[I][J - 1][K - 1] < dp[I - 1][J][K + 1]) {
          ans += "(";
          K--;
          J--;
        } else {
          ans += ")";
          K++;
          I--;
        }
      }
    }
  }
  if (I > 0) {
    for (int i = I - 1; i >= 0; i--) {
      ans += str1[i];
      if (str1[i] == '(')
        K--;
      else
        K++;
    }
  } else if (J > 0) {
    for (int i = J - 1; i >= 0; i--) {
      ans += str2[i];
      if (str2[i] == '(')
        K--;
      else
        K++;
    }
  }
  while (K > 0) {
    ans += "(";
    K--;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << "\n";
}