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):
from itertools import product
S = input()
len_s = len(S)
patterns = product([0,1], repeat=len(S) - 1)

ans = 0

for pattern in patterns:
  tmp_st = ''
  tmp_arr = []
  for i in range(len_s):
    tmp_st += S[i]
    if i <= len_s-2 and pattern[i]:
      ans += int(tmp_st)
      tmp_st = ''
  ans += int(tmp_st)

print(ans)

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

ans = 0
for bit in range(1 << N):
    s = []
    prev = 0
    for i in range(N):
        if bit & (1 << i):
            s.append(S[prev:i + 1])
            s.append('+')
            prev = i + 1
    else:
        s.append(S[prev:])
    ans += eval(''.join(s))
print(ans)

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

from itertools import product
sign = ['+','']
signs = list(product(sign, repeat=(n-1)))
signs = list(list(_) for _ in signs)

S = []
for i in range(len(signs)):
    temp = [s[0]]
    s_copy = s[:]
    for j in range((n-1)*2):
        if j % 2 == 0:
            temp += [signs[i].pop(0)]
        else:
            temp += [s_copy.pop(1)]
    else:
        S += [temp]

x = 0
for k in range(len(signs)):
    x += eval(''.join(S[k]))

print(x)

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

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):
def dfs(i,f):
    
    if i == len(s)-1: 
        return sum(list(map(int,f.split("+"))))
    return dfs(i+1,f+s[i+1]) + dfs(i+1,f+"+"+s[i+1])
s = list(input())
print(dfs(0,s[0]))

Solution (Python):
import copy
s = input()
li = []
for ss in s:
    li.append(ss)
l = len(li) - 1 
ans = 0


for i in range(2**l):
    tmp = copy.deepcopy(li)
    count = 1
    
    for j in range(l):
        
        if (i >> j) & 1 == 1:
            tmp.insert(count,'+')
        else:
            tmp.insert(count,'')
        count += 2
    
    ans += eval("".join(tmp))

print(ans)

Solution (Python):
n=input()
ans=0
for i in range(2**(len(n)-1)):
  l=[0]
  for j in range(len(n)-1):
    if i>>j&1:
      l.append(j+1)
  l.append(len(n))
  for j in range(len(l)-1):
    ans+=int(n[l[j]:l[j+1]])
print(ans)

Solution (Python):
S = input()
n = len(S)
pattern = []
total = 0
for i in range(2 ** (n - 1)):
    tmp = [''] * (n - 1)
    for j in range(n - 1):
        if i >> j & 1:
            tmp[j] = '+'
    pattern.append(tmp)

for i in range(2 ** (n - 1)):
    tmp = ''
    for j in range(n - 1):
        tmp += S[j] + pattern[i][j]
    tmp += S[n - 1]
    total += sum(list(map(int, tmp.split('+'))))

print(total)

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

from itertools import product

PL=list(product(['+',''],repeat=n-1))

ans=0
for pl in PL:
    SS=S.copy()
    for i,p in enumerate(pl):
        SS.insert(i*2+1,p)
    ans+=eval(''.join(SS))
print(ans)

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

Solution (Python):

from itertools import permutations, combinations,combinations_with_replacement,product


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


a=list(product(['','+'],repeat=L-1))

answer = 0
for i in a:
    if(L == 1):
        tmp=s[0]    
    if(L == 2):
        tmp=s[0]+i[0]+s[1]
    if(L == 3):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]
    if(L == 4):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]
    if(L == 5):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]+i[3]+s[4]
    if(L == 6):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]+i[3]+s[4]+i[4]+s[5]   
    if(L == 7):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]+i[3]+s[4]+i[4]+s[5]+i[5]+s[6]       
    if(L == 8):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]+i[3]+s[4]+i[4]+s[5]+i[5]+s[6]+i[6]+s[7]
    if(L == 9):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]+i[3]+s[4]+i[4]+s[5]+i[5]+s[6]+i[6]+s[7]+i[7]+s[8]
    if(L == 10):
        tmp=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]+i[3]+s[4]+i[4]+s[5]+i[5]+s[6]+i[6]+s[7]+i[7]+s[8]+i[8]+s[9]





    answer += eval(tmp)
