Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/while-ikkilikdan-onlikka

Binary to decimal

Easy 1000 ms 64 MB 32%
Share

A number $n$ written in the binary numeral system is given (it consists only of the digits $0$ and $1$). Convert it to decimal: the last digit is multiplied by $2^{0}$, the one before it by $2^{1}$, the next by $2^{2}$ and so on, and everything is added up.

$$1011_{2} = 1 * 2^{3} + 0 * 2^{2} + 1 * 2^{1} + 1 * 2^{0} = 11$$

Converting binary digits to decimal by powers of two

Input

One integer $n$ (its binary notation).

Output

One integer — the value of $n$ in the decimal system.

Note

$0 \le n \le 111111111111111111$
the notation of $n$ contains only the digits $0$ and $1$

Examples

Input #1
1011
Output #1
11
Input #2
100000
Output #2
32

Sign in to submit a solution

Signing up is free and takes a minute.