// たくさんの数式
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;
string s;
LL f(int w,LL sum,LL c){
    if(w==s.size()) return (sum*(c==0));
    return f(w+1,sum,c*10+s[w]-'0')+f(w+1,sum+c*10+s[w]-'0',0);
}

int main(){
    cin>>s;
    cout<<f(0,0,0)<<endl;
    return 0;
}