print(answer)



'''
answer = N 

sp = []
for i in range(L):
    if(i == 0):
        sp.append([0])
        sp.append([1])
        print(sp)
        print(len(sp))
    else:
        print(i)
        for j in range(len(sp)):

'''
'''
a=['a','b','C']
print(list(permutations(a)))
print(list(combinations(a,2)))
print(list(combinations_with_replacement(a,3)))
'''

'''

a=list(product(['','-'],repeat=3))
print(a)
s=['5', '5', '3', '4']
for i in a:
    ans=s[0]+i[0]+s[1]+i[1]+s[2]+i[2]+s[3]
    print(ans)

    if eval(ans)==21:
        print(ans+'=21')
        break
'''

Solution (Python):
S=input()
SS=[str(a) for a in S]
SSS=tuple(SS)
kaisuu=len(S)-1
answers=[]
for i in range(2**kaisuu):
    T=list(SSS)
    for j in range(kaisuu):
        if ((i>>j)&1):
            T.insert(j*2+1,'+')
        else:
            T.insert(j*2+1,'')
    answers.append(T)
answer=[]
for a in answers:
    kotae=''
    for b in a:
        kotae+=b
    answer.append(kotae)
kotaes=[]
for a in answer:
    b=a.split('+')
    kotaes.append(b)
B=[]
for a in kotaes:
    C=[]
    for b in a:
        b=int(b)
        C.append(b)
    B.append(C)
A=0
for a in B:
    A+=sum(a)
print(A)

Solution (Python):

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

def main():
    mod=10**9+7
    S=input()
    N=len(S)
    
    ans=int(S)
    import itertools
    for r in range(N-1):
        for ite in itertools.combinations(range(1,N), r+1):
            a=[0]+list(ite)+[N]

            for i in range(len(a)-1):
                b=int(S[a[i]:a[i+1]])
                ans+=b
                
                
    print(ans)

main()

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):
def dfs(i, f):
    if i == len(s) - 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()
print(dfs(0, s[0]))

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

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

Solution (Python):
import itertools
def main():
    S = input()
    ans = 0
    plus = itertools.product([0,1], repeat=len(S)-1)
    for pl in plus:
        now = '0'
        for p, s in zip(pl+(1,), S):
            now += s
            if p:
                ans += int(now)
                now = '0'
    print(ans)
main()

Solution (Python):
s=input()

sum = 0

for bit in range(2 ** (len(s) - 1)):
    t = []
    
    idx=0
    for i in range(len(s) - 1):
        if 1 & (bit >> i):
            t.append(s[idx:i+1])
            idx = i+1
        
    t.append(s[idx:])

    for tt in t:
        sum+=int(tt)

print(sum)

Solution (Python):
def main(S,l):
    if l == 1:
        return S

    ans = 0
    digit = 0

    
    for i in range(2**(l-1)):
        digit = 0
        for j in range(l):
            ans += int(S[l-j-1])*(10**digit)
            if i&(2**j) == 0:   
                digit += 1
            else:
                digit = 0

    return ans

S = input()
l = len(S)
print(main(S,l))

Solution (Python):
s = input()
chk = []
def f(a,b):
  if a==len(b):
    chk.append(eval(b))
  else:
    return f(a+1,b),f(a+2,b[:a]+'+'+b[a:])
f(1,s)
print(sum(chk))

Solution (Python):
s = input()
l = len(s)
cases = 2 ** (l - 1)
ans = 0

for i in range(cases):
    tmp = int(s)
    adjust = str(format(i, 'b').zfill(l-1))
    k = 0
    for j in range(l-1):
        if adjust[j] == '1':
            ans += tmp % (10 ** (k+1))
            tmp //= 10 ** (k+1)
            k = 0
        else:
            k += 1
    ans += tmp

print(ans)

Solution (Python):
s = list(map(int, input()))[::-1]
l = len(s)
b = 1<<(l-1)

sum = 0
for i in range(b):
  conseq = 0
  for j in range(l):
    sum += s[j] * 10**conseq
    if i>>j & 1:
      conseq = 0
    else:
      conseq += 1
      
