Problem:
 Score : 300 points    Problem Statement 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 1 125      Sample Output 1 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 .       Sample Input 2 9999999999      Sample Output 2 12656242944

Solution (Python):
s = str(input())
n = len(s)
lists = []
tmp = []
Sum = 0
s_lists = []
for i in range(2 ** (n-1)):
    lists = []
    tmp = []
    cnt = 0
    s_lists = []
    int_list = []
    for k in range(n):
        s_lists.append(s[k])
    for j in range(n-1):
        if ((i >> j) & 1):
            lists.append(1)
        else:
            lists.append(0)
    for m in range(len(lists)):
        if lists[m] == 1:
            s_lists.insert(m + cnt + 1, "+")
            cnt += 1
    ss = "".join(s_lists)
    ss_list = ss.split("+")
    for h in ss_list:
        tmp = int(h)
        int_list.append(tmp)
    Sum += sum(int_list)
print(Sum)

Solution (Python):
def main():
    S = input()
    lens = len(S)

    patterns = []
    ans = 0

    if lens == 1:
        ans = int(S)
    else:
        for i in range(2 ** (lens-1)):
            x = format(i, 'b').zfill(lens-1)
            stmt = S[0]
            for i, xi in enumerate(x):
                if xi == '1':
                    stmt += '+'
                stmt += S[i+1]
            ans += eval(stmt)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    S = input()
    lens = len(S)

    patterns = []
    ans = 0

    if lens == 1:
        ans = int(S)
    else:
        for i in range(2 ** (lens-1)):
            x = format(i, 'b').zfill(lens-1)
            stmt = S[0]
            for i, xi in enumerate(x):
                if xi == '1':
                    stmt += '+'
                stmt += S[i+1]
            ans += eval(stmt)
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
from itertools import combinations

def main():
    S = input()
    n = len(S)
    a = [i for i in range(1, n)]
    ans = []
    for i in range(n):
        if i == 0:
            ans.append(int(S))
        else:
            k = list(combinations(a, i))
            for ki in k:  
                r = 0
                t = 0  
                for j, sj in enumerate(S):
                    if j in ki:
                        r += t
                        t = int(sj)
                    else:
                        t = t * 10 + int(sj)
                r += t
                ans.append(r)

    
    print(sum(ans))


if __name__ == "__main__":
    main()

Solution (Python):
s=input()
l=len(s)-1
ans=0
for i in range(2**l):
  op=['']*(l+1)
  for j in range(l):
    if ((i>>j)&1):
      op[l-1-j]='+'
  op[l]=''
  f=''
  for i in range(l+1):
    f+=s[i]+op[i]
  ans+=eval(f)
print(ans)

Solution (Python):
S = input()
I_MAX = len(S)
values = []


def calc(val, add, i):
    if i == I_MAX:
        val += add
        values.append(val)
    else:
        calc(val+add, int(S[i]), i+1)
        calc(val, 10*add+int(S[i]), i+1)


def solve():
    calc(0, int(S[0]), 1)
    print(sum(values))


if __name__ == '__main__':
    solve()

Solution (Python):
s = input()
n = len(s) - 1

res = 0
for bit in range(2**n):
    tmp = []
    for i in range(n):
        if (bit >> i) & 1:
            tmp.append('+')
        else:
            tmp.append('')
    e = ''
    for j in range(n):
        e += s[j] + tmp[j]
    else:
        e += s[n]
    res += eval(e)

print(res)

Solution (Python):
x=input()
n=len(x)
ans=[]
for i in range(2**(n-1)):
    s=format(i,"b").zfill(n-1)
    sprt=[0]
    for i in range(n-1):
        if s[i]=="1":
            sprt.append(i+1)
    sprt.append(n)
    for i in range(len(sprt)-1):
        ans.append(int(x[sprt[i]:sprt[i+1]]))
print(sum(ans))

Solution (Python):
import sys
from itertools import combinations

s = list(sys.stdin.readline().rstrip())
l = len(s)

def main():
    res = 0
    cand = range(1, l)
    for inser_cnt in range(l):
        for idces in combinations(cand, inser_cnt):
            t = s.copy()
            idces = list(idces)
            for i in idces[::-1]:
                t.insert(i, '+')
            res += eval(''.join(t))
            
    return res
                     
if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
import itertools

S = input()
T = list(itertools.product(['+',''], repeat=len(S)-1))

