spoj#NBIN. New Binary
New Binary
One day Chandrima decided to make a list of all numbers starting from 1 in binary format, the list would be like 1,10,11,100,... and so on. Now she get bored of this list and decide to remove any pattern having atleast two consecutive ones and prepare a new list. The new list will be like 1,10,100,101,... and so on. She then thought if a number n is given to her can she find the nth member of the new list. After trying for some time she comes to you for help. Can you help her by writing a program for her that coud do the specified task
Input
The first line contains T(<=1000) test cases. The next T lines each contain one integer N(<=10^15) for which you need to find the Nth member of the list.
Output
Output T lines each containing the required answer.
Example
Input: 3
1
2
3</p>Output: 1
10
100