print(sum)

Solution (Python):

s = input()
n = len(s)

def tasu(a,b):
    if a == n-1:
        return sum(list(map(int,b.split("+"))))

    return tasu(a+1,b+s[a+1])+ \
        tasu(a+1,b+"+"+s[a+1])
print(tasu(0,s[0]))

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

Solution (Python):
s=str(input())
n=len(s)
ans=0
for i in range(n):
    cnt=0
    for j in range(n-i):
        if j!=n-i-1:
            cnt+=(10**j)*(2**(n-j-2))
        else:
            cnt+=(10**j)*(2**i)
    ans+=int(s[i])*cnt
print(ans)

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

for bit in range(1<<l-1):
    plus = []
    for i in range(l-1):
        if 1<<i & bit:
            plus.append(i)
    
    if plus:
        a = 0
        b = 0
        for i in range(len(plus)):
            a = b
            b = plus[i] + 1
            ans += int(s[a:b])
        ans += int(s[b:])

print(ans)

Solution (Python):
Sstr = list(input())
l = len(Sstr)
final_ans = 0
for i in range(2 ** (l-1)):
    ans = list(Sstr[0])
    for j in range(l - 1):
        if (i >> j) & 1:
            ans.append('+')
            ans.append(Sstr[j+1])
        else:
            ans.append(Sstr[j + 1])
    final_ans += eval(''.join(ans))
print(final_ans)

Solution (Python):
import sys
import itertools
readline = sys.stdin.buffer.readline

s = readline().rstrip().decode('utf-8')
n = len(s)
dig = n-1 
bit_mask = list(itertools.product([0,1],repeat=dig))
ans = 0
for i in bit_mask:
    res = []
    p = s[0]
    for j,k in enumerate(i,1):
        if k == 0:
            p = p + s[j]
        else:
            res.append(p)
            p = s[j]
    res.append(p)
    for i in res:
        ans += int(i)

print(ans)

Solution (Python):
s=str(input())
ans=0
rang=len(s)-1
for i in range(2**rang):
  l=[]
  for j in range(rang):
    if i>>j&1:
      l.append(j)
  if len(l)==0:
    ans+=int(s)
  elif len(l)==1:
    ans+=(int(s[0:l[0]+1])+int(s[l[0]+1:]))
  else: 
    for k in range(len(l)):
      if k==0:
        ans+=int(s[0:l[k]+1])
      elif k==len(l)-1:
        ans+=(int(s[l[k-1]+1:l[k]+1])+int(s[l[k]+1:]))
      else:
        ans+=int(s[l[k-1]+1:l[k]+1])   
print(ans)

Solution (Python):
s = input()
sum = int(s)
length = len(s)
inputlist = list(s)


for i in range(1,2**(length-1)):
    addlist = []
    addflag = format(i,'0'+str(len(s)-1)+'b')

    begin = 0
    for j in range(length-1):
        if addflag[j] == '1':
            addlist.append(s[begin:j+1])
            begin = j+1
        if j == length-2:
            addlist.append(s[begin::])

    for item in addlist:
        sum += int(item)
print(sum)

Solution (Python):



def main():
  s = input().strip()
  sum = 0
  for i in range(2**(len(s)-1)):
    num = [s[0]]
    for j in range(1, len(s)):
      if i & (2**(j-1)) != 0:
        sum += int(''.join(num))
        num = [s[j]]
      else:
        num.append(s[j])
    sum += int(''.join(num))
  print(sum)

if __name__=='__main__':
  main()

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

Solution (Python):
s = input()

keta = int(len(s))
cases = 2 ** (keta - 1)

lst = []
for i in range(cases):
    sushiki_moji = s[0]
    adjust = format(i, 'b').zfill(keta - 1)
    for j in range(keta - 1):
        if adjust[j] == '1':
            sushiki_moji += '+'
        sushiki_moji += s[j+1]
    lst.append(sushiki_moji)

eval_number = [eval(i) for i in lst]
print(sum(eval_number))