ans = 0
for i in range(2**(len(S)-1)):
    calc_form = S[0]
    for j in range(len(S)-1):
        calc_form += T[i][j]+S[j+1]
    ans += eval(calc_form)

print(ans)

Solution (Python):
S = list(input()) 

def plus(s,num,bef):
    bef = list(bef)
    s = list(s)
    if len(s) == num:
        bef.append(int("".join(s)))
        return sum(bef)
    else:
        
        ret = plus(s,num+1,bef)
        
        bef.append(int("".join(s[:num])))
        ret += plus(s[num:],1,bef)
        return ret

print(plus(S,1,[]))

Solution (Python):
S = input()
N = len(S) - 1

sum = 0
for k in range(1 << N):
  formula = list(S)
  str = ['' for _ in range(N)]
  for i in range(N):
    if k >> i & 1:
      str[i] = '+'
  for j in range(N):
    if str[j] == '+':
      formula.insert(2*j+1, '+')
    else:
      formula.insert(2*j+1, '')
  sum += eval("".join(formula))

print(sum)

Solution (Python):
S = input()

result = 0

op_cnt = len(S) - 1  
for i in range(2 ** op_cnt):
    op = ["-"] * op_cnt  
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"  

    
    
    formula = ""
    for p_n, p_o in zip(S, op + [""]):  
        formula += (p_n + p_o)
    result += eval(formula.replace("-",""))
    
print(result)

Solution (Python):
s = list(input())
n = len(s)

joinednum = []
sumjoined = 0
sumlist = []
def check(i,j):
    return (i>>j)%2
for i in range(1<<(n-1)):
    prejoined = [s[0]]
    for j in range(n-1):
        
        if check(i,j):
            prejoined.append(s[j+1])
        else:
            if len(prejoined)>0:
      
                joinednum.append(int("".join(prejoined)))
                prejoined = []
                prejoined.append(s[j+1])
            else:
                joinednum.append(int(s[j+1]))
    joinednum.append(int("".join(prejoined)))
    prejoined = []
    sumjoined = sum(joinednum)
    joinednum = []
    sumlist.append(sumjoined)
    sumjoined = 0

 
ans = sum(sumlist)
print(ans)

Solution (Python):
from itertools import product

s = input()

po = list(product(["", "+"], repeat=(len(s) - 1)))



ans = 0

for i in range(len(po)):
    e = ""
    for j in range(len(s) - 1):
        e = e + s[j] + po[i][j]
    e = e + s[-1]
    
    ans += eval(e)

print(ans)

Solution (Python):
S=input()
N=len(S)-1
ans=0
for i in range(2**N):
  f=S[0]
  for j in range(N):
    f+="+"*((i>>j)&1)+S[j+1]
  ans+=eval(f)
print(ans)

Solution (Python):
S=input()
N=len(S)-1

ans=0
for i in range(2**N):
  formula=""
  for j in range(N):
    formula+=S[j]
    if (i>>j)&1:
      formula+="+"
  formula+=S[N]
  ans+=eval(formula)
print(ans)

Solution (Python):
from itertools import product

s = input()

ans = 0
for i in product([1,0], repeat=len(s)-1):
    p = ""
    for j, x in enumerate(i):
        p += s[j]
        if x == 1:
            p += "+"

    p += s[-1]
    ans += eval(p)

print(ans)

Solution (Python):
S = list(input())
lenS = len(S)
ans = 0
for i in range(2 ** (lenS - 1)):
    formula = []
    for j in range(lenS):
        formula.append(S[j])
        if i >> j & 1:
            formula.append("+")
    ans += eval("".join(formula))
print(ans)

Solution (Python):
s=input()
n=len(s)
c=0
for i in range(2**(n-1)):
    a=[[int(s[0])]]
    for j in range(n-1):
        if (i>>j)&1:
            a.append([int(s[j+1])])
        else:
            a[-1].append(int(s[j+1]))
    for i, val in enumerate(a):
        for x in range(len(val)):
            c+=(10**x)*val[-(x+1)]
print(c)

Solution (Python):
S = input()
ans = 0
for i in range(2**(len(S)-1)):
    plus = []
    bit = i
    for j in range(len(S)-1):
        if bit & 1 == 1:
            plus.append(True)
        else:
            plus.append(False)
        bit = bit >> 1
    elm = []
    tmp = S[0]
    for j in range(1,len(S)):
        if plus[j-1] == True:
            elm.append(int(tmp))
            tmp = S[j]
        else:
            tmp += S[j]
    if tmp != '':
        elm.append(int(tmp))

    ans += sum(elm)
