A number system with fixed radix r uses only the digits {0,1,…,r−1}. The digit sequence (xn−1,xn−2,…,x0) has the value
X=∑i=0n−1xiri
The digit sets of the three systems used here are
In radix 32, A is 10, B is 11, and in the same order V is 31.
Write a program that converts radix 32 numbers of at most 8 digits to radix 10 and to radix 2.
The first line has the number of test cases n (1≤n≤100). Each of the next n lines has one radix 32 number. Every number consists only of digits from R32 and its length is between 1 and 8. A number may start with a zero digit.
For each radix 32 number, print two lines. The first line is the radix 10 value and the second line is the radix 2 representation.
Print the radix 10 value without leading zeros. Build the radix 2 representation by turning each radix 32 digit of the input into a 5 bit binary field, padded in front with zeros when it is shorter than five bits, and concatenating those fields in input order. So an input of k digits produces a radix 2 line of exactly 5k characters.