Solution (Python):
S = input()
n = len(S)-1
ans = 0
for i in range(2**n):
    add = 0
    expr = list(S)
    for j in range(n):
        if ((i >> j) & 1):
            expr.insert(j+1+add, "+")
            add += 1
    ans += eval("".join(expr))
print(ans)

Solution (Python):
S = input()
n = len(S)-1
ans = 0
for i in range(2**n):
    add = 1
    expr = list(S)
    for j in range(n):
        if ((i >> j) & 1):
            expr.insert(j+add, "+")
            add += 1
    ans += eval("".join(expr))
print(ans)

Solution (Python):
s=input()
cnt=len(s)-1
ans=0
for i in range(1<<(cnt)):
    op=[""]*cnt
    for j in range(cnt):
               if((i>>j)&1):
                op[j]="+"
    formula=""
    for k,l in zip(s,op+[""]):
        formula+=(k+l)
    ans+=eval(formula)
print(ans)

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

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


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


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

Solution (Python):


S = input().strip()


digit_2 = len(S)-1
total=0
for i in range( 2**(digit_2) ):
    bin_str = format(i, 'b').zfill(digit_2)
    bin_str = bin_str[:] + "0"

    calc_str=""
    for j in range(len(S)):
        if bin_str[j] == "1":
            calc_str += S[j] + "+"
        else:
            calc_str += S[j]
    
    calc = sum(map(int, calc_str.split("+")))
    total += calc
    
print(total)

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

ans = 0
for i in range(1 << l-1):
    n = N
    for j in range(l-1)[::-1]:
        if (i >> j) & 1 == 1:
            n = n[:j+1] + "+" + n[j+1:]
    ans += sum(list(map(int, n.split("+"))))

print(ans)

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

ans = int(N)

for i in range(1,l):
    for j in range(l+1-i):
        if j == 0 or j == l-i:
            t = l - i - 1
        else:
            t = l - i - 2
        ans += int(N[j:j+i]) * (2 ** t)

print(ans)

Solution (Python):
S = [int(i) for i in input()]

N = len(S)

tens = [10**i for i in range(N)]

tens.reverse()

twos = [1]
twos.extend(2**i for i in range(N-1))

sums = 0
all_comb = sum(twos)
for i in range(N):
    tmp = [x*y for x, y in zip(tens[i:], twos)]
    exp = S[i] * sum(tmp) / sum(twos)
    sums = sums + exp
    del twos[-1]
print(int(sums * all_comb))

Solution (Python):
s = input()
l = len(s)
dig = [1]
for x in range(l-1):
  dig.append(2**x)

ans = 0
for x in range(l):
  n = int(s[x])
  for y in range(l):
    ans += n * dig[y] * (10**(l-y-1))
  dig[x] = 0
  if x < l-1:
    dig[x+1] *= 2
print(ans)

Solution (Python):
S = input()
ans = 0

for i in range(2**(len(S)-1)):
    now = ""
    for j, c in enumerate(S):
        now += c
        if i & (1 << j) != 0:
            ans += int(now)
            now = ""
    ans += int(now)

print(ans)

Solution (Python):


def main():
    S = input()
    size = len(S)

    ans = 0
    for bit in range(1 << size-1):
        exp = S[0]
        for i in range(size-1):
            if (bit & (1 << i)):
                exp += '+'
            exp += S[i+1]
        ans += eval(exp)

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
lenS = len(s)
sumS = 0

patterns = []
for i in range(2 ** (lenS - 1)):
    tmp = [False] * (lenS - 1)
    for j in range(lenS - 1):
        if i >> j & 1:
            tmp[j] = True
    patterns.append(tmp)

for pattern in patterns:
    a = s[0]
    for i in range(len(pattern)):
        if pattern[i] == True:
            pass
        else:
            sumS += int(a)
            a = "0"
        a += s[i+1]
    sumS += int(a)

print(sumS)

Solution (Python):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
  S = ns()
  n = len(S) - 1

  ans = 0
  for i in range(1 << n):
    tmp = S[0]
    for j in range(n):
      if (i >> j) & 1 == 1:
        tmp += "+"
      tmp += S[j+1]
    ans += eval(tmp)
  print(ans)

if __name__ == '__main__':
  main()