print(ans)

Solution (Python):
from collections import deque
S=list(input())
op_cnt = len(S)-1  
sum_=0
for i in range(2 ** op_cnt):
    op = [""] * op_cnt  
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"  
    op=deque(op)
    T=deque()
    
    for i in range(op_cnt):
        T.append(S[i])
        T.append(op.popleft())
    T.append(S[-1])
    sum_ += eval("".join(T))
print(sum_)

Solution (Python):
import copy

s = input()
l = len(s) - 1
count = 0

for i in range(2**l):
  code = list(copy.deepcopy(s))
  bin_str = bin(i).replace('0b', '').zfill(l)
  
  plus_count = 0
  for j in range(len(bin_str)):
    if bin_str[j] == '1':
      code.insert(j+1+plus_count,'+')
      plus_count += 1
      
  code = ''.join(code)
  if '++' in code:
    continue
    
  count += eval(''.join(code))
  
print(count)

Solution (Python):





s = list(input())

ans = 0

for i in range(1<<len(s)-1):
    ttl = []
    memo = s[0]
    for j in range(0,len(s)-1):
        if (i>>j)&1:
            memo += s[j+1]
        else:
            ttl.append(int(memo))
            memo = s[j+1]
    ttl.append(int(memo))
    ans += sum(ttl)
    ttl = []

print(ans)

Solution (Python):





s = list(input())

ans = 0

for i in range(1<<len(s)):
    ttl = []
    memo = s[0]
    for j in range(1,len(s)):
        if (i>>j)&1:
            memo += s[j]
        else:
            ttl.append(int(memo))
            memo = s[j]
    ttl.append(int(memo))
    
    ans += sum(ttl)
    ttl = []

print(ans//2)

Solution (Python):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    v1, v2, v3 = LI()
    v = v1+v2+v3
    if(v >= 22):
        print('bust')
    else:
        print('win')
    return




def B():
    S = input()
    S = S[:-1]
    count = 0
    for i in range(len(S)//2):
        if (S[i] != S[-1-i]):
            count += 1

    print(count)
    return




def true():
    S = input()
    S = S[:-1]
    
    tmp=0
    for x in range(1 << (len(S)-1)):
        func = S[-1]
        for i in range(len(S)-1):
            if(x & (1 << i)):
                tmp+=int(func)
                func = S[-2-i]
            else:
                func = S[-2-i]+func
        tmp+=int(func)
    print(tmp)

    return


def C():
    N = II()
    L = []
    for i in range(1, N+1):
        A = II()

        for j in range(A):
            x, y = LI()
            L.append([i, x, y])





def D():

    a, b, x = LI()
    BIG = a*a*b/2
    if x > BIG:
        y = 2*b-(2*x/a/a)
        print(math.degrees(math.atan(y/a)))
    else:
        y = 2*x/a/b
        print(math.degrees(math.atan(b/y)))
    return




def E():
    N, K = LI()
    A = LI()
    F = LI()
    A.sort(reverse=True)
    F.sort()
    cost = []
    for i in range(len(N)):
        cost.append(A[i]*F[i])

    a = F[cost.index(max(cost))]

    return




def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    



def solution(S):
    
    N = len(S)

    pass



if __name__ == '__main__':

    true()

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

Solution (Python):
s = input()
c = 0
if len(s) == 1:
  print(s)
else:
  for i in range(2**(len(s)-1)):
    now = 0
    b = bin(i)[2:]
    b = "0"*(len(s)-len(b)-1) + b + "1"
    for j in range(len(s)):
      if b[j] == "1":
        c += int(s[now:j+1])
        now = j+1
  print(c)

Solution (Python):
s = input()
l = len(s)

def DFS(i, f):
    n = []
    if i == l - 1:
        n.append(sum(list(map(int, f.split("+")))))
        return n

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

print(sum(DFS(0, s[0])))

Solution (Python):
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]))

