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 long long MOD = 1000000007;
int opt[201][201][201];
int par[201][201][201];
void print(int n, int m, int K) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < K; k++) {
        cout << opt[i][j][k] << " ";
      }
      cout << endl;
    }
    cout << endl;
  }
}
void findstring(int n, int m, string &s, string &t) {
  int i = 0, j = 0, k = 0, p = par[i][j][k];
  string ans;
  int ni, nj, c;
  while (p != -1) {
    switch (p) {
      case 1:
        ans += ')';
        k--;
        break;
      case 2:
        ni = i < n ? i + 1 : i;
        nj = j < m ? j + 1 : j;
        c = i == n ? t[j] : s[i];
        if (c == '(') {
          ans += '(';
          k++;
        } else if (k > 0) {
          ans += ')';
          k--;
        } else {
          ans += "()";
        }
        i = ni;
        j = nj;
        break;
      case 3:
        ans += '(';
        i++;
        k++;
        break;
      case 4:
        ans += ')';
        j++;
        k--;
        break;
      case 5:
        ans += "()";
        j++;
        break;
      case 6:
        ans += '(';
        j++;
        k++;
        break;
      case 7:
        ans += ')';
        i++;
        k--;
        break;
      case 8:
        ans += "()";
        i++;
        break;
      default:
        assert(false);
    }
    p = par[i][j][k];
  }
  cout << ans << endl;
}
int dp(int i, int j, int k, string &s, string &t) {
  if (opt[i][j][k] != -1) return opt[i][j][k];
  int n = s.length(), m = t.length();
  int ans = INT_MAX;
  if (i == n && j == m && k > 0) {
    ans = 1 + dp(i, j, k - 1, s, t);
    par[i][j][k] = 1;
  } else if (i == n || j == m || s[i] == t[j]) {
    int ni = i < n ? i + 1 : i;
    int nj = j < m ? j + 1 : j;
    char c = i == n ? t[j] : s[i];
    if (c == '(') {
      ans = 1 + dp(ni, nj, k + 1, s, t);
    } else if (k > 0) {
      ans = 1 + dp(ni, nj, k - 1, s, t);
    } else {
      ans = 2 + dp(ni, nj, k, s, t);
    }
    par[i][j][k] = 2;
  } else if (s[i] == '(') {
    ans = 1 + dp(i + 1, j, k + 1, s, t);
    par[i][j][k] = 3;
    if (k > 0) {
      int x = 1 + dp(i, j + 1, k - 1, s, t);
      if (x < ans) {
        ans = x;
        par[i][j][k] = 4;
      }
    } else {
      int x = 2 + dp(i, j + 1, k, s, t);
      if (x < ans) {
        ans = x;
        par[i][j][k] = 5;
      }
    }
  } else {
    ans = 1 + dp(i, j + 1, k + 1, s, t);
    par[i][j][k] = 6;
    if (k > 0) {
      int x = 1 + dp(i + 1, j, k - 1, s, t);
      if (x < ans) {
        ans = x;
        par[i][j][k] = 7;
      }
    } else {
      int x = 2 + dp(i + 1, j, k, s, t);
      if (x < ans) {
        ans = x;
        par[i][j][k] = 8;
      }
    }
  }
  opt[i][j][k] = ans;
  return ans;
}
void sherlock(int x) {
  string s, t;
  cin >> s >> t;
  int n = s.length(), m = t.length(), K = max(n, m);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= K; k++) {
        opt[i][j][k] = -1;
        par[i][j][k] = -1;
      }
    }
  }
  opt[n][m][0] = 0;
  dp(0, 0, 0, s, t);
  findstring(n, m, s, t);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt;
  tt = 1;
  for (int t = 1; t <= tt; t++) sherlock(t);
  return 0;
}