#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;
#define mod 1000000007
#define INT 2100000000

long long int foo(string & s, int index)
{
    long long int ret = 0, tmp = 0;
    for (int i = index; i < s.size(); ++i) {
        tmp = tmp * 10 + s[i] - '0';
        if (i + 1 != s.size())
            ret += tmp * (1 << (s.size() - i - 2)) + foo(s, i + 1);
        else ret += tmp;
    }
    return ret;
}

int main()
{
	//freopen("test", "r", stdin);
	string s; cin >> s;
	cout << foo(s, 0);
	return 0;
}