Solution (Python):
S = input()
p = [1] * (len(S) - 1)
sumlst = [0] * len(S)
ans = 0
def dfs(i):
    global ans
    if i == (len(S) - 1):
        tmp = ''
        if p[0] == 1:
            tmp += S[0] + '+' + S[1]
        else:
            tmp += S[0] + S[1]
        for i in range(1, len(p)):
            if p[i] == 1:
                tmp += '+' + S[i + 1]
            else:
                tmp += S[i + 1]
        ans += eval(tmp)
        return

    p[i] = 1
    dfs(i + 1)
    p[i] = 0
    dfs(i + 1)
    return
if len(S) == 1:
    print(int(S))
    exit()
dfs(0)

print(ans)

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

Solution (Python):
S=input()

stack=[]
stack.append([S[0],1])
ans=0
while stack:
  v=stack.pop()
  formula=v[0]
  index=v[1]
  if index==len(S):
    ans+=eval(formula)
  else:
    stack.append([formula+S[index],index+1])
    stack.append([formula+"+"+S[index],index+1])

print(ans)

Solution (Python):

s = input()
n = len(s)-1
o = []

if n==0:
    print(int(s))
    exit()

for i in range(2**n):
    op = [0]*n
    for j in range(n):
        if ((i>>j)&1):
            op[n-1-j]=1
    o.append(op)

ans = 0

for i,oo in enumerate(o):
    t = ''
    for j,ss in enumerate(s):
        if j==0:
            t += ss
            continue
        if o[i][j-1]:
            ans += int(t)
            t = ''
            t += ss
        else:
            t += ss
        if j==n:
            ans += int(t)

print(ans)

Solution (Python):
s=list(input())
n=len(s)
ans=0
for i in range(2**(n-1)):
	ni=list(map(int,list(str(format(i,"b")))))
	while len(ni)<n-1:
		ni.insert(0,0)
	siki=s[0]
	for j in range(n-1):
		if ni[j]==1:
			siki+="+"
		siki+=s[j+1]
	ans+=eval(siki)
print(ans)

Solution (Python):
s=input()
n=len(s)
f=0
for i in range(1<<n-1):
    a=s[0]
    for j in range(n-1):
 
        if i&(1<<j):
            
            a+='+'+s[j+1]
        else:
            a+=s[j+1]
    f+=eval(a)
print(f)

Solution (Python):
s=input()
n=len(s)
f=0
for i in range(1<<n-1):
    a=s[0]
    for j in range(n-1):

        if i&(1<<j):
            
            a+='+'+s[j+1]
        else:
            a+=s[j+1]
    f+=eval(a)
print(f)

Solution (Python):
s=input()
cnt=len(s)-1
ans=0
for i in range(2**cnt):
    sum=s[0]
    for j in range(cnt):
        if ((i>>j)&1):
            sum+="+"
        else:
            pass
        sum+=s[j+1]
    ans+=eval(sum)
print(ans)

Solution (Python):
import copy

s = str(input())
S = []
for x in s:
    S.append(x)




tot = 0

for i in range(1<<(len(S)-1)):
    
    
    Cal = []
    T = copy.deepcopy(S)
    for j in range(len(S)-1):
        if (i>>j)&1 == 1:
            Cal.append('+')
        else:
            Cal.append('')
    
    
    eq = ''
    for k in range(len(S)-1):
        eq = eq + T[k]+Cal[k]
    eq = eq + T[-1]
    res = eval(eq)
    tot += res
print(tot)

Solution (Python):

import sys, math, itertools, heapq, collections, bisect, fractions
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = tmp = 0

s=input()
n=len(s)
for i in range(0,n):
    
    for c in itertools.combinations(range(1,n),i):
        tmp=0
        for ci in c:
            ans+=int(s[tmp:ci])
            
            tmp=ci
        ans+=int(s[tmp:n])
        
print(ans)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    ans = 0
    N = len(S)
    for i in range(N):
        for j in range(i+1, N+1):
            l = 2 ** (max(0, i-1))
            r = 2 ** (max(0, N-j-1))
            ans += int(S[i:j]) * l * r
    return ans


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import combinations

S = input()

ans = int(S)
for n in range(1, len(S)):
    for c in combinations(range(len(S) - 1), n):
        op = [''] * len(S)
        for ci in c:
            op[ci] = '+'
        shiki = ''
        for i in range(len(S)):
            shiki += S[i] + op[i]
        ans += eval(shiki)
print(ans)