Solution (Python):
s = list(input())
n = len(s) - 1
ans = 0
for i in range(2 ** n):
    op = [0] * n
    for j in range(n):
        op[j] = (i >> j) & 1
    val, idx = 0, 0
    for j in range(n):
        if op[j] == 0:
            pass
        else:
            mknum = ''
            for k in range(idx, j+1):
                mknum += s[k]
            val += int(mknum)
            idx = j+1
    mknum = ''
    for k in range(idx, n+1):
        mknum += s[k]
    val += int(mknum)
    ans += val
print(ans)

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

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

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 = list(input())
N = len(S)-1
ans = int("".join(S))
for i in range(1,2**N):
    s = []
    n = i
    for j in range(N):
        s.append(n%2)
        n//=2
    m = S[0]
    for j in range(N):
        if s[j]:m+="+"
        m+=S[j+1]
    ans+=eval(m)
print(ans)

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()
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 += sum(map(int, f.split("+")))

print(ans)

Solution (Python):
s = [int(i) for i in input()]
n = len(s)
ans = 0

for i in range(pow(2, n-1)):
    tmp = s[0]
    res = 0
    for j in range(n-1):
        if (i >> j) & 1:
            res += tmp
            tmp = s[j+1]
        else:
            tmp = tmp * 10 + s[j+1]
    res += tmp
    ans += res


print(ans)

Solution (Python):
def f(i):
    global m
    if i == len(b):
        c = []
        c = [s[0]]
        for j in range(len(b)):
            if not b[j] == 0:
                for k in range(len(c)):
                    m += int(c[len(c) - k - 1]) * 10 ** k
                c = []
            c.append(s[j + 1])
        for k in range(len(c)):
            m += int(c[len(c) - k - 1]) * 10 ** k
        c = []
        return
    f(i + 1)
    b[i] = 1
    f(i + 1)
    b[i] = 0

s = list(input())
b = [0] * (len(s) - 1)
m = 0
f(0)
print(m)

Solution (Python):
S=input();ans=0;
for b in range(2**(len(S)-1)):
  x=int(S[0]);
  for i in range(1,len(S)):
    if(b%2):
      ans+=x;
      x=0;
    else:
      x*=10;
    x+=int(S[i])
    b//=2;
  ans+=x;
print(ans)

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

Solution (Python):
S = input()

amount = 0
for n in range(2 ** (len(S) - 1)):
    s = ""
    nn = n
    for i in range(len(S) - 1):
        s += S[i]
        if nn % 2 == 1:
            s += "+"
        nn >>= 1
    s += S[-1]
    amount += eval(s)
print(amount)

Solution (Python):
import numpy as np

import numpy as np
def Binary_Gen(n):
    bina = np.ones(2**n,dtype=object)
    for i in range(2**n):
        b = str(bin(i))[2:].zfill(n)
        bina[i] = b
    return bina


S =str(input())

add_ = Binary_Gen(len(S)-1)





count = 0

for i in add_:

    list_1 = [int(idx) for idx,j in enumerate(str(i)) if j == '1']

    if len(list_1)>0:
        comp = np.ones(len(list_1)+1)
        for k in range(len(comp)):
            if k==0:
                comp[k] = int(S[:list_1[k]+1])
            elif k == (len(comp)-1):
                comp[k] = int(S[list_1[k-1]+1:])
            else:
                comp[k] = int(S[list_1[k-1]+1:list_1[k]+1])

        count+= sum(comp)
    elif len(list_1)==0:
        count+=int(S)
        
print(int(count))

Solution (Python):

s=[int(i) for i in input()]
n=len(s)
ans=0

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

Solution (Python):
s = input()
len_s = len(s)
sum_s = 0
for i in range(1 << (len_s - 1)):
    end = len_s
    for j in range(len_s - 1):
        if (i >> j) & 1:
            sum_s += int(s[(len_s - 1) - j:end])
            end = (len_s - 1) - j
    sum_s += int(s[0:end])
            
print(sum_s)

Solution (Python):

import sys
INF = float("inf")


