using System;
using static System.Console;
using static cp;
using System.Text;
using System.Linq;
using static System.Math;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var alg = new cp();
        var s = alg.inputString();
        long total = 0;
        for(long a = 0; a < (1 << (s.Length - 1)); a++)
        {
            var list = new List<string>();
            list.Add(s[0].ToString());
            for(int b = 0; b < s.Length-1; b++)
            {
                
                if ((a & (1 << b)) != 0)
                {
                    list.Add("");
                }
                list[list.Count - 1] += s[b + 1].ToString();
            }
            total += list.Sum(i=>long.Parse(i));
        }
        WriteLine(total);
    }
}

class cp
{

    public cp()
    {
    }
    public int GCD(int a, int b)
    {
        return a % b == 0 ? b : GCD(b, a % b);
    }
    public int LCM(int a, int b)
    {
        return a * b / GCD(a, b);
    }
    public int countChar(string s, string key)
    {
        return s.Length - s.Replace(key, "").Length;
    }
    public string YesNo(bool f, string type = null)
    {
        string str;
        if (f) str = "Yes"; else str = "No";
        if (type == "lower") return str.ToLower(); else if (type == "upper") return str.ToUpper(); else return str;
    }
    public void inputSkip()
    {
        ReadLine();
        return;
    }
    public string inputString()
    {
        return ReadLine();
    }
    public string[] inputSplitString()
    {
        return ReadLine().Split();
    }
    public string[] inputLinesString(int len)
    {
        var arr = new string[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine();
        }
        return arr;
    }
    public string[][] inputJaggedArrayString(int len)
    {
        var arr = new string[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split();
        }
        return arr;
    }
    public int inputInt()
    {
        return int.Parse(ReadLine());
    }
    public int[] inputSplitInt()
    {
        return ReadLine().Split().Select(i => int.Parse(i)).ToArray();
    }
    public int[] inputLinesInt(int len)
    {
        var arr = new int[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = int.Parse(ReadLine());
        }
        return arr;
    }
    public int[][] inputJaggedArrayInt(int len)
    {
        var arr = new int[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        }
        return arr;
    }
    public long inputLong()
    {
        return long.Parse(ReadLine());
    }
    public long[] inputSplitLong()
    {
        return ReadLine().Split().Select(i => long.Parse(i)).ToArray();
    }
    public long[] inputLinesLong(int len)
    {
        var arr = new long[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = long.Parse(ReadLine());
        }
        return arr;
    }
    public long[][] inputJaggedArrayLong(int len)
    {
        var arr = new long[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split().Select(i => long.Parse(i)).ToArray();
        }
        return arr;
    }
    public double inputDouble()
    {
        return double.Parse(ReadLine());
    }
    public double[] inputSplitDouble()
    {
        return ReadLine().Split().Select(i => double.Parse(i)).ToArray();
    }
    public double[] inputLinesDouble(int len)
    {
        var arr = new double[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = double.Parse(ReadLine());
        }
        return arr;
    }
    public double[][] inputJaggedArrayDouble(int len)
    {
        var arr = new double[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split().Select(i => double.Parse(i)).ToArray();
        }
        return arr;
    }
}

Measured memory_bytes: 13396