D

Simple Adjacency Maximization

Input: Standard Input

Output: Standard Output

 

Find the smallest integer N that has both of the following properties:

 

1.      The binary representation of N has exactly P 1s & exactly Q 0s. (Leading Zeroes are allowed).

2.      The number of 1s adjacent to one or more 0 in the binary representation is maximized.

 

Input

The first line of the input file contains a single integer C, the number of test cases in the input file. Each of the next C lines contains two non-negative integers P & Q (1<=P+Q<=50).

 

Output

For each test case a print the value of N, as explained in the statement, in a line by itself.

 

Sample Input                            Output for Sample Input

3

4 3

1 1

3 2

45

1

13


Problemsetter: Mohammad Mahmudur Rahman

Special Thanks: Sabbir Yousuf Sanny