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;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string a, b;
  cin >> a >> b;
  int n1 = a.length(), n2 = b.length();
  int n3 = max(n1, n2);
  int dp[n1 + 1][n2 + 1][n3 + 1];
  array<int, 4> prv[n1 + 1][n2 + 1][n3 + 1];
  for (int i = 0; i <= n1; i++)
    for (int j = 0; j <= n2; j++)
      for (int k = 0; k <= n3; k++) dp[i][j][k] = 1000000;
  dp[0][0][0] = 0;
  for (int i = 0; i <= n1; i++) {
    for (int j = 0; j <= n2; j++) {
      for (int k = 0; k <= n3; k++) {
        if (dp[i][j][k] == 1000000) continue;
        int nx = i, ny = j, nk = k + 1;
        if (i < n1 and a[i] == '(') nx++;
        if (j < n2 and b[j] == '(') ny++;
        if (k + 1 <= n3 and dp[i][j][k] + 1 < dp[nx][ny][nk]) {
          dp[nx][ny][nk] = min(dp[nx][ny][nk], dp[i][j][k] + 1);
          prv[nx][ny][nk] = {i, j, k, 0};
        }
        nx = i, ny = j, nk = k - 1;
        if (i < n1 and a[i] == ')') nx++;
        if (j < n2 and b[j] == ')') ny++;
        if (nk >= 0 and dp[i][j][k] + 1 < dp[nx][ny][nk]) {
          dp[nx][ny][nk] = min(dp[nx][ny][nk], dp[i][j][k] + 1);
          prv[nx][ny][nk] = {i, j, k, 1};
        }
      }
    }
  }
  int bal = 1000000, x, y, z;
  for (int k = 0; k <= n3; k++) {
    if (dp[n1][n2][k] + k < bal) {
      bal = dp[n1][n2][k] + k, x = n1, y = n2, z = k;
    }
  }
  string ans = "";
  int ad = z;
  while (x or y or z) {
    if (prv[x][y][z][3])
      ans += ')';
    else
      ans += '(';
    int nx, ny, nz;
    nx = prv[x][y][z][0];
    ny = prv[x][y][z][1];
    nz = prv[x][y][z][2];
    x = nx, y = ny, z = nz;
  }
  reverse(ans.begin(), ans.end());
  cout << ans;
  for (int i = 0; i < ad; i++) cout << ')';
  return 0;
}