Hex (base-16) β Octal (base-8)
Given a hexadecimal number (base-16), you are asked to calculate the equivalent octal (base-8) number.
Decimal (base-10) | Binary (base-2) | Hex (base-16) | Octal (base-8) |
0 | 00000 | 0 | 0 |
1 | 00001 | 1 | 1 |
2 | 00010 | 2 | 2 |
3 | 00011 | 3 | 3 |
4 | 00100 | 4 | 4 |
5 | 00101 | 5 | 5 |
6 | 00110 | 6 | 6 |
7 | 00111 | 7 | 7 |
8 | 01000 | 8 | 10 |
9 | 01001 | 9 | 11 |
10 | 01010 | A | 12 |
11 | 01011 | B | 13 |
12 | 01100 | C | 14 |
13 | 01001 | D | 15 |
14 | 01010 | E | 16 |
15 | 01011 | F | 17 |
16 | 10000 | 10 | 20 |
Input
The input contains a single line representing the hex number
n
as a string (1 β€ |n| β€ 10000). Output
The output should contain a single line representing the octal representation of
n
. Examples
Input | Output |
F | 17 |
AF3 | 5363 |
Explanation
Β
Constraints
Time limit: 0.2 seconds
Memory limit: 512 MB
Output limit: 1 MB