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>
const int Max = 210;
int f[Max][Max][Max * 2];
bool is[Max][Max][Max * 2];
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::string s1, s2;
  std::cin >> s1 >> s2;
  memset(f, 0x3f, sizeof f);
  const int inf = f[0][0][0];
  f[0][0][0] = 0;
  int N = s1.size(), M = s2.size();
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j <= M; ++j) {
      int a = i + (i < N && s1[i] == '(');
      int b = j + (j < M && s2[j] == '(');
      for (int k = 0; k <= N + M; ++k) {
        if (f[i][j][k] == inf) {
          continue;
        }
        if (f[a][b][k + 1] > f[i][j][k] + 1) {
          f[a][b][k + 1] = f[i][j][k] + 1;
          is[a][b][k + 1] = true;
        }
      }
      a = i + (i < N && s1[i] == ')');
      b = j + (j < M && s2[j] == ')');
      for (int k = N + M; k >= 1; --k) {
        if (f[i][j][k] == inf) {
          continue;
        }
        if (f[a][b][k - 1] > f[i][j][k] + 1) {
          f[a][b][k - 1] = f[i][j][k] + 1;
          is[a][b][k - 1] = false;
        }
      }
    }
  }
  int mn = inf, p = 0;
  for (int i = 0; i <= N + M; ++i) {
    if (mn > f[N][M][i] + i) {
      mn = f[N][M][i] + i;
      p = i;
    }
  }
  std::string ans;
  for (int i = 0; i < p; ++i) {
    ans.push_back(')');
  }
  for (int i = N, j = M, k = p; i > 0 || j > 0 || k > 0;) {
    int x = f[i][j][k] - 1;
    char c;
    if (is[i][j][k] == true) {
      c = '(';
      --k;
    } else {
      c = ')';
      ++k;
    }
    ans.push_back(c);
    int a = (i > 0 && s1[i - 1] == c);
    int b = (j > 0 && s2[j - 1] == c);
    if (f[i][j][k] == x) {
      continue;
    } else if (a > 0 && f[i - 1][j][k] == x) {
      --i;
    } else if (b > 0 && f[i][j - 1][k] == x) {
      --j;
    } else {
      --i;
      --j;
    }
  }
  std::reverse(ans.begin(), ans.end());
  std::cout << ans;
  return 0;
}