#P1272F. Two Bracket Sequences

    ID: 1943 Type: RemoteJudge 2000ms 512MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>dpstringstwo pointers*2200

Two Bracket Sequences

No submission language available for this problem.

Description

You are given two bracket sequences (not necessarily regular) ss and tt 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 SS is the regular bracket sequence, then (SS) is a regular bracket sequence;
  • if SS and TT regular bracket sequences, then STST (concatenation of SS and TT) is a regular bracket sequence.

Recall that the subsequence of the string ss is such string tt that can be obtained from ss 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.

The first line of the input contains one bracket sequence ss consisting of no more than 200200 characters '(' and ')'.

The second line of the input contains one bracket sequence tt consisting of no more than 200200 characters '(' and ')'.

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.

Input

The first line of the input contains one bracket sequence ss consisting of no more than 200200 characters '(' and ')'.

The second line of the input contains one bracket sequence tt consisting of no more than 200200 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.

Samples

Sample Input 1

(())(()
()))()

Sample Output 1

(())()()

Sample Input 2

)
((

Sample Output 2

(())

Sample Input 3

)
)))

Sample Output 3

((()))

Sample Input 4

())
(()(()(()(

Sample Output 4

(()()()(()()))