All problems

Binary to Decimal

easyPythonMathStrings

An electronics kit has a row of switches, each either off or on, and its companion app shows the setting as a row of 0s and 1s. Beginners cannot tell what number that row stands for. Binary writes a number using only those two symbols: reading from the right, the places are worth 1, 2, 4, 8, 16 and so on, each place twice the one to its right.

Task: Read a row of switch positions and print the ordinary base-10 number it stands for.

Input

A single line holding a string of 1 to 32 characters, each of them either 0 or 1.

Output

One line holding a single integer — the value of that row in ordinary base-10.

Example:

Input:
1011

Output:
11

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…