Solution (Python):
s=input()
x=bin(0)
count=0
for i in range((2**(len(s)-1))):
    cur=s[0]
    cur_num=x[2:].zfill(len(s)-1)
    for i in range(len(s)-1):
        if(cur_num[i]=='1'):
            cur+='+'
        cur+=s[i+1]
    count+=eval(cur)
    x = bin(int(x,2)+ 1)
print(count)

Solution (Python):
import sys
import itertools

s = sys.stdin.readline().rstrip()
n = len(s)


ans = 0
for i in range(n):
    combs = list(map(list, itertools.combinations(range(1, n), i)))
    res2 = 0
    for c in combs:
        c.insert(0, 0); c.append(n)
        res1 = 0
        for j in range(i+1):
            res1 += int(s[c[j]:c[j+1]])
        res2 += res1
    ans += res2

print(ans)

Solution (Python):
import sys
import itertools

s = sys.stdin.readline().rstrip()
n = len(s)


ans = 0
for i in range(n):
    combs = list(map(list, itertools.combinations(range(1, n), i)))
    res2 = 0
    for c in combs:
        c.insert(0, 0); c.append(n)
        res1 = 0
        for j in range(1, i+2):
            res1 += int(s[c[j-1]:c[j]])
        res2 += res1
    ans += res2

print(ans)

Solution (Python):
s = list(input())
n = len(s)-1
def dfs(x,y):
  ans = 0
  if x == n:
    return sum(list(map(int,"".join(y).split("+"))))
  else:
    return dfs(x+1,y+"+"+s[x+1])+dfs(x+1,y+s[x+1])
print(dfs(0,s[0]))

Solution (Python):
def dfs(i, formula):
    if i + 1 == num_digits:
        return sum(list(map(int, formula.split("+"))))

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


s = input()
num_digits = len(s)

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

Solution (Python):
s = list(map(int,list(input())))
n = len(s)
w = 0
for i in range(n):
    for j in range(i, n):
        if j == i:
            w += s[i]*(10**(n-1-j))*(2**j)
        else:
            w += s[i]*(10**(n-1-j))*(2**(j-1))
print(w)

Solution (Python):
import itertools


def add_operators(numbers, operators):
    return ''.join([operators[i] + numbers[i] for i in range(len(numbers))])


def main(s):
    numbers = list(s)
    operators = [['']]
    operators.extend([['', '+']] * (len(numbers) - 1))
    products = itertools.product(*operators)
    sum_numbers = 0
    for p in products:
        sum_numbers += sum(map(int, add_operators(numbers, p).split('+')))
    return sum_numbers


if __name__ == '__main__':
    S = input()
    print(main(S))

Solution (Python):
import itertools


def strjoin(numbers, options):
    return numbers[0] + ''.join([options[i] + numbers[i + 1] for i in range(len(options))])


def main(s):
    if len(s) == 1:
        return int(s)
    numbers = list(s)
    options = [['', '+']] * (len(numbers) - 1)
    products = itertools.product(*options)
    n_sum = 0
    for p in products:
        n_sum += sum(map(int, strjoin(numbers, p).split('+')))
    return n_sum


if __name__ == '__main__':
    S = input()
    print(main(S))

Solution (Python):
s = input()
ans = 0
k = len(s)
def search(formulas, n,count):
    global k
    if count >= k:
        cal(formulas)
    else:
        search(formulas,n+1,count + 1)
        search(formulas[:n] + "+" + formulas[n:],n+2,count + 1)
def cal(formulas):
    global ans
    ans += sum(map(int, list(formulas.split("+"))))
search(s,1,1)
print(ans)

Solution (Python):
s=input()
L=[[s,0]]
for i in range(1,len(s)):
    M=[]
    for l in L:
        M.append([(l[0][:i+l[1]])+"+"+(l[0][i+l[1]:]),l[1]+1])
    L+=M
print(sum(map(lambda x:eval(x[0]),L)))

Solution (Python):
s=input()
l=len(s)
x=[0]*l
for i in range(l):
  for j in range(i,l):
    if j-i>0:
      x[j]+=int(s[i])*(2**i)*(2**(j-i-1))
    else:
      x[j]+=int(s[i])*(2**i)
a=0
for i in range(l):
  a+=x[i]*(10**(l-i-1))
print(a)

