#include<stdio.h>
#include<math.h>
int main()
{
char ch;
double re=0;
int flag=0,i=-1;
scanf("%c",&ch);
while(ch!='#')
{
if(ch!='.')
re=re*2+(ch-'0');
if(ch=='.')
{
flag=1;
break;
}
scanf("%c",&ch);
}
scanf("%c",&ch);
while(flag==1&&ch!='#')
{
re=re+pow(2,i)*(ch-'0');
i--;
scanf("%c",&ch);
}
if(flag==1)
printf("%.6lf\n",re);
else
printf("%d\n",(int)re);
return 0;
}