def solve(S: str):
    DP = [0]*(len(S)+1)

    for i in range(len(S)):
        
        DP[i+1] = DP[0] + int(S[:i+1])
        
        for j in range(i):
            DP[i+1] += DP[j+1]+int(S[j+1:i+1])*(2**j)
            
    print(DP[-1])
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  
    solve(S)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
long_s = len(s)
form = "0"+str(long_s-1)+"b"
result = 0
for i in range(2**(long_s-1)):
    ev = s[0]
    b = format(i, form)
    for j in range(1, long_s):
        if b[j-1] == "1":
            ev = ev+"+"+s[j]
        else:
            ev = ev+s[j]
    result += eval(ev)
print(result)

Solution (Python):
S = input().strip()

L = len(S) - 1
i = 2 ** L - 1

ans = 0

while i >= 0:
    tmp = str(S[0])
    for l in range(L):
        if i >> l & 1:  
            ans += int(tmp)
            tmp = S[l+1]
        else:
            tmp += str(S[l+1])
    ans += int(tmp)
    i -= 1
print(ans)

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

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

if n == 0:
    print(0)
elif n == 1:
    print(int(s))
else:
    print(ans)

Solution (Python):
S = input()
size = len(S)

ans = 0

for bit in range(1 << size - 1):
    exp = S[0]
    for i in range(size - 1):
        if (bit >> i) & 1:
            exp += "+"
        exp += S[i + 1]
    ans += eval(exp)

print(ans)

Solution (Python):
S = input()
size = len(S)

ans = 0

for binary in range(1 << size - 1):
    exp = S[0]
    for i in range(size - 1):
        if (binary >> i) & 1:
            exp += "+"
        exp += S[i + 1]
    ans += eval(exp)

print(ans)

Solution (Python):
A = list(input())
n = len(A)
B = list(range(1,n))
m = len(B)

v = []
for bit in range(1<<m):
    tmp = []
    for i in range(m):
        if 1 & (bit>>i):
            tmp.append(B[i])
    v.append(tmp)
v.sort(key=len)

res = 0
for b in v:
    tmp_index = 0
    if b==[]:
        res += int(''.join(A))
        continue
    
    b = b + [n]
    for i in b:
        res += int(''.join(A[tmp_index:i]))
        tmp_index = i
print(res)

Solution (Python):
def main():
    numbers = input()
    answer = 0
    for i in range(pow(2, len(numbers) - 1)):
        sign = bin(i)[2:].zfill(len(numbers) - 1).replace("1", "+").replace("0", "x")
        formula = numbers[0]
        for i in range(1, len(numbers)):
            formula += sign[i - 1] + numbers[i]
        answer += eval(formula.replace("x", ""))
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import chain, product, zip_longest
 
nums = list(input())
s = 0
for ops in product(('', '+'), repeat=len(nums) - 1):
    exp = ''.join(chain(*zip_longest(nums, ops, fillvalue='')))
    s += eval(exp)
print(s)

Solution (Python):
from itertools import chain, product, zip_longest

nums = list(input())
s = 0
for ops in product(('', '+'), repeat=len(nums) - 1):
    exp = ''.join(chain(*zip_longest(nums, ops, fillvalue='')))
    s += eval(exp)
print(s)

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


bit=[]
ans=0
c=0
count=[]
def bit_search(bit):
    
    count=[]
    global ans
    c=0
    if len(bit)==n:
        for i in range(n):
            if bit[i]==1:
                
                count.append(int(s[c:i+1]))
                c=i+1
        
        count.append(int(s[c:n+1]))
        ans+=sum(count)
        
        return 
    else:
       
        
        bit_search(bit+[0])
        bit_search(bit+[1])

bit_search(bit)
print(ans)

Solution (Python):


S_list = list(input())
n = len(S_list) - 1
answers = []
total_sum = 0
for i in range(2 ** n):
    
    ans_str = S_list[0]
    for j in range(n):
        if ((i >> j) & 1):
            ans_str += '+'
            ans_str += S_list[j+1]
        else:
            ans_str += S_list[j+1]
    
    
    ans_list = ans_str.split('+')
    ans = 0
    for num in ans_list:
        ans += int(num)
    total_sum += ans