Solution (Python):
S = input()
n = len(S)
ans = 0
for i in range(2 ** (n-1)):
    tmp = S[n-1]
    for k in range(n-1):
        if 1 & i>>k:
            ans += int(tmp)
            tmp = S[n-k-2]
        else:
            tmp = S[n-k-2] + tmp
    ans += int(tmp)
print(ans)

Solution (Python):

import sys
input = sys.stdin.readline


from itertools import product
S = input().rstrip()

ans = 0
ops = list(product("+ ", repeat=len(S)-1))

for op in ops:
    s = S[0] + "".join(x+y for (x,y) in zip(op,S[1::])).replace(" ","")
    ans += eval(s)

print(ans)

Solution (Python):
def examC():
    St = S()
    N = len(St)
    cur = int(0)
    ansC = [0]*(2**(N-1))
    for i in range(2**(N-1)):
        k = int(0)
        cur = int(0)
        for j in range(N-1):
            if (i>>j)%2==1:

                cur += int(St[k:j+1])
                k = j+1
        cur += int(St[k:])
        ansC[i] = cur

    print(sum(ansC))

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

Solution (Python):


S = input().strip()

ans = 0
for i in range(2**(len(S)-1)):
    e = ['' if c == '0' else '+' for c in format(i, 'b').zfill(len(S))]
    ans += eval(''.join(a+b for a, b in zip(e, S)))
print(ans)

Solution (Python):



s=input()
n=len(s)
ans=0
for i in range(1<<(n-1)):
    tmp=0
    for k in range(n):
        j=int(s[k])
        if (((i<<1)>>k)&1==1):
            tmp=tmp*10+j
        else:
            ans+=tmp
            tmp=j
    ans+=tmp
print(ans)

Solution (Python):
s = list(input())
n = len(s)
ans = []
for i in range(2**(n-1)):
    a = 0
    b = 0
    for j in range(n):
        s[j] = int(s[j])
        b *=10
        if ((i>>j)&1):
            a = a+b+s[j]
            b = 0
        else:
            b+=s[j]
    a+=b
    ans.append(a)
print(sum(ans))

Solution (Python):
import itertools

S=input()
N=len(S)-1
PRD1=list(itertools.product(['+','_'], repeat=N))

PRD3=[]
for i in range(len(PRD1)):
    PRD3.append(['']*(2*N+1))

for i in range(len(PRD1)):
    PRD3[i][::2]=S
    PRD3[i][1::2]=PRD1[i]

ans=0
for i in range(len(PRD3)):
    PRD3[i]=['' if j=='_' else j for j in PRD3[i]]
    ans+=eval(''.join(PRD3[i]))

print(ans)

Solution (Python):
ans = 0
 
def dfs(i, cur, sum_v):
    global ans, S
    if i == len(S)-1:
        ans += sum_v
        return 
    dfs(i+1, int(S[i+1]), sum_v+int(S[i+1]))
    dfs(i+1, cur*10+int(S[i+1]), sum_v+cur*9+int(S[i+1]))
 
S = input()
dfs(0, int(S[0]), int(S[0]))
print(ans)

Solution (Python):
def solve():
    def recur(i, s):
        if not i < length:
            return sum(map(int, s.split("+")))

        ans1 = 0
        if not i == length - 1:
            ans1 = recur(i + 1, s + S[i] + '+')
        ans2 = recur(i + 1, s + S[i])
        return ans1 + ans2

    S = input()
    length = len(S)

    

    return recur(0, '')


if __name__ == '__main__':
    res = solve()
    print(res)

Solution (Python):
def main():
    S = input()
    lst = list()
    ans = 0
    for i in range(1 << len(S) - 1):
        lst.clear()
        pre = 0
        for j in range(len(S) - 1):
            if i >> j & 1:
                lst.append(int(S[pre:j + 1]))
                pre = j + 1
        lst.append(int(S[pre:]))
        ans += sum(lst)
    print(ans)
    return


main()

Solution (Python):
S = input()
x = len(S)-1
ans = 0
for i in range(1 << x):
    insert = []
    for j in range(x):
        if i >> j & 1:
            insert.append(j)
    st = []
    for k, s in enumerate(S):
        st.append(s)
        if k in insert:
            st.append('+')
    ans += eval(''.join(st))
print(ans)

Solution (Python):
s = list(input())
l = len(s) - 1
ans = 0
for i in range(2**l):
    op = [""] * l
    res = ""
    for j in range(l):
        if (i>>j) & 1:
            op[j] = "+"
    
    for n, k in zip(s, op+[""]):
        if len(k) != 0:
            res += n + k
        else:
            res += n
    ans += eval(res)

