We define
Here, denotes the bitwise XOR operation and is a function that takes a postive integer, reverses its binary representation (without any leading zeros) and returns the resulting number. For example , ,
Given an integer , find out the value of modulo or claim that there exists a positive integer for which is undefined.
Input Format
- The first line of input contains a single integer - the number of test cases. The description of test cases follows.
- The first and only line of each test case contains a single integer .
Output Format
- For each test case output a single line containing one integer :
- if there exists a positive integer such that and is undefined
- modulo otherwise
Constraints
Sample Input 1
8
1
2
3
5
8
13
21
34
Sample Output 1
1
4
10
58
578
20098
5236738
24641495
Explanation
Note that:
Test case-1: . So answer is .
Test case-2: . So answer is .
ConversionConversion EmoticonEmoticon