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=input()
n=len(s)
ans=0
for i in range(2**(n-1)):
  res=s[0]
  for j in range(n-1):
    if i & (1<<j):
      res+='+'
    res+=s[j+1]
  ans+=sum(map(int,res.split('+')))
print(ans)

Solution (Python):
s=input()
l=len(s)
ans=int(s[l-1])*(2**(l-1))
ak=1
sk=0

for i in range(2**(l-1)):
    for j in range(l-2,-1,-1):
        if (i>>j)&1==1:
            ak=1
        else:
            ak*=10
        sk=int(s[j])*ak
        ans+=sk
    ak=1

print(ans)

Solution (Python):
S = list(map(int, list(input())))
L = len(S)
ans = 0
for bit in range(2**(L-1)):
    temp = 0

    for i in range(L-1):
        temp =temp*10 + S[i]
        if bit & (1<<i):
            ans += temp
            temp = 0
    temp  = temp*10 + S[-1]
    ans += temp


print(ans)

Solution (Python):
S = input()

ans = 0
def dfs(now, i):
    if i == len(S):
        global ans
        ans += eval(now)
        return
    dfs(now+"+"+S[i], i+1)
    dfs(now+S[i], i+1)
    
dfs(S[0],1)
print(ans)

Solution (Python):
s = list(input())
l = ["
ans = 0
for i in range(2**(len(s)-1)):
    for j in range(len(s)-1):
        if (i>>j)&1:
            l[j] = "+"
    x = []
    for j in range(len(s)*2-1):
        if j % 2 == 0:
            x.append(s[j//2])
        else:
            if l[(j-1)//2] == "+":
                x.append("+")
    ans += sum(list(map(int, "".join(x).split("+"))))
    l = ["
print(ans)

Solution (Python):
S = input()
N = len(S)
ans = 0
stack = [(0,0,1)]
while stack:
  t,s,g = stack.pop()
  if g >= N:
    ans+=t+int(S[s:g])
  else:
    stack.append((t,s,g+1))
    stack.append((t+int(S[s:g]),g,g+1))
print(ans)

Solution (Python):
li=list(input())
lis=[]
for i in range(len(li)):
  lis.append(li[i])
  lis.append('')
lis.pop(-1)
sum=0
for i in range(2**(len(li)-1)):
    for j in range(len(li)-1):
      if (i >> j)&1:
          lis[2*j+1]='+'
    str=''.join(lis)
    calc=0
    a=[]
    
    a=list(str.split('+'))
    for j in a:
      calc+=int(j)
    sum+=calc
    
    for j in range(len(li)-1):
      lis[2*j+1]=''
print(sum)

Solution (Python):
"""
DFS（深さ優先探索）
"""


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

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

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


if __name__ == '__main__':
    main()

Solution (Python):
s = input()

def solve(i,psum,tmp):
  if i==len(s):
    return tmp+int(psum)  
  return solve(i+1,s[i],int(psum)+tmp) + solve(i+1,psum+s[i],tmp)

print(solve(1,s[0],0))

Solution (Python):
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 >> j ) & 1 :
            f += '+'
        f += S[j+1]
    ans += sum(map(int,f.split('+')))
print(ans)

Solution (Python):
S = input()

def dfs(i, f):
    if i == N-1:
        return sum(map(int, f.split('+')))
    return dfs(i+1, f + S[i+1]) + dfs(i+1, f+'+'+S[i+1])

N = len(S)
print(dfs(0, S[0]))

Solution (Python):
S = input()

N = len(S)
ans = 0
for bit in range(2**(N-1)):
    f = S[0]
    for i in range(N-1):
        if bit>>i & 1:
            f += "+"
        f += S[i+1]
    ans += sum(map(int, f.split('+')))
print(ans)

Solution (Python):
s = input()

def solve(i,psum,tmp):
  if i==len(s)-1:
    return tmp+int(psum)  
  return solve(i+1,s[i+1],int(psum)+tmp) + solve(i+1,psum+s[i+1],tmp)

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

Solution (Python):
def main():
	S = list(str(input()))
	LenP = len(S)-1
	ans = 0
	for i in range(2**LenP):
		P = [""]*LenP
		for j in range(LenP):
			if i >> j & 1:
				P[j] = "+"
		Res = [None] * (len(S)+len(P))
		Res[1::2],Res[::2] = P,S
		ResEval = "".join(Res)
		ans += eval(ResEval)
	print(ans)

if __name__ == '__main__':
	main()

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

for i in range(2**(n-1)):
    mode = ['-']*(n-1)
    for j in range(n-1):
        if (i >> j) & 1 == 1:
            mode[j] = '+'
    
    val = S[0]
   
    for k in range(len(mode)):
        if mode[k] == '+':
            val += '+'
            val += S[k + 1]
        else:
            val += S[k + 1]

    ans += eval(val)
print(ans)

Solution (Python):
s = input()
num = len(s)-1
ans = 0

if num == 0:
    print(int(s))
else:
    for i in range(2**num):
        mode = ['-']*num
        for j in range(num):
            if (i>>j)&1:
                mode[j] = '+'
        val = s[0]
        for k in range(num):
            if mode[k] == '+':
                if val != '':
                    ans += int(val)
                val = s[k+1]
            else:
                val += s[k+1]
            if val != '' and k == num-1:
                ans += int(val)
    print(ans)

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

Solution (Python):
s=input()
sl=len(s)
ans=0
for i in range(2**(sl-1)):
    bit=bin(i)[2:].zfill(sl-1)
    now=0
    for j in range(len(s)-1):
        if int(bit[j]):
            ans+=int(s[now:j+1])
            now=j+1
    ans+=int(s[now:])
print(ans)

Solution (Python):
X = str(input())
n = len(X)-1
ans = 0

for i in range(2**n):
  l = X[0]
  for j in range(n):
    if (i>>j & 1) == 1:
      l += "+"
    l += X[j+1]
  
  num = map(int,l.split("+"))
  ans += sum(num)
print(ans)

Solution (Python):
S = input()
n = len(S)
res = 0
for i in range(1 << n-1):
    subres = 0
    subst = S[0]
    for j in range(n-1):
        if i >> j & 1:
            subres += int(subst)
            subst = S[j+1]
        else:
            subst += S[j+1]
        if j == n - 2:
            subres += int(subst)
    res += subres
if n == 1:
    print(int(S))
else:
    print(res)

Solution (Python):
import copy


def main():
    target = input()

    num_list = []

    def function(n):
        if n == 0:
            num_list.append([(target[0], )])
        else:
            ans = []
            for i in num_list[n-1]:
                m = list(copy.copy(i))
                m.pop()
                m.append(i[-1] + target[n])
                ans.append(m)
                m = list(copy.copy(i))
                m.append(target[n])
                ans.append(m)
            ans = tuple(ans)
            num_list.append(ans)
    for x in range(len(target)):
        function(x)
    
    answer = 0
    for x in num_list[-1]:
        for y in x:
            answer += int(y)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
import copy


def main():
    target = input()

    num_list = []

    def function(n):
        if n == 0:
            num_list.append([(target[0], )])
        else:
            ans = []
            for i in num_list[n-1]:
                m = list(copy.copy(i))
                m.pop()
                m.append(i[-1] + target[n])
                ans.append(m)
                m = list(copy.copy(i))
                m.append(target[n])
                ans.append(m)
            ans = tuple(ans)
            num_list.append(ans)
    for x in range(len(target)):
        function(x)
    
    answer = 0
    for x in num_list[-1]:
        for y in x:
            answer += int(y)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
def dfs(i,s):
  if i == n-1:
    return eval(s)

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

S = str(input())
n = len(S)

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

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

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()
    len_S = len(S)

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

    print(ans)

if __name__ == '__main__':
    resolve()

Solution (Python):
import copy
S = list(input())
L = len(S)-1 
tmp = 1
ans = 0
locate = copy.deepcopy(S)
for i in range (2**L):
    for j in range(L):
        if (i >> j) & 1:
            locate.insert(j+tmp,'+')
            tmp += 1 
    locateSTR = "".join(locate)
    ans += (eval(locateSTR))
    tmp = 1
    locate = copy.deepcopy(S)
    
print(ans)

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

lis_2 = []
for i in range(1 << (sn - 1)):
    lis = [0, sn]
    for j in range(sn - 1):
        if (i >> j) & 1:
            lis.append(j + 1)
    lis = sorted(lis)
    
    sum1 = 0
    for j in range(len(lis) - 1):
        sum1 += int(s[lis[j]:lis[j + 1]])
    lis_2.append(sum1)

print(sum(lis_2))

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

Solution (Python):
s=list(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 = input()
n = len(s)-1
ans = 0
for i in range(2**n):
    now = s[0]
    for j in range(n):
        if (i>>j) & 1 == 1:
            ans += int(now)
            now = s[j+1]
        else:
            now += s[j+1]
    ans += int(now)
print(ans)

Solution (Python):
S = input()

res_list = []

for i in range(2**(len(S)-1)):
    temp_s = ''
    for j in range(len(S)):
        temp_s += S[j]
        if ((i >> j) & 1):
            temp_s += '+'
    
    res_list.append(temp_s)

temp_S_list = [eval(item) for item in res_list]

print(sum(temp_S_list))

Solution (Python):

s = list(input())
n = len(s)
a = 0
for i in range(2 ** (n-1)):
    l = []
    l.append(s[0])
    for j in range(n-1):
        if (i & 1 << j):
            l.append('+')
        l.append(s[j+1])
    a += eval(''.join(l))

print(a)

Solution (Python):
s=input()
n=len(s)
from itertools import product
bit=list(product([0,1],repeat=n))

ans=0
for b in bit:
  
  cnt=0
  kouho=""
  for i in range(n):
    if i==n-1:
      kouho+=s[i]
      
      cnt+=int(kouho)
      kouho=""
    else:
      if b[i]==0:
        kouho+=s[i]
      elif b[i]==1:
        kouho+=s[i]
        cnt+=int(kouho)
        
        kouho=""
    
  ans+=cnt

print(ans//2)

Solution (Python):






def insert_str(target, i, char):
    return target[:i] + char + target[i:]

def calc(target, i):
    global ans
    if i >= len(target):
        ans += eval(target)
        return
    calc(target, i+1)
    calc(insert_str(target, i, "+"), i+2)
        
S = input()
N = len(S)
ans = 0
calc(S, 1)


print(ans)

Solution (Python):
from itertools import product
s=int(input())
sl=list(str(s))
n=len(sl)
ans=0
for i in product([0,1],repeat=n-1):
    
    temp=0
    for j in range(n):
        ans+=int(sl[n-j-1])*10**temp
        temp+=1
        if n-j-2>=0 and i[n-j-2]==1:
            temp=0
print(ans)

Solution (Python):
s=int(input())
sl=list(str(s))
n=len(sl)
temp=0
for i in range(n):
    for j in range(n-i):
        temp+=(int(sl[i])*(10**j))*(2**(i+max(0,(n-i-j-2))))
print(temp)

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

Solution (Python):
S = input()
rt = 0
for l in range(1,len(S)+1):
  for i in range(len(S)-l+1):
    tmp = 1 if i == 0 or i+l==len(S) else 2
    tw = 2**(0 if len(S)-l-tmp<0 else len(S)-l-tmp)
    rt+=tw*int(S[i:i+l])

print(rt)

Solution (Python):
S = input().rstrip()
N = len(S) - 1
p = "+"

ans = 0
for bit in range(1 << N):
	mae = 0
	for j in range(N):
		if (bit >> j) & 1:
			ans += int(S[mae: j + 1])
			mae = j + 1
	ans += int(S[mae: len(S)])
print(ans)

Solution (Python):
S = input()
L = list(S)
N = len(L)
bitmask = 2 ** (N - 1)

totals = []
for mask in range(bitmask):
    total = 0
    digit = 0
    for i in range(N):
        num = int(L[N - i - 1])
        total += num * (10 ** digit)
        
        if mask & (1 << i):
            digit = 0
        else:
            digit += 1
    totals.append(total)

print(sum(totals))

Solution (Python):
from collections import deque
s=input()
l=len(s)
ans=0
for i in range(1<<(l-1)):
  Q=deque()
  for j in range(l-1):
    if (i>>j)&1:
      Q.append(j)
  Q.append(l-1)
  start=0
  while Q:
    v=Q.popleft()
    goal=v+1
    ans+=int(s[start:goal])
    start=v+1
print(ans)

Solution (Python):

def main():

    s = str( input() )
    s_l = len(s)
    ans = 0
    for i in range( 2 ** (s_l - 1) ):
        x_i = [ 0 for i in range( s_l - 1 ) ]
        x_i_ = list( format( i , 'b' ) )
        x_i[ len( x_i ) - len( x_i_ ) : ] = x_i_

        start = 0
        goal = 0
        for j in range( len(x_i) ):
            if x_i[j] == '1':
                goal = j + 1
                ans += int( s[start:goal] )

                

                start = goal
        goal = s_l
        ans += int( s[ start:goal ] )

        
    
    print( ans )

main()

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    lenth = len(s)
    itr = itertools.product([0,1],repeat=lenth-1)
    ans = 0

    for i in itr:
        tmp = s[0]
        cnt = 0
        for plus,char in zip(i, s[1:]):
            if plus == 1:
                cnt += int(tmp)
                tmp = char
            else:
                tmp += char
        cnt += int(tmp)
        ans += cnt

    print(ans)                
        
main()

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

ans = 0

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

Solution (Python):
def main():
    a = input()
    p = len(a)
    ans =0
    for i in range(2**(p-1)):
        t =a[0]
        for j in range(p-1):
            if (i & 1 <<j):
                t = t + '+'
            t = t + a[j+1]
        ans += eval(t)
    print(ans)
if __name__ =='__main__':
    main()

Solution (Python):
S = input()


result = []
def dfs(i, list):
    if i == len(S):
        result.append(list)
        return
    else:
        if i == len(S) - 1:
            return dfs(i+1, list+[S[i]])
        else:
            return dfs(i+1, list+[S[i]]), dfs(i+1, list+[S[i], "+"])


dfs(0, [])
ans = 0
for l in result:
    sum_of_l = 0
    sequence = 0
    for id in range(len(l)):
        if l[id] == "+":
            sum_of_l += sequence
            sequence = 0
        else:
            sequence *= 10
            sequence += int(l[id])
    sum_of_l += sequence
    ans += sum_of_l

print(ans)

Solution (Python):
s = str(input())

n = len(s)-1
ans = 0
for i in range(2**n):
    op = [""]*n
    for j in range(n):
        if (i>>j)&1:
            op [n - 1 - j] = "+"
    formula = ""
    for p1 ,p2 in zip(s, op + [""]):
        formula += (p1 + p2)
    ans += eval(formula)

print(ans)

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

res=0
if n==0:
    res=int(s)
    
for i in range(2**n):
    B=format(i,'b').zfill(n)+'1'
    left=0
    for j in range(n+1):
        if B[j]=='1':
            res+=int(s[left:j+1])
            left=j+1
        
print(res)

Solution (Python):

A = input()
a_len = len(A)

answer = 0
for i in range(2**(a_len-1)):
  a_tmp = A
  total = 0
  bin_index = format(i, 'b').zfill(a_len-1)
  for j in range(a_len-1):
    a_tmp = list(a_tmp)
    if bin_index[j] == '1':
      a_tmp.insert(2*j+1, '+')
    else:
      a_tmp.insert(2*j+1, '
    a_tmp = ''.join(a_tmp)
  a_tmp = a_tmp.replace('
  a_tmp = map(int, a_tmp.split('+'))
  answer += sum(a_tmp)
print(str(answer))

Solution (Python):
def main():
  s = input()
  p = len(s)
  i = 0
  ans = 0
  for i in range(2 ** (p-1)):
    t = s[0]
    for j in range(0,p-1):
      if (i & (1 << j)):
        t = t + "+"
      t = t + s[j+1]
      
    
    ans += eval(t)
    
  print(ans)
  
if __name__ == '__main__':
  main()

Solution (Python):

def equa(ans,i,s,p):
  for e in (0,1):
    p[i] = e
    if i < len(p)-2:
      ans = equa(ans,i+1,s,p)
    else:
      
      prii = 0
      for ii in range(len(p)):
        if p[ii] == 1:
          ans += int(s[prii:ii+1])
          
          prii = ii+1
  return ans
def main():
  s = input()
  p = [0]*(len(s)-1)
  p.append(1)
  i = 0
  ans = 0
  ans = equa(ans,i,s,p)
  print(ans)
  
if __name__ == '__main__':
  main()

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

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

Solution (Python):
S = input()

ans=0
for i in range(1<<(len(S)-1)):
    num = int(S[0])
    cur=0
    for j in range(len(S)-1):
        if i & (1<<j):
            cur+=num
            num=0
        num=num*10+int(S[j+1])
    cur += num
    ans+=cur
print(ans)

Solution (Python):
s = input()
ans = 0
for i in range(1<<(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=str(input())
n=len(s)
ans=0
x=1
list=[int(s[n-1])]
for i in range(2**(n-1)):
    for j in range(n-1):
        if (i>>j)&1==True:
            x*=10
        else:
            x=1
        list.append((int(s[n-2-j])*x))
    ans+=sum(list)
    x=1
    list=[int(s[n-1])]
print(ans)

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

Solution (Python):
S = input()

n = len(S)
Slen = 2**(n-1)
ans = 0

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

print(ans)

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

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

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

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

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

Solution (Python):
S=int(input())
leng=len(str(S))

bin(2**leng-1)
ans=0
if leng==1:
    print(S)
    exit()
for i in range(2**(leng-1)):
    bid=bin(2**(leng-1)+i)
    start=0
    for j in range(3,len(str(bid))):
        if bid[j]=='1':
            ans+=int(str(S)[start:j-2])
            start=j-2
        if j==len(str(bid))-1:
            ans+=int(str(S)[start:j-1])
print(ans)

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

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

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

Solution (Python):
s = input()

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

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

Solution (Python):
x = input()
l = len(x)
y_original = x[0]
s = 0

for i in range(1,l):
  y_original += 't'+x[i]
  
for i in range(2**(l-1)):
  y = y_original
  for j in range(l-1):  
    if ((i>>j) & 1) == 1:
      z = list(y)
      z[(2*l-3)-2*j] = '+'
      y = ''.join(z)
  y2 = y.replace('t','')
  s += eval(y2)
print(s)

Solution (Python):
s = input()
l = len(s)
m = [int(s[0])]
if l >= 2:
  for j in range(1,l):
    y = 0
    for k in range(1,j+1):
      y += m[k-1] + int(s[k:j+1]) *(2** (k-1))
    x = y + int(s[:j+1])
    m.append(x)
print(m[-1])

Solution (Python):
def main():
    S = input()
    n = len(S) - 1
    ans = 0

    for i in range(2 ** n):
        c = S[0]
        for j in range(n):
            if (i >> j) & 1 == 1:
                c += "+"
            c += S[j + 1]
        t = list(map(int, c.split("+")))
        ans += sum(t)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    S = input()
    n = len(S) - 1
    ans = 0

    if n == 0:
        print(int(S))
        return

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

        res = 0
        num = S[0]
        for j in range(n):
            if plus_lst[j] == 0:
                num += S[j + 1]

            if plus_lst[j] == 1:
                res += int(num)
                num = S[j + 1]

            if j == n - 1:
                res += int(num)

        ans += res

    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
S=str(input())
l=len(S)-1
ans=0

M = 2
def dfs(A):
    global ans
    
    if len(A) == l:
        memo=0
        for i in range(l):
            if A[i]==1:
                ans+=int(S[memo:i+1])
                memo=i+1
        ans+=int(S[memo:])
        return
    for v in range(M):
        A.append(v)
        dfs(A)
        A.pop() 

dfs([])
print(ans)

Solution (Python):


s = str(input())
n = len(s) - 1
answer = 0
for i in range(2 ** n):
    operation = [""] * n
    for j in range(n):
        if (i >> j) & 1:
            operation[n - 1 -j] = "+"
    
    formula = ""
    for p_n, p_o in zip(s, operation + [""]):
        formula += (p_n + p_o)
    
    answer += eval(formula)

print(answer)

Solution (Python):
s = input()
n = len(s)
sum = 0
for b in range(1 << (n-1)):
    t = 0
    for i in range(n-1):
        if b & (1 << i):
            sum += int(s[t:i+1])
            t = i+1
    sum += int(s[t:])
print(sum)

Solution (Python):
S=input()
res=[]
for i in range(2**(len(S)-1),2**(len(S))):
    tmp=''
    for j in range(len(S)):
        if j==len(S)-1:
            tmp+=S[j]
        elif (str(bin(i))[3:])[j]=='1':
            tmp+=S[j]
        else:
            tmp+=S[j]+'+'
    if tmp[-1]=='+':
        tmp=tmp[:-1]
    res.append(eval(tmp))
print(sum(res))

Solution (Python):

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

Solution (Python):

import itertools
S = input()
N = len(S)
res = 0
for ptr in itertools.product([0,1], repeat=(N-1)):
  formula = ""
  for i in range(N-1):
    if ptr[i] == 1:
      formula += S[i]
      formula += "+"
    else:
      formula += S[i]
  formula += S[N-1]    
  res += eval(formula)
print(res)

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

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

    formula = ''.join([n + op for n, op in zip(list(S), ptn + [''])]).replace(' ', '')
    ans += eval(formula)

print(ans)

Solution (Python):


S = input()
n = len(S) - 1
pattern = []
ans = 0

for i in range(2 ** n):
    tmp = [0] * n
    for j in range(n):
        if i >> j & 1:
            tmp[j] = "+"
    pattern.append(tmp)

for i in range(2 ** n):
    X = S[0]
    for j in range(n):
        if pattern[i][j] == "+":
            ans += int(X)
            X = S[j+1]
        else:
            X += S[j+1]
    ans += int(X)
print(ans)

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

sl=[]
for i in range(ls):
    sl.append(s[i])
nl=[int(j) for j in sl]


sumn=[]


for i in range(2**(ls-1)):
    
    mul=1
    for j in range(ls-1):
        number=mul*nl[ls-j-1]
        if ((i>>j)&1):
            mul=1
        else:
            mul*=10
        sumn.append(number)
    sumn.append(nl[0]*mul)
print(sum(sumn))

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

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

tot = 0

for i in range(2**(n-1)):
  f = S[0]
  for j in range(n-1):
       if ((i >> j) & 1):
        f += " "
       f += S[j+1]
  
  tot += sum(map(int, f.split(" ")))

print(tot)

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

Solution (Python):
import sys

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    ans = 0
    S = SI()
    bit_len = len(S)-1
    for i in range(2**bit_len):
        ls = ["" for _ in range(bit_len)]
        for j in range(bit_len):
            if (i >> j) & 1:
                ls[j] = "+"
                
        calc = []
        for n in range(len(S)):
            calc.append(S[n])
            if n != len(S)-1:
                calc.append(ls[n])
        ans += eval("".join(calc))
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import itertools

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



a = ['nashi','+']
Ls = list(itertools.product(a, repeat=N-1))


out=0
dammy=[]
for L in Ls:
    
    dammy=[]
    for i in range(N):
        
        if i==N-1:
            dammy.append(S[i])
            out+=int(''.join(dammy))
            dammy=[]
        elif L[i] == 'nashi':
            dammy.append(S[i])
        else:
            dammy.append(S[i])
            out+=int(''.join(dammy))
            dammy=[]

print(out)

Solution (Python):
a = [int(x) for x in input()]
n = len(a)

sum_val = 0
for i in range(1 << (n - 1)):
    tmp_val = a[0]
    for j in range(n - 1):
        if (i >> j) & 1:
            sum_val += tmp_val
            tmp_val = a[j + 1]
        else:
            tmp_val = tmp_val * 10 + a[j + 1]
    sum_val += tmp_val
print(sum_val)

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

cnt = 0
for i in range(1 << len(S)-1):
    y = None
    x = 0
    for j in range(len(S)):
        x -= 1
        if x == -len(S):
            cnt += int(S[x:y])
        elif i & (1 << j):
            cnt += int(S[x:y])
            y = x

print(cnt)

Solution (Python):
from itertools import product
s = input()
l = len(s)
ans = 0
for pattern in product(range(2), repeat=l-1):
  
  tempsum = 0
  temp = [s[0]]
  for i in range(l-1):
    if pattern[i] == 0:
      temp.append(s[i+1])
    else:
      tempsum+=int("".join(temp))
      temp = [s[i+1]]
  tempsum+=int("".join(temp))
  
  ans+=tempsum
print(ans)

Solution (Python):
s = input()
n = len(s)
def rec(op_index, part_s):
    if op_index == n - 1:
        return sum(map(int, part_s.split('+')))
    part_s1 = '{}{}'.format(part_s, s[op_index+1])
    part_s2 = '{}+{}'.format(part_s, s[op_index+1])
    return rec(op_index+1, part_s1) + rec(op_index+1, part_s2)
 
print(rec(0, s[0]))

Solution (Python):
import sys
sys.setrecursionlimit(int(1e8))


s = input()
n = len(s)

def rec(op_index, part_s):
    if op_index == n - 1:
        return sum(map(int, part_s.split('+')))
    part_s1 = '{}{}'.format(part_s, s[op_index+1])
    part_s2 = '{}+{}'.format(part_s, s[op_index+1])
    return rec(op_index+1, part_s1) + rec(op_index+1, part_s2)

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

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

Solution (Python):
if __name__ == '__main__':
    s = input()
    N = len(s)
    res = 0
    for bit in range(1 << N - 1):
        tmp = 0
        for i in range(N - 1):
            tmp *= 10
            tmp += int(s[i])
            if bit & (1 << i):
                res += tmp
                tmp = 0
        tmp *= 10
        tmp += int(s[-1])
        res += tmp
    
    print(res)

Solution (Python):

S = input()
result = 0
space_cnt = len(S)-1
for i in range(2 ** space_cnt):
    space = [""] * space_cnt
    for j in range(space_cnt):
        if ((i >> j) & 1):
            space[space_cnt -1 -j] = "+"
    formula = ""
    for i in range(space_cnt):
        formula += S[i]+space[i]
    formula += S[-1]
    result += eval(formula)
print(result)

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

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

Solution (Python):


s = input()
num = len(s)-1
ret = 0

for i in range(2**num):
    st = 0
    for j in range(num):
        if (i >> j) & 1:
            ret += int(s[st:j+1])
            st = j+1
    ret += int(s[st:])

print(ret)