#T571. 进制转换 1

进制转换 1

Description

Convert octal and hexadecimal numbers to decimal.

Input Format

The first line contains an integer N (0 ≤ N ≤ 200,000), indicating the number of test cases. The following N lines each contain a string S (with length between 1 and 11 characters). If the string starts with "0x" (zero followed by x), it represents a hexadecimal number. If it starts with "0" (zero), it represents an octal number. There are multiple sets of input data. It is guaranteed that string S contains only digits and lowercase letters and is valid, with the converted decimal number within the range of int.

Output Format

For each input line, output one line.

3
0x1
00
011
1
0xa



1
0
9
10




Source

CodesOnline