Geek Challenge [SKRZAT] (Base Minus Two)#1220

Geek Challenge [SKRZAT] (Base Minus Two)

1 second
64 megabytes
Easy

Geek Challenge [SKRZAT] is an old, old game from Poland that uses a game console with two buttons plus a joystick. As is true to its name, the game communicates in binary, so that one button represents a zero and the other a one. Even more true to its name, the game chooses to communicate so that the base of the number system is minus two, not plus two, so we'll call this representation Weird Binary. Thus, the bit positions label the powers of minus two, as seen in the following five-bit tables:

Numbers are presented on the screen in Weird Binary, and then numbers are accepted in response from the console as a stream of zeroes and ones, terminated by a five-second pause.

You are to write a computer program to help the novice geek play the game by converting numbers between decimal and Weird Binary.

Input

The first line in the file gives the number of problems being posed, without any whitespace. Following are that many lines. Each line will either be a conversion into Weird Binary or out of it: the letter b indicates that the rest of the line is written in Weird Binary and needs to be converted to decimal; the letter d indicates that the rest of the line is written in decimal and needs to be converted to Weird Binary.

The input data are in the range to fit within a -bit Weird Binary number, which represents the decimal number range to , inclusive.

Output

For each conversion problem, display the type of problem, its input string, and the converted result in the format shown below, replicating even the spaces exactly as shown. Leading zeroes are not allowed.

Examples

Example 1

Loading
Loading