print(ans)

Solution (Python):
import itertools
S = input().strip()
k = len(S)
tot = 0
for x in itertools.product((0,1),repeat=k-1):
    y = S[0]
    for i in range(k-1):
        if x[i]==0:
            y += S[i+1]
        else:
            y += "+"+S[i+1]
    tot += eval(y)
print(tot)

Solution (Python):
from collections import deque
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = []

S = input()
N = len(S)-1

for i in range(2**(N)):
    cou = int(0)
    lower = 0
    que = deque()
    for l in range(N+1):
        que.append(int(S[l]))
    for j in range(N):
        if ((i >> j) & 1):  

            for k in range(lower,j+1):
                cou += que.popleft()*(10**(j-k))
            lower = j+1

    k = int(0)
    while que:
        cou += que.pop()*(10**k)
        k +=1
    ans.append(cou)

print(sum(ans))

Solution (Python):


S = input()
n = len(S)

def dfs(i, f):
    
    if i == n - 1:
        return f
    
    return dfs(i + 1, f + S[i + 1]) + "+" + dfs(i + 1, f + "+" + S[i + 1])

def main():
    print(eval(dfs(0,S[0])))

if __name__ == '__main__':
    main()

Solution (Python):
S=list(input())
N=len(S)

ans=0
for i in range(2**(N-1)):
  l=0
  for j in range(N-1):
    if (i>>j)&1:
      ans+=int("".join(S[l:j+1]))
      l=j+1
  ans+=int("".join(S[l:]))
  
print(ans)

Solution (Python):
s=input()
n=len(s)-1 
sub=[] 
t=(1<<n)
sm=0 
for i in range(t):
    curr=[]
    for j in range(n):
        if i&(1<<j):
            curr.append(j)
    now=''
    part=[]
    for it in range(len(s)): 
        now+=s[it]
        if it in curr:
            part.append(now)
            now=''
    part.append(now)
    for p in part: 
        
        sm+=int(p)
print(sm)

Solution (Python):
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)

Solution (Python):
S=input()
ans=0
for i in range(len(S)):
    for j in range(i+1):
        ans+=int(S[-(i+1)])*(10**j)*(2**(len(S)-1))//(2**min(i,j+1))
print(ans)

Solution (Python):
s = input()
n = len(s)

ans = 0

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

    for i in range(n - 1):
        if bit & (1 << i):
            
            f += "+"
        f += s[i + 1]

    ans += eval(f)

print(ans)

Solution (Python):
def dfs(i, f):
    if i == n - 1:
        return eval(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]))

Solution (Python):
def dfs(i,f):
    if i==n-1:
        return f
    return dfs(i+1,f+s[i+1])+'+'+dfs(i+1,f+'+'+s[i+1])
s=input()
n=len(s)
print(eval(dfs(0,s[0])))

Solution (Python):
s=input()
n=len(s)
f=0
for i in range(1<<n-1):
    a=s[0]
    for j in range(n-1):
        if i&(1<<j):
            a+='+'+s[j+1]
        else:
            a+=s[j+1]
    f+=eval(a)
print(f)

Solution (Python):

n = str(input())
n_list = list(n)
r = ''
for i in n_list:
  r += '1'

def make_math(numbers, b_str):
  b_str_list = list(b_str)
  r = ''
  for index, n in enumerate(b_str_list):
    r += numbers[index]
    if n == '1' and index < len(b_str_list) - 1:
      r += '+'
  return r

math_list = []
f = '0' + str(len(r)) + 'b'
bi = int(r, 2)
for i in range(bi):
  bb = format(i+1, f)
  math_list.append(make_math(n, bb))

total = 0
m = list(set(math_list))
for mm in m:
  mm_split = map(int, mm.split('+'))
  total += sum(mm_split)

print(total)

Solution (Python):
def slove():
    import sys
    import itertools
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    mt = 0
    for v in itertools.product(["+", ""], repeat=len(s)-1):
        l = []
        t = 0
        for i, vv in enumerate(v):
            l.append(s[i])
            if vv == "+":
                t += int("".join(l))
                l = []
        l.append(s[-1])
        t += int("".join(l))
        mt += t
    print(mt)


if __name__ == '__main__':
    slove()