You are given a string S consisting of digits between 1 and 9, inclusive.
You can insert the letter + into some of the positions (possibly none) between two letters in this string.
Here, + must not occur consecutively after insertion.
All strings that can be obtained in this way can be evaluated as formulas.
Evaluate all possible formulas, and print the sum of the results.

-----Constraints-----
 - 1 \leq |S| \leq 10
 - All letters in S are digits between 1 and 9, inclusive.

-----Input-----
The input is given from Standard Input in the following format:
S

-----Output-----
Print the sum of the evaluated value over all possible formulas.

-----Sample Input-----
125

-----Sample Output-----
176

There are 4 formulas that can be obtained: 125, 1+25, 12+5 and 1+2+5. When each formula is evaluated,
 - 125
 - 1+25=26
 - 12+5=17
 - 1+2+5=8
Thus, the sum is 125+26+17+8=176.

Difficulty: introductory

Starter code:

Solutions:
import copy

s=input()
l=len(s)
ans=0

if l==1:
  ans+=int(s)
  print(ans)
  
else:
  for i in range(2**(l-1)):
    t=copy.deepcopy(s)
    f=[]
    ch=0
    for j in range(l-1):
      if ((i>>j)&1):
        t=t[:j+1+ch]+'+'+t[j+1+ch:]
        ch+=1
     
    if '+' in t:
      
      y=list(map(int,t.split('+')))
      for u in y:
        ans+=u
    else:
      ans+=int(t)
      
  print(ans)

s = input()
L = []
sigma = 0
def sprit_sum(string, sprit, num):
    nonlocal sigma
    for i in range(1,len(string)+num-sprit):
        str_front = string[:i]
        str_back = string[i:]
        L.append(int(str_front)) 
        if num < sprit:
            sprit_sum(str_back, sprit, num+1)
        else:
            L.append(int(str_back))
            for x in L:
                sigma += x
            L.pop()
        L.pop()
        
for j in range(len(s)):
    sprit_sum(s, j+1, 1)
sigma += int(s)
print(sigma)


S = input()
n = len(S)

def dfs(i, f):
  if i == n - 1:
    return sum(list(map(int, f.split('+'))))

  return dfs(i+1, f+S[i+1]) + dfs(i+1, f+'+'+S[i+1])

print((dfs(0, S[0])))


s = input()
l = len(s)-1
res = 0
for i in range(2**l):
    t = s[0]
    for j in range(l):
        if i&(1<<j):
            t += "+"
        t+=s[j+1]
    res += eval(t)
print(res)

S = input()
l = len(S)
ans = 0
for i in range(l):
    for j in range(i+1,l+1):
        temp = int(S[i:j])
        ans += temp * max(1,pow(2,i-1)) * max(1,pow(2,l-j-1))
print(ans)

import itertools
S = input()
npm = len(S) - 1
sum = eval(S)
pcomb = []
for i in range(npm):
    pcomb.append(list(itertools.combinations(list(range(1, npm + 1)), i + 1)))
for j in pcomb:
    k = 0
    for l in range(len(j)):
        pcomb2 = j[k]
        npmc = 0
        F = S
        for m in pcomb2:
            F = F[:m + npmc] + "+" + F[m + npmc:]
            npmc += 1
        sum += eval(F)
        k += 1
print(sum)


S=input()
N=len(S)
ans=0
for i in range(2**(N-1)):
    Bit = list(i+1 for i in range(N-1))
    for j in range(N-1):
        if (i >> j) & 1:
            Bit[j] = 0
    Bit=[b for b in Bit if b>0]
    L=0
    for b in Bit:
        ans+=int(S[L:b])
        L=b
    ans+=int(S[L:])
print(ans)

def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split('+'))))

    return dfs(i + 1, f + a[i + 1]) + dfs(i + 1, f + '+' + a[i + 1])


a = input()
n = len(a)

print((dfs(0, a[0])))


s = input()
len_s = len(s)

total = int(s)
eval_s = ""
insert_list = []
for i in range(1, 2 ** (len_s - 1)):
  # print(i)
  for j in range(len_s):
    eval_s += s[j]
    if ((i >> j) & 1):
      # print(i, j)
      eval_s += "+"
  # print(eval_s)
  total += eval(eval_s)
  eval_s = ""
print(total)


