﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _11.Binary_to_Decimal
{
    class Program
    {
        static int BinaryToDecimal(string binary)
        {
            int sum = 0;

            foreach (char bit in binary)
            {
                sum = (bit - '0') + sum * 2;
            }

            return sum;
        }

        static void Main()
        {
            string binNumber = Console.ReadLine();
            int decNumber = BinaryToDecimal(binNumber);
            Console.WriteLine(decNumber);
        }
    }
}
