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;
const int N = 205;
const int INF = (int)1e5 + 5;
int dp[N][N][N];
string s, t;
int n, m;
int solve(int i, int j, int open) {
  if (i == n && j == m) {
    return open;
  }
  int &ans = dp[i][j][open];
  if (ans != -1) return ans;
  ans = INF;
  if (i == n && j != m) {
    int cost = 0;
    for (int k = j; k < m; k++) {
      if (t[k] == '(')
        open++, cost++;
      else {
        if (open > 0)
          open--, cost++;
        else
          cost += 2;
      }
    }
    return ans = cost + open;
  }
  if (j == m && i != n) {
    int cost = 0;
    for (int k = i; k < n; k++) {
      if (s[k] == '(')
        open++, cost++;
      else {
        if (open > 0)
          open--, cost++;
        else
          cost += 2;
      }
    }
    return ans = cost + open;
  }
  ans = INF;
  if (s[i] == t[j]) {
    if (s[i] == '(')
      ans = min(ans, 1 + solve(i + 1, j + 1, open + 1));
    else {
      if (open > 0)
        ans = min(ans, 1 + solve(i + 1, j + 1, open - 1));
      else
        ans = min(ans, 2 + solve(i + 1, j + 1, 0));
    }
  } else {
    if (s[i] == '(') {
      ans = min(ans, 1 + solve(i + 1, j, open + 1));
      if (open > 0) ans = min(ans, 1 + solve(i, j + 1, open - 1));
    } else {
      if (open > 0) ans = min(ans, 1 + solve(i + 1, j, open - 1));
      ans = min(ans, 1 + solve(i, j + 1, open + 1));
    }
  }
  return ans;
}
string res = "";
void build(int i, int j, int open) {
  if (i == n && j == m) {
    for (int k = 0; k < open; k++) res += ')';
    return;
  }
  if (i == n && j != m) {
    for (int k = j; k < m; k++) {
      if (t[k] == '(') {
        open++;
        res += '(';
      } else {
        if (open > 0) {
          res += ')';
          open--;
        } else
          res += "()";
      }
    }
    for (int k = 0; k < open; k++) res += ')';
    return;
  }
  if (j == m && i != n) {
    for (int k = i; k < n; k++) {
      if (s[k] == '(') {
        open++;
        res += '(';
      } else {
        if (open > 0) {
          res += ')';
          open--;
        } else
          res += "()";
      }
    }
    for (int k = 0; k < open; k++) res += ')';
    return;
  }
  if (s[i] == t[j]) {
    if (s[i] == '(') {
      res += '(';
      build(i + 1, j + 1, open + 1);
      return;
    } else {
      if (open > 0) {
        res += ')';
        build(i + 1, j + 1, open - 1);
        return;
      } else {
        res += "()";
        build(i + 1, j + 1, 0);
        return;
      }
    }
  } else {
    if (s[i] == '(') {
      int ans1 = INF, ans2 = INF;
      ans1 = 1 + solve(i + 1, j, open + 1);
      if (open > 0) ans2 = 1 + solve(i, j + 1, open - 1);
      if (ans1 < ans2) {
        res += '(';
        build(i + 1, j, open + 1);
        return;
      } else {
        res += ')';
        build(i, j + 1, open - 1);
        return;
      }
    } else {
      int ans1 = INF, ans2 = INF;
      if (open > 0) ans1 = 1 + solve(i + 1, j, open - 1);
      ans2 = 1 + solve(i, j + 1, open + 1);
      if (ans1 < ans2) {
        res += ')';
        build(i + 1, j, open - 1);
        return;
      } else {
        res += '(';
        build(i, j + 1, open + 1);
        return;
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s >> t;
  n = s.size(), m = t.size();
  memset(dp, -1, sizeof dp);
  int ans = solve(0, 0, 0);
  build(0, 0, 0);
  cout << res << '\n';
  return 0;
}