#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

long long sum;
string s;
bool add[10];

void go(int p){
	if(p==s.length()-1){
		string now;
		for(int i=0;i<s.length();i++){
			now.push_back(s[i]);
			if(add[i]){
				long long tmp;
				sscanf(now.c_str(),"%I64d",&tmp);
				now.clear();
				sum+=tmp;
			}
		}
		long long tmp;
		sscanf(now.c_str(),"%I64d",&tmp);
		sum+=tmp;
	}
	else{
		go(p+1);
		add[p]=true;
		go(p+1);
		add[p]=false;
	}
}

int main(){
	cin>>s;
	go(0);
	cout<<sum<<endl;
	return 0;
}
