#include<cstdio> #include<string> #include<math.h> using namespace std; int main(){ char arr[100]; while( scanf("%s",arr) != EOF){ string buf = arr; int totalsum = 0; for (unsigned i = 0; i < buf.size(); ++i) { int num = buf[i] - '0'; totalsum = totalsum + num * (pow(2,buf.size()-i) - 1); } printf("%d\n",totalsum); } }