#include<bits/stdc++.h>

using namespace std;
using ll = long long;

string s;
ll ans = 0;
int n;

void go(int i , ll x , ll sum){
    if(i == n){
        ans += sum + x;
        return;
    }

    go(i + 1 , x*10 + ll(s[i] - '0') , sum);
    go(i + 1 , 0 , sum + x);
}

int main(){
    cin >> s;
    n = s.length();

    go(0 , 0 , 0);
    printf("%lld\n" , ans);
}
