using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        //static int N;
        //static int[] T, A;
        static string S;


        public static void Input()
        {
            var cin = new Scanner();
            S = Console.ReadLine();
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            int N = S.Length - 1;
            if (N == 0)
            {
                Console.WriteLine(S[0] - '0');
                return;
            }

            long ans = 0;
            for(var bit = 0; bit < (1 << N); bit++)
            {
                List<int> use = new List<int>();
                use.Add(0);
                for(var i = 0; i < N; i++)
                {
                    if ((bit & (1 << i)) != 0)
                    {
                        use.Add(i + 1);
                    }
                }
                use.Add(N + 1);
                
                
                for (var i = 0; i < use.Count() - 1; i++) 
                {
                    ans += long.Parse(S.Substring(use[i], use[i + 1] - use[i]));
                }
            }

            Console.WriteLine(ans);

            //Console.Out.Flush();
        }

    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }

        public int[] MultiLineReader(int N)
        {
            int[] ret = new int[N];
            for(var i = 0; i < N; i++)
            {
                ret[i] = int.Parse(Console.ReadLine());
            }

            return ret;
        }
        public long[] MultiLineReaderL(int N)
        {
            long[] ret = new long[N];
            for (var i = 0; i < N; i++)
            {
                ret[i] = long.Parse(Console.ReadLine());
            }

            return ret;
        }

    }

    public class Graph
    {
        public void Dfs(List<List<int>> graph, bool[] seen, int v)
        {
            seen[v] = true;
            //初めて訪れたタイミングでここの処理

            foreach (var next in graph[v])
            {
                if (seen[next] == true) { continue; }
                Dfs(graph, seen, next);
            }
            //行き先がない状態になったらこの部分の処理

        }

        public void Gin(List<List<int>> graph, int size)
        {
            for (var i = 0; i < size; i++)
            {
                graph.Add(new List<int>());

            }
        }

        public void InitializeFalse(bool[] seen)
        {
            for (var i = 0; i < seen.Length; i++)
            {
                seen[i] = false;
            }
        }

        public bool AllTrue(bool[] seen)
        {
            for (var i = 0; i < seen.Length; i++)
            {
                if (!seen[i])
                {
                    return false;
                }
            }
            return true;
        }
    }
}

    



Measured memory_bytes: 13268