#include <cstdio>

long long S;
long long dfs(long long x, long long ex)
{
	long long t = x % 10, ans = x + ex, p = 10; x /= 10;
	for (; x; t += (x % 10) * p, x /= 10, p *= 10)
		ans += dfs(x, ex + t);
	return ans;
}

int main()
{
	scanf("%lld", &S), printf("%lld\n", dfs(S, 0));
	return 0;
}