#include <bits/stdc++.h>
using namespace std;

string s;

long long dfs(int pos, long long now, long long ans)
{
	if (pos == s.size()) return ans * (now == 0);
	return dfs(pos + 1, now * 10 + s[pos] - '0', ans) + dfs(pos + 1, 0, ans + now * 10 + s[pos] - '0');
}

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