Programmers consider lucky numbers to be the numbers that contain no digits other than , , and . For example, according to programmers, , , , are lucky numbers, and , , , are not.
Your task is sometimes to find the -th lucky number in ascending order, and sometimes to find the smallest lucky number greater than the given number . Write a program that correctly answers of these two types of queries.
The first line contains one integer (1 ≤ q ≤ 10^4) - the number of queries, and each of the following lines contains two integers t_i (t_i = {1, 2}) and k_i. If t_i = 1 then find the k_i-th lucky number in ascending order, and if t_i = 2 then find the smallest lucky number greater than k_i. It is known that:
if t_i = then 1 ≤ k_i ≤ 2 * 10^9,
if t_i = then 0 ≤ k_i ≤ 10^{15}.
For each query, print the answer on a new line.
Example 1
A series of lucky numbers looks like: , , , , , , , , , , , , , , , , ... .