Usually, people are accustomed to arranging all $n$-bit binary strings in lexicographical order. For example, all 2-bit binary strings arranged in ascending lexicographical order are: 00, 01, 10, 11.
Gray Code is a special method of arranging $n$-bit binary strings, which requires that any two adjacent binary strings differ by exactly one bit. Specifically, the first string and the last string are also considered adjacent.
An example of all 2-bit binary strings arranged in Gray Code order is: 00, 01, 11, 10.
There is more than one type of $n$-bit Gray Code. Below is a generation algorithm for one such Gray Code:
- A 1-bit Gray Code consists of two 1-bit binary strings in the order: 0, 1.
- The first $2^n$ binary strings of an $(n+1)$-bit Gray Code can be formed by taking the $n$-bit Gray Code generated by this algorithm (a total of $2^n$ $n$-bit binary strings) in order, and prepending a 0 to each string.
- The last $2^n$ binary strings of an $(n+1)$-bit Gray Code can be formed by taking the $n$-bit Gray Code generated by this algorithm (a total of $2^n$ $n$-bit binary strings) in reverse order, and prepending a 1 to each string.
In summary, an $(n+1)$-bit Gray Code consists of the $2^n$ binary strings of an $n$-bit Gray Code arranged in order with a prefix of 0, followed by the same strings arranged in reverse order with a prefix of 1, totaling $2^{n+1}$ binary strings. Additionally, for the $2^n$ binary strings in an $n$-bit Gray Code, we number them from $0 \sim 2^n - 1$ based on the order obtained by the above algorithm.
Following this algorithm, a 2-bit Gray Code can be derived as follows: 1. Known 1-bit Gray Code: 0, 1. 2. The first two Gray codes are 00, 01. The last two Gray codes are 11, 10. Combining them gives 00, 01, 11, 10, numbered $0 \sim 3$ respectively.
Similarly, a 3-bit Gray Code can be derived as follows: 1. Known 2-bit Gray Code: 00, 01, 11, 10. 2. The first four Gray codes are: 000, 001, 011, 010. The last four Gray codes are: 110, 111, 101, 100. Combining them gives: 000, 001, 011, 010, 110, 111, 101, 100, numbered $0 \sim 7$ respectively.
Given $n$ and $k$, please find the $k$-th binary string in the $n$-bit Gray Code generated by the above algorithm.
Input
A single line containing two integers $n$ and $k$, with meanings as described in the problem statement.
Output
A single line containing an $n$-bit binary string representing the answer.
Examples
Input 1
2 3
Output 1
10
Note 1
The 2-bit Gray Code is: 00, 01, 11, 10, numbered $0 \sim 3$, so the string at index 3 is 10.
Input 2
3 5
Output 2
111
Note 2
The 3-bit Gray Code is: 000, 001, 011, 010, 110, 111, 101, 100, numbered $0 \sim 7$, so the string at index 5 is 111.
Input 3
See code/code3.in and code/code3.ans in the contestant directory.
Constraints
For 50% of the data: $n \le 10$ For 80% of the data: $k \le 5 \times 10^6$ For 95% of the data: $k \le 2^{63} - 1$ For 100% of the data: $1 \le n \le 64$, $0 \le k < 2^n$