CCONST - C style constants

For each input line, interpret if it as a hexadecimal number (if it begins with 0x), an octal number (if it begins with 0), and a decimal number otherwise, and output its value in decimal.

Score is the length of your source.

Input

The input file consists of series of numbers (as described above) one in each line.

The input is terminated by EOF.

Output

The decimal value of the given number.

Example

Input:
0146
0xcd
0x188
0611
0x37d
0x0
0x1
01
1
0x2

Output:
102
205
392
393
893
0
1
1
1
2

PS: Take care about your fingers, do not use more than 128 bytes of code.


Added by::(){ :|: & };:
Date:2010-10-04
Time limit:8.800s
Source limit:128B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 SCM qobi
Resource:From a shortening contest

hide comments
2014-01-15 14:42:28 Hallvard Norheim Bø
Do you have a newline '\n' in your source code? In that case, it can be removed.
2014-01-15 07:59:56 ওয়াসী (Wasi)
25B (python 2) seems like a dead end
No idea how to shorten one more...
May be, I'm missing an obvious trick :P

Edit: @hallvabo I know that trick ;)
but unfortunately no newline
Edit2: Indeed an obvious trick 24B finally :)

Last edit: 2014-01-16 06:56:52
2012-02-27 20:02:47 Hallvard Norheim Bø
Got it down to 157 bytes of Java, so no luck here either :(
2011-04-24 21:48:24 anonymous
Why does my solution (4923145) give WA? It works perfectly for me:
GNU bash, Version 4.1.5(1)-release (i486-pc-linux-gnu)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.