URI Online Judge | 2865

Binary Palindrome

By Ricardo Martins, IFSULDEMINAS BR Brazil

Timelimit: 1

Sheldon is a scientist who loves numbers. His preferred number is number 73. One of the many reasons for this preference is that this number, in binary form, forms a palindrome (1001001), that is, the number written backwards is the same as the original form . Not every number forms a palindrome in binary form, but with a minimal calculation, that number can be transformed into a binary palindrome. For example, the number 6 does not form a binary palindrome (110), but simply add 1, that is, by making 7, form (111). Thus, given a given integer, what is the minimum operation required to make the number a binary palindrome(operation with as smaller number possible).


The input is composed of several test cases. The first line contains an integer C relative to the number of test cases. The next C lines have an integer N (1 <= N <= 10000)


For each test case of your program input, print an asterisk, - if the number is already a binary palindrome, - or the symbol of the calculation to be made, followed by a space, accompanied by the number of the respective calculation, so that make it a binary palindrome. If there is more than one calculation with the same number, follow the order of priority: +, -, x, /.

Input Sample Output Sample


/ 2
x 3
+ 3
- 5