#include<cstdio>
#include<algorithm>
using namespace std;

char d[15];
long long f(long long val, long long pre, int len){
    if(d[len+1])
        return f(val+pre*10+d[len]-'0',0,len+1) + f(val,pre*10+d[len]-'0',len+1);
    return val+pre*10+d[len]-'0';
}
int main(){
    scanf("%s",d);
    printf("%lld\n",f(0,0,0));
    return 0;
}
