#T774. 进制转换 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 inclusive). 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. The input guarantees that string S contains only digits and lowercase letters and is valid, and the converted decimal number will be within the range of int.

Output Format

For each input line, output one line.

3
0x1
00
011
1
0xa



1
0
9
10




译文

CodesOnline