//2进制 ConvertTo 10进制
static void Main(string[] args)
{
         string input = Console.ReadLine();
         while( input != "" )
         {
       try
       {
int len = input.Trim().Length;
int values = 0;
for( int i = 0 ; i < len ; i++ )
{
values += int.Parse( input.Substring( len - i - 1 , 1 ) ) * (int)System.Math.Pow(2,i);
}
Console.WriteLine( values.ToString());
input = Console.ReadLine();
}
catch(System.Exception ex)
{
     ex.ToString();
}
}}