char s[9];main(i,j,k,t){for(;~gets(s);){t=0;for(j=0;j<8;j++)t=t*2+s[j]-48;printf("%d\n",t);}}