P21464 [HackerEarth] You are given an integer n find its next greater or equal number whose binary representation must not contain consecutive ones.
普及
题目描述

You are given an integer n find its next greater or equal number whose binary representation must not contain consecutive ones.

For eg. given n=6 whose binary is 110 and the next number with no consecutive ones is 8 whose binary is 1000.

INPUT

First line of input contains t, the total number of test cases. Then t line follows n.

0<t<100

0<n<10^5

OUTPUT

The next number on each line.
Register for IndiaHacksSAMPLE INPUT
2
6
2

SAMPLE OUTPUT
8
2

Register for IndiaHacks

输入格式

见题面

输出格式

见题面

样例输入
40 41 1191 164 586 659 916 372 976 1048 1018 769 997 1069 785 89 491 527 836 1125 500 307 1030 200 153 292 42 145 206 1208 151 511 748 1197 432 635 168 987 385 993 22
样例输出
72 8512 8192 8192 9216 8192 2048 9472 8192 4608