#include <stdio.h> #include <string.h> #include <math.h> #define MAX 32 int main(void) { char s[MAX]; while (scanf("%s", s) != EOF) { long answr = 0; int n = strlen(s); for (int i = 0; i < n; i++) { // printf("%d ", s[i] - '0'); answr += (s[i] - '0') * (pow(2, n - i) - 1); } // printf("\n"); printf("%ld\n", answr); } return 0; }