CF2137A.Collatz Conjecture

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Collatz Conjecture

You are doing a research paper on the famous Collatz Conjecture. In your experiment, you start off with an integer xx, and you do the following procedure kk times:

  • If xx is even, divide xx by 22.
  • Otherwise, set xx to 3x+13\cdot x+1.

For example, starting off with 2121 and doing the procedure 55 times, you get $21\rightarrow64\rightarrow32\rightarrow16\rightarrow8\rightarrow4$.

After all kk iterations, you are left with the final value of xx. Unfortunately, you forgot the initial value. Please output any possible initial value of xx.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t4001 \le t \le 400). The description of the test cases follows.

The first line of each test case contains two integers kk and xx (1k,x201 \leq k,x \leq 20).

Output

For each test case, print any possible initial value on a new line. It can be shown that the answer always exists.

Note

In the first test case, since 11 is odd, performing the procedure k=1k=1 times results in 13+1=41\cdot3+1=4, so 11 is a valid output.

In the second test case, since 1010 is even, performing the procedure k=1k=1 times results in 102=5\frac{10}{2}=5, so 1010 is a valid output.

The third test case is explained in the statement.

Samples

3
1 4
1 5
5 4
1
10
21

在线编程 IDE

建议全屏模式获得最佳体验