Bracket sequence with 2 types of brackets#5296

Bracket sequence with 2 types of brackets

2 seconds
64 megabytes
Medium

A correct bracket sequence of two types of brackets consisting of brackets is defined as a sequence of round and square brackets that could appear in an arithmetic expression. For example, ()[]() and (())() are correct sequences, while ((())] and ([])][ are not.

All correct bracket sequences of two types can be arranged in lexicographical order, where the order of brackets is determined by their character codes: ( < ) < [ < ]. For instance, when n=2, the ordered list of correct bracket sequences is: (()), ()(), ()[], ([]), [()], [[]], [](), [][].

Your task is to find the correct bracket sequence of two types of brackets based on its lexicographical position (numbering starts from zero).

Input

You are given two numbers, and (1 \leq n \leq 20), where specifies the index of an existing correct bracket sequence of two types of brackets.

Output

Output a string containing round and square brackets that represent the required correct bracket sequence of two types of brackets.

Examples

Example 1

Loading
Loading