a=list(input())
ans=0
for i in range(2**(len(a)-1)):
    s=a[0]
    for j in range(len(a)-1):
        if i%2:s+='+'
        s+=a[j+1]
        i//=2
    ans+=eval(s)
print(ans)

S = input()
n = len(S)
 
ans = 0
 
for i in range(2**(n-1)):
    t = S[0]
    for j in range(n-1):
        if (i>>j)&1:
            t += "+"
        t += S[j+1]
    ans += eval(t)
 
print(ans)

s=input()
n=len(s)
ans=0
for i in range(2**(n-1)):
    x=[0]*(n-1)
    k=i
    for j in range(n-1):
        x[j]+=k//(2**(n-2-j))
        k-=2**(n-2-j)*(k//(2**(n-2-j)))
    a=s[0]
    for j in range(n-1):
        if x[j]==0:
            a=a+s[j+1]
        else:
            ans+=int(a)
            a=s[j+1]
    ans+=int(a)
print(ans)

S=input()
l=len(S)
ls=''
for i in range(1,l):ls+=str(i)
sa=['']*(2*l-1)
for i in range(len(sa)):
    if i%2==0:
        sa[i]=S[i//2]

import copy
import itertools as it
ans=0
for i in range(l):
    for j in list(it.combinations(ls, i)):
        sx=copy.copy(sa)
        for k in j:
            k=int(k)
            sx[2*k-1]='+'
        ans+=eval(''.join(sx))
print(ans)

s = input()
n = len(s) - 1
res = 0
for i in range(1 << n):
    num_str = s[0]
    for j in range(n):
        if i >> j & 1 == 0:
            num_str += s[j + 1]
        else:
            res += int(num_str)
            num_str = s[j + 1]
    res += int(num_str)

print(res)


import copy

s=list(input())
a=[]
for i in range(len(s)):
    a.append(s[i])
    if i !=len(s)-1:
        a.append("")

ans=0

for i in range(2**(len(s)-1)):
    l=copy.deepcopy(a)
    for j in range(len(s)-1):
        if (i>>j&1):
            l[2*j+1]="+"
    ans+=eval("".join(l))

print(ans)

s = input()
l = len(s)


def dfs(i, x):
    if i == l - 1:
        return eval(x)
    rep0 = dfs(i + 1, x + s[i + 1])
    rep1 = dfs(i + 1, x + "+" + s[i + 1])
    return rep0 + rep1


ans = dfs(0, s[0])
print(ans)


s = input()
n = len(s)

ans = 0
for bit in range(1 << n-1):
    tmp = s[0]
    for i in range(n-1):
        if bit & (1 << i):
            tmp += "+"
        tmp += s[i+1]
    
    ans += sum(map(int,tmp.split("+")))

print(ans)

S = input()
n = len(S)
ans = 0
for i in range(n):
  a = int(S[i])
  for j in range(n-i):
    ans += a * 10**j * 2**i * 2**(max(0,n-i-j-2))
print(ans)

N = str(int(input()))
total = 0
l = len(N)-1
if l == 0:
    print(N)
else:
    for i in range(2**l):
        b = format(i, '0'+str(l)+'b')
        subtotal = 0
        s = N[0]
        for j in range(len(b)):
            if int(b[j]):
                subtotal += int(s)
                s = N[j+1]
            else:
                s += N[j+1]

        subtotal += int(s)
        total += subtotal

    print(total)

s = input()
s_sum = []
for i in range(2**(len(s)-1)):
    sj = 0
    a = 0
    for j in range(len(s)-1):
        if ((i>>j) & 1):
            a += int(s[sj:j+1])
            sj = j+1
    a += int(s[sj:])
    s_sum.append(a)
print(sum(s_sum))  

from itertools import product
s=input()
a=0
for p in product((0,1),repeat=len(s)-1):
    t=s[0]
    for i,b in enumerate(p,start=1):
        if b==1:
            t+='+'+s[i]
        else:
            t+=s[i]
    a+=eval(t)
print(a)


s = list(input())
n = len(s)
ans = 0

for i in range(2**(n-1)):
    temp = s[0]
    for j in range(n-1):
        if i>>j & 1:
            temp += "+" + s[j+1]
        else:
            temp += s[j+1]
    ans += eval(temp)

print(ans)


s = input()
ans = ''
for i in range(1 << (len(s) - 1)):
    ans += s[0]
    for j in range(len(s) - 1):
      if i >> j & 1:
        ans += ' '
      ans += s[j+1]
    ans += ' '
print(sum(map(int, ans.split())))

#
# abc045 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """125"""
        output = """176"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """9999999999"""
        output = """12656242944"""
        self.assertIO(input, output)


def resolve():
    S = input()
    L = len(S)

    ans = 0
    for bit in range(1 << L-1):
        s = ""
        for i in range(L):
            if 1 << i & bit:
                s += S[i]
                s += "+"
            else:
                s += S[i]
        ans += eval(s)

    print(ans)


def __starting_point():
    # unittest.main()
    resolve()

__starting_point()

s = input()
n = len(s)
ans = 0
for i in range(2**(n-1)):
    t = []
    x = i
    for j in range(n-1):
        t.append(s[j])
        if x % 2 != 0:
            t.append('+')
        x = x // 2
    t.append(s[-1])
    m = 0
    for i in t:
        if i != '+':
            m *= 10
            m += int(i)
        else:
            ans += m
            m = 0
    ans += m
print(ans)

S = input()
f = lambda x: 2**(x-1) if x > 0 else 1
lenS = len(S)
ans = 0
for i in range(1,lenS+1):
    for j in range(lenS-i+1):
        ans += int(S[j:j+i]) * f(j) * f(lenS-j-i) 
print(ans)

s = input()
ans = 0

for bit in range(1 << len(s)-1):
  f = s[0]

  for i in range(len(s)-1):
    if (bit & (1 << i)):
        f += '+'
    f += s[i+1]
  ans += sum(map(int, f.split('+')))
    
print(ans)

S = input()
ans = 0

for i in range(2**(len(S)-1)):
    tmp = S[0]
    for j in range(len(S)-1):
        if i & (1 << j):
            tmp += '+'
        tmp += S[j+1]
    ans += eval(tmp)
print(ans)


s = input()
n = len(s)


def dfs(now, total, i):
    if i == n:
        return total + now
    else:
        res = 0
        res += dfs(now * 10 + int(s[i]), total, i + 1)
        res += dfs(int(s[i]), total + now, i + 1)
        return res


print((dfs(int(s[0]), 0, 1)))


from itertools import product
S = input()
if len(S)==1:
    print(int(S))
else:
    Sum = 0
    for TR in product([0,1],repeat=(len(S)-1)):
        Op = ['+' if TO==1 else '' for TO in TR]+['']
        Sum += eval(''.join([TS+TO for TS,TO in zip(S,Op)]))
    print(Sum)

s = input()
n = len(s)-1
ans = 0
for i in range(2**n):
    op = [0]*n
    for j in range(n):
        if ((i >> j) & 1):
            op[j] = 1
    t = s[0]
    for j in range(1,n+1):
        if op[j-1] == 1:
            t += '+' + s[j:j+1]
        else:
            t += s[j:j+1]
    ans += sum(list(map(int,t.split('+'))))
print(ans)

def hojyu(a):
  if len(a)!=N:
    return "0"*(N-len(a))+a
  else:
    return a
S=input()
N=len(S)-1
R=list()
ans=0
for i in range(2**N):
  s=str(bin(i)[2:])
  s=hojyu(s)
  b=0
  mae=0
  for k in range(len(s)):
    if s[k]=="1":
      b+=int(S[mae:k+1])
      mae=k+1
  b+=int(S[mae:])
  ans+=b
print(ans)

s = input()
all_s = []
def ss(index, perm):
    if index == len(s):
        all_s.append(perm)
    else:
        perm1 = [i for i in perm]
        perm1[-1] += s[index]
        ss(index+1, perm1)

        perm2 = [i for i in perm]
        perm2.append(s[index])
        ss(index+1, perm2)

ss(1, [s[0]])
all_sum = 0
for way in all_s:
    tmp = 0
    for n in way:
        tmp += int(n)
    all_sum += tmp
print(all_sum)


from itertools import product
S = input()
total = 0
length = len(S)
List = list(product([0,1],repeat=length -1))
formula = ""
for item in List:
  formula = S[0]
  for i in range(length-1):
    if item[i] == 0:
      formula += S[i+1]
    else:
      formula += '+'+S[i+1]
  total += eval(formula)
print(total)

S = input()

n = len(S)

ans = 0
for i in range(2**(n-1)):
    tmp = 0
    t = 0
    for j in range(n-1):
        if (i>>j)&1: 
            tmp += int(S[t:j+1])
            t = j+1
    tmp += int(S[t:])
    ans += tmp
print(ans)


S=input()
l=len(S)

ls=[i for i in range(1,l)]
    
sa=[]
for i in range(len(S)):sa+=[S[i],'']
sa=sa[:-1]

import copy
import itertools as it
ans=0
for i in range(l):
 for j in it.combinations(ls, i):
    sx=copy.copy(sa)
    for k in j:sx[2*k-1]='+'
    ans+=eval(''.join(sx))
print(ans)

s = input()
l = len(s)
ans = 0
for i in range(2 ** (l-1)):
    tmp = ''
    sum = 0
    for j in range(l-1):
        tmp += s[j]
        if i >> j & 1:
            sum += int(tmp)
            tmp = ''
    sum += int(tmp + s[-1])

    ans += sum
print(ans)

S=input()
l=len(S)

import itertools as it
a=0
for i in range(l):
 for j in it.combinations(range(1,l), i):
  t='';p=0
  for k in j:
    t+=S[p:k]+'+'
    p=k
  t+=S[p:]
  a+=eval(''.join(t))
print(a)

#!/usr/bin/env python
# coding: utf-8

# In[3]:


from itertools import product


# In[16]:


S = input()


# In[17]:


length = len(S)
ans = 0
for lst in product(["+",""], repeat=length-1):
    mystr = ""
    for i in range(length-1):
        mystr += S[i]+lst[i]
    mystr += S[-1]
    mylist = [int(x) for x in mystr.split("+")]
    ans += sum(mylist)
print(ans)


# In[ ]:






S = str(input())
ans = 0
for i in range(2**(len(S)-1)):
  s = S[0]
  for j in range(len(S)-1):
    if (i>>j) & 1:
      s += '+'
    s += S[j+1]
  ans += eval(s)
print(ans)

s = str(input())
ans = 0
for i in range(2**(len(s) - 1)):
    l = s[0]
    for j in range(len(s)-1):
        if (i >> j) & 1:
            l += "+"
        l += s[j+1]
    ans += eval(l)#eval関数は文字列を数式としてその解を返す
print(ans)

S=input()
n=len(S)
ans=0
 
for paint in range(2**(n-1)):
	temp_S=S[0]
 
	for i in range(n-1):
		if (paint>>i)&1==1:
			temp_S+="+"
		temp_S+=S[i+1]
 
	ans+=sum(map(int, temp_S.split("+")))
print(ans)

s = input()

total = 0

for i in range(len(s)):
  for j in range(len(s) - i):
    n = int(s[j:j+i+1])
    if j == 0 or j == len(s) - i - 1:
      total += n * max([(2 ** (len(s) - i - 2)), 1])
    else:
      total += n * max([(2 ** (len(s) - i - 3)), 1])
      
print(total)

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math

#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
s = input()
ans = 0
for bit in range(1 << len(s)-1):
    st = s[0]
    wa = 0
    for i in range(len(s)-1):
        if bit & (1 << i):
            wa += int(st)
            st = s[i+1]
        else:
            st += s[i+1]
    ans += wa + int(st)
print(ans)


s = input()
n = len(s)
ans = 0

for i in range(2 ** (n - 1)):
    k = 0
    num_list = []
    for j in range(n):
        if (i >> j) & 1:
            num = s[k : j + 1]
#             print(num)
            k = j + 1
            num_list.append(int(num))
#             print(num_list)
    num = s[k : n +1]
    num_list.append(int(num))
    ans += sum(num_list)
print(ans)

s = input()
n = len(s)
def dfs(i, f):
    if i == n-1:
        return sum(list(map(int,f.split('+'))))
    return dfs(i+1, f+s[i+1]) + dfs(i+1, f+'+'+s[i+1])
print(dfs(0, s[0]))

s = input()

n = len(s)-1
ans = 0
for i in range(2**n):
  t = s[0]
  for j in range(n):
    if i >> j & 1: t += "+" # 該当する場合のみ"+"を追加する
    t += s[j+1] # 次の文字を追加
  ans += eval(t) # 生成した文字列を計算
print(ans)

def dfs(i, f):
    if i == n-1:
        return sum(list(map(int, f.split("+"))))

    return dfs(i+1, f + "+" + s[i+1]) + dfs(i+1, f + s[i+1])


s = input()
n = len(s)

print(dfs(0, s[0]))

S=(input())
len_S=len(S)
ans=0
left=0
is_plus=[0]*(len_S-1)
for i in range(2**(len_S-1)):
    left=0
    for j in range(len_S-1):
        i,mod=divmod(i,2)
        if mod==1:
            #print(left,j)
            ans+=int(S[left:j+1])
            left=j+1
    ans+=int(S[left:len_S])
print(ans)

s = input()
n = len(s)

ans = 0

for bit in range(1 << (n - 1)):
    # 各場合で式 f を生成する
    f = s[0]

    for i in range(n - 1):
        if bit & (1 << i):
            # フラグが立っているならば "+" を式の末尾に追加する
            f += "+"
        f += s[i + 1]

    ans += sum(map(int, f.split("+")))

print(ans)

# 毎回挿れるか挿れないかの二択の探索をしてみる
# 2値なのでbit全探索をやってみる
# 逆ポーランド必要か？と思ったけど加算だけだしいらんかったわ助かる
s = input()
ans = 0
for bit in range(0, 1 << len(s) - 1):
    opr = []
    for i in range(len(s) - 1):
        opr.append("水着" if bit >> i & 1 == 1 else "ワンピース")
    exp = [s[0]]
    for i in range(len(opr)):
        if opr[i] == "ワンピース":
            exp[-1] += s[i + 1]
        elif opr[i] == "水着":
            exp.append(s[i + 1])
    ans += sum(list(map(int, exp)))
print(ans)


S = input()
ans = 0

for i in range(0,2**(len(S)-1)):
  tmp = S
  cnt = 0
  for j in range(0,len(S)):
    if ( i >> j ) & 1:
      cnt += 1
      tmp = tmp[0:j+cnt] + '+' + tmp[j+cnt:]
  ans += eval(tmp)
print(ans)

S = input()

n = len(S)

def dfs(i,f):
    if i == n-1:
        return sum(list(map(int, f.split("+"))))

    return dfs(i+1, f+S[i+1]) + dfs(i+1, f+"+"+S[i+1])
print(dfs(0, S[0]))

s = input()
nums = []

f = "0"+str(len(s)-1)+"b"

for i in range(2**(len(s)-1)):
    m = format(i, f)

    l = 0
    r = 0
    while r < len(m):
        if m[r] == "1":
            nums.append(s[l:r+1])
            l = r+1
        r += 1

    nums.append(s[l:r+1])

print(sum(map(int, nums)))

n = input()
opr = len(n) - 1
cal_sum = 0
for i in range(2**opr):
  op = [""] * opr
  for j in range(opr):
    if((i>>j)&1):
      op[opr-1-j] = "+"
  cal = ""
  for x,y in zip(n,op+[""]):
    cal += x+y
  cal_sum += eval(cal)
print(cal_sum)

def dfs(i,sall):
    if i == lenS:
        return (sall)
        #return sum(map(int,(s[0]+sall).split("+")))
    return dfs(i + 1,sall+"+"+s[i])+"+"+dfs(i + 1,sall+s[i])

s = input()
lenS = len(s)
print(sum(map(int,dfs(1,s[0]).split("+"))))

# n-1箇所に+をいれるかいれないかなのでbit全探索が可能
s = list(input())
ans = 0
for bit in range(1 << len(s) - 1):
    a = [int(s[0])]
    for i in range(len(s) - 1):
        if (bit >> i) & 1 == 1:
            a.append(int(s[i + 1]))
        else:
            a[-1] = 10 * a[-1] + int(s[i + 1])
    ans += sum(a)
print(ans)


s = input()
n = len(s)

ans = 0

for i in range(2**(n-1)):
  f = s[0]
  
  for j in range(n-1):
    if i & (1<<j):
      f += '+'
    f += s[j+1]
    
  ans += sum(map(int, f.split('+')))
  
print(ans)

def dfs(i, f):
    if i == n-1: #もし枝が最後のけたに到達したら、という条件式
        return sum (list(map(int, f.split('+'))))
    
    #式fの末尾に'+'を追加する/追加しないをして次の数字を追加
    return dfs(i+1, f+s[i+1]) + dfs(i+1, f+'+'+s[i+1])
s = input()
n = len(s)
print((dfs(0, s[0])))


S = list(input())
N = len(S)-1
ans = 0
for i in range(1 << N):
    a = S[0]
    for j in range(N):
        if(i >> j) & 1 == 0:
            a += S[j+1]
        else:
            x = int(a)
            ans += x
            a = S[j+1]
    x = int(a)
    ans += x
print(ans)


S = input()
n = len(S)

ans = 0

for i in range(2**(n-1)):
    t = S[0]
    for j in range(n-1):
        if (i>>j)&1:
            t += "+"
        t += S[j+1]
    ans += eval(t)

print(ans)

a = input()

n = len(a)
ans = 0
for i in range(2**(n-1)):
    f = a[0]
    for j in range(n-1):
        if ((i >> j) & 1):
            f += '+'
        f += a[j+1]

    ans += sum(map(int, f.split('+')))

print(ans)

from itertools import product

S = list(input())
N = len(S)

ans = 0
for adds in product([0, 1], repeat=N - 1):
    eqn = [""] * (2 * N - 1)
    eqn[::2] = S[:]
    for i, has_add in enumerate(adds):
        if has_add:
            eqn[2 * i + 1] = "+"
        else:
            eqn[2 * i + 1] = ""
    ans += eval("".join(eqn))
print(ans)


s = input()
n = len(s)

def dfs(i, tmp):
    if i == n-1:
        return sum(list(map(int,tmp.split("+"))))
    
    return dfs(i+1, tmp + s[i+1]) + dfs(i+1, tmp + "+" + s[i+1])

print(dfs(0,s[0]))

s = input()

ans = 0

for i in range(1<<(len(s)-1)):
    t = list(s)
    for b in range(len(s)-1):
        if((i>>b)&1):
            t[b] = t[b] + '+'
    ans += eval(''.join(t))
print(ans)







import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

s=SI()
ans=0
for b in range(1<<(len(s)-1)):
    f=""
    for i,c in enumerate(s):
        f+=c
        if b>>i&1:f+="+"
    ans+=eval(f)
print(ans)


S = input()
ans = 0
for i in range(2**(len(S)-1)):
    tmp = int(S[0])
    for j in range(1, len(S)):
        if i & 1 == 1:
            ans += tmp
            tmp = int(S[j])
        else:
            tmp = tmp*10+int(S[j])
        i = i >> 1
    ans += tmp
print(ans)




s = input()
ans = 0
for i in range(2**(len(s)-1)):
    t = 0
    for j in range(len(s)-1):
        if (i >> j)&1:
            ans += int(s[t:j+1])
            t = j+1
    ans += int(s[t:])
print(ans)

#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

s = ins()
n = len(s)
ans = 0
for i in range(2**(n-1)):
    z = []
    head = 0
    for j in range(n-1):
        if (i>>j)%2>0:
            z.append(int(s[head:j+1]))
            head = j+1
    z.append(int(s[head:]))
    ans += sum(z)
print(ans)


def dfs(i,sum1):
    nonlocal ss
    #print(i,sum1)
    if i == len(s):
        return sum(list(map(int,sum1.split("+"))))
    return dfs(i + 1, sum1 + s[i]) + dfs(i + 1, sum1 + "+" +s[i])


s = input()
ss = 0
print(dfs(1,s[0]))

def dfs(i,sum1):
    if i == len(s):
        return sum(list(map(int,sum1.split("+"))))
    return dfs(i+1,sum1 + "+" + s[i])+dfs(i+1,sum1 + s[i])
s = input()#一以上9以下
print(dfs(1,s[0]))

s=input()
import itertools
l=[*itertools.accumulate(s)]
o=[]
for b in range(1<<len(s)-1):
  q=[]
  p=0
  for i in range(len(s)-1):
    if b&(1<<i):
      q+=int(l[i][p::]),
      p=i+1
  c=l[-1][p::]
  c=c if c else 0
  q+=int(c),
  o+=sum(q),
print(sum(o))

s = input()
n = len(s)

ans = 0

for i in range(2**(n-1)):
  f = s[0]
  for j in range(n-1):
    if i & (1<<j):
      f += '+'
    f += s[j+1]
    
  ans += sum(map(int, f.split('+')))
  
print(ans)

from itertools import product

S=input()
N=len(S)
S2=S[0]
for i in range(N-1):
  S2 += '{}'+S[i+1]

ans=0
for p in product(['','+'],repeat=N-1):
  ans += eval(S2.format(*p))
  
print(ans)

S = input()
n = len(S)

ans = 0
for bit in range(1 << (n-1)):
    tmp = S[0]
    for i in range(n-1):
        if bit & (1 << i):
            tmp += "+"
        tmp += S[i+1]
    
    ans += sum(map(int, tmp.split("+")))

print(ans)

from functools import reduce

def original_sum(X, init):
    goukei = 0
    if(len(X) == 0):
        #print("aaa")
        #print(sum(init))
        return sum(init)
    else:
        for i in range(len(X)):
            lstm = init.copy()
            #print(len(X))
            num = int(reduce(lambda x, y: x + y, [str(x) for x in X[0:i+1]]))
            #print(num)
            #init = num
            lstm.append(num)
            Y = X[i+1:len(X)].copy()
            #print(len(Y))
            #if(len(X)-i-1 != 0):
            goukei = goukei + original_sum(Y, lstm)
            #else:
                #sum = sum + (len(X)-i-1)num + original_sum(Y)
            #print(sum)

    return goukei


number = list(input())
init = []
print(original_sum(number, init))

num = int(input())

def the_algorithm(num):
    ary = list(str(num))
    sum = 0

    for bit in range(1 << (len(ary) - 1)):
        tmp = [ary[0]]
        for i in range((len(ary) - 1)):
            mask = 1 << i

            if bit & mask:
                tmp.append(ary[i + 1])
            else:
                tmp[-1] = tmp[-1] + ary[i + 1]

        for i in tmp:
            sum += int(i)

    return sum

print(the_algorithm(num))

import sys
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(mi())


def main():
    s= input()
    n = len(s)
    ans = 0
    for i in range(1<<(n-1)):
        idx = [0]
        for j in range(n-1):
            if (i>>j)&1:
                idx.append(j+1)
        idx.append(n)
        for j in range(1, len(idx)):
            ans += int(s[idx[j-1]:idx[j]])
    print(ans)


def __starting_point():
    main()
__starting_point()

from itertools import product
s=input()
n=len(s)
ans=0
for p in product([0,1], repeat=n-1):
  wk=s[0]
  index=0
  for i in p:
    index+=1
    if i==0:
      wk+=s[index]
    else:
      ans+=int(wk)
      wk=s[index]
  if wk!="":
    ans+=int(wk)
print(ans)

S = input()
n = len(S)-1
result = 0
for i in range(2 ** n):
    sum = 0
    temp = ''
    for j in range(n):
        temp += S[j]
        if (i >> j) & 1:
            sum += int(temp)
            temp = ''
    sum += int(temp+S[-1])
    result += sum
print(result)

ss=input()
l=len(ss)-1
ans=0
for i in range(2**l):
    s=ss
    for j in reversed(range(l)):
        if i&(2**j)>0:
            s=s[:j+1]+" "+s[j+1:]
    num=list(map(int,s.split(" ")))
    ans+=sum(num)
print(ans)

class Combination:
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fac = [1 for i in range(self.n + 1)]
        self.finv = [1 for i in range(self.n + 1)]
        for i in range(2, self.n+1):
            self.fac[i] = (self.fac[i - 1] * i) % self.mod
            self.finv[i] = (self.finv[i-1] * pow(i, -1, self.mod)) % self.mod

    def comb(self, n, m):
        return self.fac[n] * (self.finv[n-m] * self.finv[m] % self.mod) % self.mod
def iparse():
    return list(map(int, input().split()))

def __starting_point():
    s = input()
    ans = 0
    for i in range(1 << (len(s) - 1)):
        prev = 0
        for j in range(len(s) - 1):
            if (i >> j) & 1 == 1:
                tmp = s[prev:j + 1]
                ans += int(tmp)
                prev = j+1
        ans += int(s[prev:])
    print(ans)
            
        
    

__starting_point()


n = str(input())

len_n = len(n)-1

ans = 0
total = 0

for i in range(2**len_n):
    temp = n[0]
    for j in range(len_n):
        if (i >> j) & 1:
            temp += '+'
        temp += n[j+1]
    total = list(map(int, temp.split('+')))
    ans += sum(total)

print(ans)

S=input()
l=len(S)
ls=[i for i in range(1,l)]
    
import itertools as it
a=0
for i in range(l):
 for j in it.combinations(ls, i):
  t='';p=0
  for k in j:
    t+=S[p:k]+'+'
    p=k
  t+=S[p:]
  a+=eval(''.join(t))
print(a)

S=input()
N=len(S)

ans=2**(N-1)*int(S[-1])
for i in range(1<<(N-1)):
    res=1
    for j in range(N-1):
        if (i>>j)%2==1:
            res*=10
        else:
            res=1
        ans+=res*int(S[N-2-j])
print(ans)


s = input()
n = len(s) - 1

ans = 0
for i in range(2 ** n):
    first = ''
    for j in range(n):
        if ((i >> j) & 1):
            ans += int(first + s[j])
            first = ''
        else:
            first += s[j]
    ans += int(first + s[-1])
print(ans)

S = input()
ans = 0
for i in range(2**(len(S)-1)):
    ls = []
    index = 0
    for j in range(len(S)-1):
        if ((i >> j) & 1):
            ls.append(int(S[index:j+1]))
            index = j+1
    ls.append(int(S[index:]))
    ans += sum(ls)
print(ans)

s = input()
n = len(s)

def dfs(i,tmp):
    if i == n-1:
        return sum(list(map(int,tmp.split("+"))))
    
    return dfs(i+1, tmp+s[i+1]) + dfs(i+1,tmp+"+"+s[i+1])

print(dfs(0,s[0]))

from itertools import product
s = input()
n = len(s)
ans = 0
for lst in product(['x', ' '], repeat=n-1):
    ss = ''
    for i in range(n-1):
        ss += (s[i] + str(lst[i]))
    ss += s[-1]
    ss = ss.replace('x', '')
    temp = [int(x) for x in ss.split()]
    ans += sum(temp)
print(ans)

import math
import collections
from itertools import product

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

s = list(input())
n = len(s)
ans = 0
for p in product((0,1), repeat=n):
    total = 0
    for i in range(n):
        if p[i] == 1:
            ans += total
            total = 0
        else:
            total = total*10 + int(s[i])
    ans += total
print(ans)

def cal():
    s = input()
    num, ans = len(s)-1, 0
    for i in range(2**num):
        count0, count1 = 0, 0
        for j in range(num):
            count1 += 1
            if (i>>j)&1:
                ans += int(s[count0:count1])
                count0 = count1
        ans += int(s[count0:count1+1])
    print(ans)
cal()



import itertools
n = input()
l = len(n)
ans = 0
for ope in itertools.product("_+", repeat = l - 1):
    num = n[0]
    for i in range(l - 1):
        if ope[i] == "+":
            num += n[i + 1]
        else:
            ans += int(num)
            num = n[i + 1]
    ans += int(num)
print(ans)

s = input()
n = len(s)
ans = 0

for bit in range(1 << (n-1)):#n-1個+を入れる場所がある。
    f = s[0]

    for i in range(n-1):
        if bit & (1<<i):
            f += "+"  #フラグが立っているのなら＋を挿入
        f +=s[i+1]

    ans += sum(map(int, f.split("+")))

print(ans)

s = input()
n = len(s)
ans = 0
for i in range(n):
    a = int(s[i])
    for j in range(n-i):
        ans += a * 10**j * 2**(max(0,n-i-j-2)) * 2**(i)
print(ans)

import itertools
s = input()
n = len(s)-1
ans = 0
for v in itertools.product(["+", ""], repeat=n):
    x = s[0]
    for i in range(n):
        x += v[i] + s[i+1]
    ans += eval(x)
print(ans)

S = input()
L = []
for i in range(len(S)):
    L.append(S[i])

n = len(S)
ans = []
for i in range(2 ** (n - 1)):
    obj = []
    for j in range(n - 1):
        if (i >> j) & 1:
            obj.append(j)
        else:
            obj.append(-1)
    # print(obj)
    s = ''
    s += L[0]
    for j in range(len(obj)):
        if obj[j] == -1:
            s += L[j + 1]
            continue
        else:
            s += '+'
            s += L[j + 1]
    # print(s)
    idx = 0
    now = 0

    while True:
        if now == len(s) - 1:
            ans.append(int(s[idx:]))
            break
        if s[now] == '+':
            ans.append(int(s[idx:now]))
            idx = now + 1
            now = idx
        else:
            now += 1
print((sum(ans)))


s=input()
ans=0
for i in range(2**(len(s)-1)):
    num=s[0]
    for j in range(len(s)-1):
        if (i>>j) & 1:
            ans+=int(num)
            num=""
        num+=s[j+1]
    if len(num)!=0:
        ans+=int(num)
print(ans)