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 JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.Queue;
import java.util.ArrayDeque;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Rustam Musin (t.me/musin_acm)
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    OutputWriter out = new OutputWriter(outputStream);
    FDveSkobochniePosledovatelnosti solver = new FDveSkobochniePosledovatelnosti();
    solver.solve(1, in, out);
    out.close();
  }

  static class FDveSkobochniePosledovatelnosti {
    int maxOpened;
    char[] s;
    char[] t;
    int n;
    int m;
    int[][][] dp;
    FDveSkobochniePosledovatelnosti.State[][][] parent;
    Queue<FDveSkobochniePosledovatelnosti.State> q;

    public void solve(int testNumber, InputReader in, OutputWriter out) {
      s = in.next().toCharArray();
      t = in.next().toCharArray();
      n = s.length;
      m = t.length;
      maxOpened = n + m;
      dp = new int[n + 1][m + 1][maxOpened + 1];
      ArrayUtils.fill(dp, -1);
      parent = new FDveSkobochniePosledovatelnosti.State[n + 1][m + 1][maxOpened + 1];
      q = new ArrayDeque<>();
      q.add(new FDveSkobochniePosledovatelnosti.State(0, 0, 0));
      dp[0][0][0] = 0;
      while (!q.isEmpty()) {
        FDveSkobochniePosledovatelnosti.State cur = q.poll();
        update(cur, true);
        update(cur, false);
      }
      FDveSkobochniePosledovatelnosti.State last = new FDveSkobochniePosledovatelnosti.State(n, m, 0);
      int len = dp[last.at0][last.at1][last.balance];
      char[] res = new char[len];
      for (int i = 0; i < len; i++) {
        FDveSkobochniePosledovatelnosti.State prev = parent[last.at0][last.at1][last.balance];
        char c = prev.balance < last.balance ? '(' : ')';
        res[len - i - 1] = c;
        last = prev;
      }
      out.print(res);
    }

    void update(FDveSkobochniePosledovatelnosti.State curState, boolean open) {
      int at0 = curState.at0;
      int at1 = curState.at1;
      int balance = curState.balance;
      int path = dp[at0][at1][balance];
      int newBalance = balance + (open ? 1 : -1);
      if (newBalance < 0 || newBalance > maxOpened) return;
      char c = open ? '(' : ')';
      int AT0 = at0;
      int AT1 = at1;
      if (at0 < n && s[at0] == c) AT0++;
      if (at1 < m && t[at1] == c) AT1++;
      if (dp[AT0][AT1][newBalance] == -1) {
        dp[AT0][AT1][newBalance] = path + 1;
        parent[AT0][AT1][newBalance] = curState;
        q.add(new FDveSkobochniePosledovatelnosti.State(AT0, AT1, newBalance));
      }
    }

    static class State {
      int at0;
      int at1;
      int balance;

      State(int at0, int at1, int balance) {
        this.at0 = at0;
        this.at1 = at1;
        this.balance = balance;
      }

    }

  }

  static class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void print(char[] array) {
      writer.print(array);
    }

    public void close() {
      writer.close();
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public String readString() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      StringBuilder res = new StringBuilder();
      do {
        if (Character.isValidCodePoint(c)) {
          res.appendCodePoint(c);
        }
        c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
      return readString();
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);

    }

  }

  static class ArrayUtils {
    public static void fill(int[][] array, int value) {
      for (int[] row : array) {
        Arrays.fill(row, value);
      }
    }

    public static void fill(int[][][] array, int value) {
      for (int[][] subArray : array) {
        fill(subArray, value);
      }
    }

  }
}