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 = 210, MX = 2 * N;
int cost[MX][2 * N][N];
int n, m, cur, i, j;
char s[N], t[N];
queue<pair<int, pair<int, int> > > q;
inline void add(int cur, int i, int j, int C) {
  if (cur < 0 || cur >= MX || cost[cur][i][j] != -1) return;
  cost[cur][i][j] = C;
  q.push(make_pair(cur, make_pair(i, j)));
}
inline bool check(int cur1, int i, int j, int cur2, int i2, int j2, char x) {
  if (x == '(')
    cur1++;
  else
    cur1--;
  if (i < n && s[i] == x) i++;
  if (j < m && t[j] == x) j++;
  if (cur1 == cur2 && i == i2 && j == j2) return true;
  return false;
}
string ans;
void build_path(int cur, int i, int j) {
  if (cur == 0 && i == 0 && j == 0) return;
  for (int cur1 = max(0, cur - 1); cur1 <= cur + 1; cur1++) {
    if (cur1 == cur) continue;
    for (int i2 = i - 1; i2 <= i; i2++) {
      for (int j2 = j - 1; j2 <= j; j2++) {
        if (check(cur1, i2, j2, cur, i, j, '(') &&
            cost[cur1][i2][j2] == cost[cur][i][j] - 1) {
          ans += '(';
          build_path(cur1, i2, j2);
          return;
        }
        if (check(cur1, i2, j2, cur, i, j, ')') &&
            cost[cur1][i2][j2] == cost[cur][i][j] - 1) {
          ans += ')';
          build_path(cur1, i2, j2);
          return;
        }
      }
    }
  }
  assert(false);
}
int main() {
  memset(cost, -1, sizeof(cost));
  scanf("%s", s);
  scanf("%s", t);
  n = strlen(s);
  m = strlen(t);
  q.push(make_pair(0, make_pair(0, 0)));
  cost[0][0][0] = 0;
  while (!q.empty()) {
    cur = q.front().first;
    i = q.front().second.first;
    j = q.front().second.second;
    q.pop();
    if (cur == 0 && i == n && j == m) {
      break;
    }
    add(cur + 1, i + (i < n && s[i] == '('), j + (j < m && t[j] == '('),
        cost[cur][i][j] + 1);
    add(cur - 1, i + (i < n && s[i] == ')'), j + (j < m && t[j] == ')'),
        cost[cur][i][j] + 1);
  }
  build_path(0, n, m);
  reverse(ans.begin(), ans.end());
  puts(ans.c_str());
  return 0;
}