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;
string s, t;
int dp[222][222][222];
int skad[222][222][222];
int n, m;
int reku(int a, int b, int bal) {
  if (bal > 210 || bal < 0) return 1e9;
  if (a == 0 && b == 0) return bal;
  if (a > n && b > m) return 1e9;
  if (dp[a][b][bal] != 1e9) return dp[a][b][bal];
  if (a == 0 || b == 0) {
    int lewo = 1e9;
    int prawo = 1e9;
    if (a == 0) {
      int xd;
      xd = b;
      if (t[xd - 1] == ')') {
        xd--;
        lewo = reku(0, xd, bal + 1);
      } else
        lewo = reku(0, b, bal + 1);
      xd = b;
      if (t[xd - 1] == '(') {
        xd--;
        prawo = reku(0, xd, bal - 1);
      } else
        prawo = reku(0, b, bal - 1);
      dp[a][b][bal] = min(dp[a][b][bal], 1 + min(lewo, prawo));
    } else if (b == 0) {
      int xd = a;
      if (s[xd - 1] == ')') {
        xd--;
        lewo = reku(xd, 0, bal + 1);
      } else
        lewo = reku(a, 0, bal + 1);
      xd = a;
      if (s[xd - 1] == '(') {
        xd--;
        prawo = reku(xd, 0, bal - 1);
      } else
        prawo = reku(a, 0, bal - 1);
      dp[a][b][bal] = min(dp[a][b][bal], 1 + min(lewo, prawo));
    }
    return dp[a][b][bal];
  }
  int res = 1e9;
  int pot1 = 1;
  if (true) {
    int xd1, xd2;
    xd1 = a;
    xd2 = b;
    if (xd1 > 0) {
      if (s[xd1 - 1] == ')') xd1--;
    }
    if (xd2 > 0) {
      if (t[xd2 - 1] == ')') xd2--;
    }
    pot1 += reku(xd1, xd2, bal + 1);
    res = min(res, pot1);
  }
  if (bal > 0) {
    int pot2 = 1;
    int xd1, xd2;
    xd1 = a;
    xd2 = b;
    if (xd1 > 0) {
      if (s[xd1 - 1] == '(') xd1--;
    }
    if (xd2 > 0) {
      if (t[xd2 - 1] == '(') xd2--;
    }
    pot2 += reku(xd1, xd2, bal - 1);
    res = min(res, pot2);
  }
  dp[a][b][bal] = res;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> t;
  n = s.length();
  m = t.length();
  for (int i = 0; i < 222; i++) {
    for (int j = 0; j < 222; j++) {
      for (int k = 0; k < 222; k++) {
        dp[i][j][k] = 1e9;
      }
    }
  }
  string ans;
  int wyn = reku(n, m, 0);
  int bal = 0;
  for (int i = wyn; i >= 1; i--) {
    if (bal == 0) {
      ans += ")";
      bal++;
      if (s[n - 1] == ')') n--;
      if (t[m - 1] == ')') m--;
      continue;
    }
    int xd1 = n;
    int xd2 = m;
    if (s[n - 1] == ')') xd1--;
    if (t[m - 1] == ')') xd2--;
    if (dp[xd1][xd2][bal + 1] == i - 1) {
      n = xd1;
      m = xd2;
      bal++;
      ans += ")";
      continue;
    } else {
      xd1 = n;
      xd2 = m;
      if (s[n - 1] == '(') xd1--;
      if (t[m - 1] == '(') xd2--;
      n = xd1;
      m = xd2;
      bal--;
      ans += "(";
      continue;
    }
  }
  for (int i = wyn - 1; i >= 0; i--) cout << ans[i];
  return 0;
}