print(total_sum)

Solution (Python):

from itertools import product
import sys


def solve(S: str):
    ans = 0
    for cs in product(("", "+"), repeat=len(S) - 1):
        ans += eval("".join(
            Si + csi for Si, csi in zip(S, cs + ('',))))
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    solve(S)


if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    s = readline().strip()
    n = len(s) - 1

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
s = input()
n = len(s) - 1
ans = 0
w = ""
for i in range(0, 2**n):
    for j, r in enumerate(s):
        x = i & 1
        i >>= 1
        w += r
        if j == n:
            continue
        if x:
            ans += int(w)
            w = ""
        else:
            pass
    ans += int(w)
    w = ""
print(ans)

Solution (Python):
S=str(input())
digits=len(S)-1
out=0
for i in range(2**digits):
    cs=0
    b=format(i,'0'+str(digits)+'b')
    for j in range(digits):
        if b[j]=='1':
            out+=int(S[cs:j+1])
            cs=j+1
    out+=int(S[cs:])
print(out)

Solution (Python):
s = input()
n = len(s)-1
ans = 0
for bit in range(1<<n):
    op = bin(bit)[2:].zfill(n)
    formula = ''
    for i in range(n):
        formula += s[i]
        if op[i] == '1':
            formula += '+'
    else:
        formula += s[len(s)-1]
        ans += eval(formula)
print(ans)

Solution (Python):


S = input()

total = 0

for i in range(2**(len(S)-1)):
  bin_i = format(i,'0'+str(len(S)-1)+'b')
  p = 0
  total += (10**p)*int(S[-1])
  for j in range(len(S)-1):
    if bin_i[-(j+1)] == '0':
      p += 1 
    else:
      p = 0
    total += (10**p)*int(S[-(j+2)])
    
print(total)

Solution (Python):
S = input()
L = len(S)

def dfs(i, f):
    if i == L-1: return sum(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):
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]))

Solution (Python):
def main():
    s = input()
    n = len(s) - 1
    a = 0
    for k in range(2**n):
        o = ["+ "[i == "0"] for i in bin(k)[2:]]
        o = [" "] * (n - len(o)) + o + [" "]
        a += eval("".join((a + b).strip() for a, b in zip(s, o)))
    print(a)

if __name__ == '__main__':
    main()

Solution (Python):
S=input()
sigma=0
li2=[1]*(len(S)+1)
li10=[1]*(len(S))
for k in range(1, len(S)):
    li2[k+1]=int(li2[k])*2
for k in range(len(S)-1):
    li10[k+1]=int(li10[k])*10
for k in range(1,len(S)+1):
    for j in range(1,k+1):
        sigma+=int(S[-k])*(li10[j-1])*(li2[len(S)-k+1])*(li2[k-j])
print(sigma)

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()
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()
list = [[0 for i in range(len(s) - 1)] for j in range(2**(len(s) - 1))]
for i in range(2**(len(s) - 1)):
    for j in range(len(s) - 1):
        if ((i >> j) & 1):
            list[i][j] = 1
ans = 0
for x in list:
    temp = 0
    for id in range(len(s)):
        if id == len(s) - 1 or x[id] == 1:
            temp += int(s[id]) 
            ans += temp
            temp = 0
        else:
            temp += int(s[id])
            temp *= 10
print(ans)

Solution (Python):
S = input()
num_cnt = len(S)
op_cnt = len(S) - 1  
ope_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] = "+"  

    formula = ""
    for j in range(num_cnt):
        if j==num_cnt-1:
            formula = formula + S[j]
            ope_sum = ope_sum + eval(formula)
            break
        formula = formula + S[j] + op[j]

print(ope_sum)

Solution (Python):
from itertools import product

S = list(map(int, input()))
S.reverse()
ans = 0


for part in product(range(2), repeat = len(S) - 1):
	cur = 0
	keta = 1
	for j in range(len(S)):
		cur += keta * S[j]
		if j == len(S) - 1: break
		if part[j] == 1:
			ans += cur
			keta = 1
			cur = 0
		else:
			keta *= 10
	if cur != 0:
		ans += cur
			
print(ans)