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):
import copy
s = list(input())
t = []
t.append(s[0])
for i in range(1,len(s)):
    t.append('+')
    t.append(s[i])



sum = 0
for i in range(1 << (len(s)-1)):
    tmp = copy.deepcopy(t)
    for j in range(len(s)):
        if ( i >> j & 1 ):
            
            tmp[(j+1)*2-1] = ''
            
    sum += eval(''.join(tmp))
    
    
print(sum)

Solution (Python):
s = input()
space = len(s) - 1
total = []
for i in range(2 ** space):
    pluses = [''] * space
    for j in range(space):
        if (i >> j) & 1:
            pluses[j] = '+'
    re = ''
    for a, b in zip(s, pluses + ['']):
        re += (a + b)
    total.append(eval(re))
ans = sum(total)
print(ans)

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

for i in range(1 << len(S) - 1):
    f = ""
    for j in range(len(S) - 1):
        f += S[j]
        if (i >> j) & 1:
            f += '+'
    goukei += eval(f + S[-1])

print(goukei)

Solution (Python):
s = input()
op_cnt = len(s) - 1
ans = []
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] = '+'
    f = s[0]
    for p, q in zip(op, s[1:]):
        f += p + q
    ans.append(f)
sums = 0
for i in ans:
    sums += eval(i)
print(sums)

Solution (Python):

import sys
import math
import copy

def main():
	S = input()
	S = list(S)
	length = len(S)
	
	con = []
	for i in range(2 ** (length-1)):
		tmp = []
		for j in range(length):
			if (i >> j) & 1 == 1:
				tmp.append("+")
			else:
				tmp.append("")
		con.append(tmp)
	
	ans = 0
	for i, val in enumerate(con):
		counts = 0
		tmp = copy.deepcopy(S)
		for j, vol in enumerate(val):
			if vol == "+":
				counts += 1
				tmp.insert(j + counts, "+")
				
		lin = "".join(tmp)
		lin = lin.split("+")
		for i in lin:
			ans += int(i)
	
	print(ans)
	
if __name__ == "__main__":
	main()

Solution (Python):
import itertools
S = input()
N = len(S)
A = [0,1]
ans = 0
plus = []
for i in itertools.product(A, repeat = N-1):
    plus.append(i)
for op in plus:
    eq = S
    for index in range(N-1):
        if op[index] == 1:
            eq = eq[:N-index-1] + ',' +eq[N-index-1:]
    eq = eq.split(',')
    le = len(eq)
    for i in range(le):
        ans += int(eq[i])
print(ans)

Solution (Python):
n=input()
anslist=[]

def saiki(n,x,a,k):
    if k==len(n):
        anslist.append(eval(x))
        return
    else:
        for i in a:
            y=x
            x=x+i+n[k]
            saiki(n,x,a,k+1)
            x=y       

saiki(n,n[0],['','+'],1)
print(sum(anslist))

Solution (Python):
S = input()
op_cnt = len(S) - 1
ResSum = 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 p_S, p_o in zip(S, op + [""]):
        formula += (p_S + p_o)

    ResSum += eval(formula)

print(ResSum)

Solution (Python):
S=input()

ans=0

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

print(ans)

Solution (Python):

 
def main(S):
    sum = 0
    for i in range(1 << (len(S)-1)):
        res = S[0]
        for j in range(len(S)-1):
            if((i >> j) & 1):
                res += "+"
            res += S[j+1]    
        sum += eval(res)
    print(sum)
            
if(__name__ == "__main__"):
    S = list(input())
    
    main(S)

Solution (Python):
import itertools
s=input()
length=len(s)

ans=0
mylist=list(itertools.product('01',repeat=length-1))

for j in range(len(mylist)):
    tmp=s[0]
    for i in range(length-1):
        if mylist[j][i]=='1':
            tmp+="+"+s[i+1]
        else:
            tmp+=s[i+1]
    tmp=eval(tmp)
    ans+=tmp
print(ans)

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

ans = 0
for i in range(2**(n-1)):
    L = []
    for i,c in enumerate(bin(i)[2:].zfill(n)):
        if c == '1':
            L.append(i)
    L.append(n)
    S_ = []
    l_prev = 0
    for l in L:
        S_.append(int(S[l_prev:l]))
        l_prev = l
    ans += sum([int(s_) for s_ in S_])

print(ans)

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

Solution (Python):
s=input()
length=len(s)
cost=0
for i in range(2**(length-1)):
    string=s[0]
    for j in range(length-1):
        if((i>>j)&1):
            string=string+"+"+s[j+1]
        else:
            string=string+s[j+1]
    cost=cost+sum(map(int, string.split("+")))
print(cost)

Solution (Python):
s = list(input())
sum = 0
for i in range(2 ** (len(s)-1)):
  st = str(s[0])
  for j in range(len(s)-1):
    if (i >> j) & 1:
      st = st + "+" + str(s[j+1])
    else:
      st = st + str(s[j+1])
      
  for item in st.split('+') :
    sum += int(item)
print(sum)

Solution (Python):
S = list(input())
n = len(S)
def dfs(count,s):
    if count == n:
        
        return eval(s)
    
    plus = dfs(count+1, s+'+'+S[count]) 
    nothing = dfs(count+1, s+S[count])  
    return plus + nothing

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

Solution (Python):
S = input()
l = len(S)
ans = 0
for i in range(2 ** (l - 1)):
    tmp = ''
    for j, c in enumerate(S):
        tmp += c
        if i & (1 << j):
            tmp += '+'
    ans += eval(tmp)
print(ans)

Solution (Python):

s = input()
if len(s) == 1:
    print(s)
    exit()
o = []
sum = 0
for i in range(1 << len(s) - 1):
    bit = format(i, "0" + str(len(s) - 1) + "b")
    o.append(bit.replace("1", "+").replace("0", " "))
for t in o:
    r = ""
    for s1, s2 in zip(s, t):
        r += (s1 + s2)
    r += s[-1]
    r = r.replace(" ", "")
    sum += eval(r)
print(sum)

Solution (Python):
s = input()
s_list = []
for i in range(1 << (len(s) - 1)):
  s_ = ''
  for j in range(len(s) - 1):
    s_ += s[j:j+1]
    if (i >> j) % 2 == 1:
      s_ += '+'
  s_ += s[-1]
  s_list += [s_]

res = 0
for s_ in s_list:
  res += sum(map(int, s_.split('+')))
print(res)

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


def dfs(count, str):
    if count == N:
        return eval(str)
    plus = dfs(count + 1, str + '+' + S[count])
    noaction = dfs(count + 1, str + S[count])
    return plus + noaction


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

Solution (Python):
s = input()
n = len(s)
ans = 0
for i in range(2**(n-1)):
  tmp = ''
  for j, c in enumerate(s):
    tmp += c
    if i&(1<<j):
        tmp+='+'
  ans+=eval(tmp)
print(ans)

Solution (Python):
s = input()

def cal_sum(s, is_plus):
    s_idx = 0
    result = 0
    for p_idx, p in enumerate(is_plus):
        if p == '1':
            result += int(s[s_idx:p_idx+1])
            s_idx = p_idx + 1
    result += int(s[s_idx:])
    return result

res = 0
for i in range(2**(len(s)-1)):
    is_plus ='{i:0={width}b}'.format(i=i, width=len(s)-1) 
    res += cal_sum(s, is_plus)
print(res)

Solution (Python):
S=input()
w=len(S)-1
l=[]
L=[]

if w==0:
    print(int(S))
else:
    for i in range(2**w):
        
        l.append(format(i, '0{}b'.format(w)))
    
    for e in l:
        q=[]
        x=int(S[0])
        for i in range(len(e)):
            if e[i]=='0':
                x=x*10+int(S[i+1])
            else:
                q.append(x)
                x=int(S[i+1])
        q.append(x)
        L.append(sum(q))
    print(sum(L))

Solution (Python):
s=int(input())
S=str(s)
w=len(str(s))-1
l=[]
L=[]
if w==0:
    print(s)
else:
    for i in range(2**w):
        l.append(format(i, '0{}b'.format(w)))
    for e in l:
        q=[]
        x=int(S[0])
        for i in range(len(e)):
            if e[i]=='0':
                x=x*10+int(S[i+1])
            else:
                q.append(x)
                x=int(S[i+1])
        q.append(x)
        L.append(sum(q))
    print(sum(L))

Solution (Python):
import copy
S=input()
lst=[]
def Sum(l,S):
    if S=="A":
        return sum(l)
    a=l.pop()
    x=copy.copy(l)
    x.append(a*10+int(S[0]))
    y=copy.copy(l)
    y.extend([a,int(S[0])])
    return Sum(x,S[1:])+Sum(y,S[1:])
S+="A"
lst.append(int(S[0]))
print(Sum(lst,S[1:]))

Solution (Python):
import copy
S=input()
lst=[]
def Sum(l,S):
    if S=="A":
        return sum(l)
    a=l.pop()
    x=copy.copy(l)
    x.append(a*10+int(S[0]))
    y=copy.copy(l)
    y.extend([a,int(S[0])])
    return Sum(x,S[1:])+Sum(y,S[1:])
S+="A"
lst.append(int(S[0]))
print(Sum(lst,S[1:]))

Solution (Python):
s = list(input())
ans = 0
for i in range(1<<len(s)-1):
    nums = []
    cnt = 0
    for j in range(len(s)):
        if (i>>j) & 1 == 1:
            nums.append(s[cnt:j+1])
            cnt = j+1
    nums.append(s[cnt:len(s)+1])
    for k in range(len(nums)):
        ans += int("".join(nums[k]))
print(ans)

Solution (Python):

def func(S):
	l = []
	
	for mask in range(2 ** (len(S) - 1)):
		
		end = len(S)
		begin = end - 1
		mask_t = mask
		while(0 < mask_t):
			
			while(0 == mask_t & 0x01):
				mask_t >>= 1
				begin -= 1
			
			l.append(int(S[begin:end]))
			
			mask_t >>= 1
			end = begin
			begin = end - 1
		
		l.append(int(S[:end]))
	return str(sum(l))

def main():
	print(func(input()))
	
	
	return

if __name__ == '__main__':
	main()

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

total = 0
for i in range(2 ** (l - 1)):
    str_bin = '{0:0=9b}'.format(i)
    str_bin = str_bin[10 - l:]
    list_cut = [0] + [k + 1 for k, cur_num in enumerate(str_bin) if cur_num == "1"] + [l]
    cur_total = []
    for j in range(len(list_cut) - 1):
        cur_total.append(int(s[list_cut[j]:list_cut[j + 1]]))
    total += sum(cur_total)

print(total)

Solution (Python):
S = str(input())
p = ["+",""]
total = 0

for i in range(2**(len(S)-1)):
    t = S[0]
    for j in range(len(S)-1):
        t = t + p[i>>j&1] + S[j+1]
    total += eval(t)
print(total)

Solution (Python):
S = input()

n = len(S) - 1
ans = ''

for i in range(1 << n):
    tmp = S[0]
    for j in range(n):
        if (i >> j) % 2:
            
            tmp += '+'+S[j+1]
        else:
            tmp += S[j+1]
    ans += '+'+tmp


print(eval(ans[1:]))

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

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

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

def dfs(string,cur):
  global ans
  if cur==n:
    ans+=eval(string)
    return
  ret0=dfs(string+"+"+s[cur],cur+1)
  ret1=dfs(string+s[cur],cur+1)
dfs(s[0],1)
print(ans)

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


def rec(now, depth):
    if depth == len(s):
        global ans
        ans += eval(now)
        return
    rec(now + '+'+s[depth], depth + 1)
    rec(now + s[depth], depth + 1)


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

Solution (Python):
import numpy as np

S = input()
b = np.zeros(len(S)-1)
num = 0
for i in range(2**(len(S)-1) -1):
    str = S[0]
    for k in range(len(S)-1):
        if b[k] == 0:
            str = str + S[k+1]
        else:
            str = str + "+" + S[k+1]
            
    num += eval(str)
    
    b[0] += 1
    for k in range(len(S)-1):
        if b[k] == 2:
            b[k+1] += 1
            b[k] = 0
            
str = S[0]
for k in range(len(S)-1):
    if b[k] == 0:
        str = str + S[k+1]
    else:
        str = str + "+" + S[k+1]
            
    
num += eval(str)

print(num)

Solution (Python):
S = input()
length = len(S) - 1
ans = ''
for bit in range(2 ** length):
    x = [i for i in range(length) if bit & (2 ** i)]
    tmp = S
    
    for i in range(len(x)):
        tmp = tmp[:x[i] + i + 1] + '+' + tmp[x[i] + i + 1:]
    
    ans += tmp + '+'
print(sum(map(int, ans[:-1].split('+'))))

Solution (Python):
target = input()
length = len(target)
binary = length - 1
target_list = []
answers = 0
for i in range(length):
    if i:
        target_list.append("")
    target_list.append(target[i])
for bit in range(2 ** binary):
    temp = target_list.copy()
    for i in range(binary):
        if bit & (1 << i):
            temp[1 + 2 * i] = "+"
    
    answers += eval("".join(temp))
print(answers)

Solution (Python):
def to_bit(num,digit):
    bit = [0] * digit
    for i in range(digit):
        bit[i] = num % 2
        num = int((num - (num % 2)) / 2)
    return bit

a = list(input())
a = [int(i) for i in a]

sum_ = 0
for i in range(2 ** (len(a) - 1)):
    bit = to_bit(i,len(a) - 1)

    now_f = 0
    now_n = 0
    
    for j in range(len(a)):
        if j == len(a) - 1 or bit[j] == 1:
            now_n = now_n * 10 + a[j]
            now_f += now_n
            now_n = 0
        else:
            now_n = now_n * 10 + a[j]
    
    sum_ += now_f


print(sum_)

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

sum_num = 0
for i in range(1<<n):
    t = S[0]
    for j in range(n):
        if (i>>j)%2:
            t += "+"
        t += S[j+1]
    sum_num += eval(t)

print(sum_num)

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

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

print(ans)

Solution (Python):
import sys
inp = sys.stdin.readline

S = inp().replace('\n', '')

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

Solution (Python):
ns = list(map(int, input()))

def comb(num):
    if num <= 0:
        return 1
    return 2 ** (num - 1)

ans = 0
for l, n in enumerate(ns):
    rmax = len(ns) - l
    for r in range(rmax):
        co = comb(l + 1) * comb(rmax - r - 1)
        ans += n * 10**r * co

print(ans)

Solution (Python):
S = input()

def search(string, flg, sum):
    if flg >= len(string):
        return sum + int(string)
    before = search(string[flg:], 1, sum + int(string[:flg]))
    after = search(string, flg + 1, sum)
    sum = before + after
    return sum

print(search(S, 1, 0))

Solution (Python):
def inpl():
    return list(map(int, input().split()))


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) % 2 == 1:
            ans += int(tmp)
            tmp = ""
        tmp += S[j + 1]
    ans += int(tmp)
print(ans)

Solution (Python):


S = input()


ans = 0
for i in range(1<<(len(S)-1)):
    bef = 0
    lst = []
    
    for j in range(len(S)-1):

        if i & 1<<j:
            lst.append( int(S[bef:j+1]) ) 
            
            bef = j+1
    lst.append( int(S[bef:]) ) 
    
    ans += sum(lst)
    
    
print(ans)

Solution (Python):
import itertools

S = input()

seq = (0, 1)
ptr = itertools.product(seq, repeat=len(S)-1)
res = 0 

for p in ptr:
    tmp = 0
    tmps = S[0]
    
    for i in range(len(S)-1):
        if p[i] == 0:
            tmps += S[i+1]
        else:
            tmp += int(tmps)
            tmps = S[i+1]
            
    if tmps != '':
        tmp += int(tmps)     
        
    res += tmp
     
print(res)

Solution (Python):
"""
＋を挟むか挟まないかは2**N通り。(Nはlen(s))
二進数で表してi番目のビットが0ならi番目の数字の右に＋を挟む。1なら挟まないという方針
"""
s=input()
l=list(s)

lst_2=0
'''
bi=[bin(2**i) for i in range(0,len(s))]
print(bi)
'''
for i in range(1<<(len(s)-1)):
    st=l[0]
    for j in range(len(s)-1):
        if (i>>j)&1:
            st+=l[j+1]
        else:
            st+='+'+l[j+1]
    
    lst_2+=eval(st)
    
    

print(lst_2)

Solution (Python):
s = input()

answer = 0
for canditate in range(1 << len(s)-1):
    combi = s[0]
    for n_digit in range(len(s) - 1):
        if (canditate >> n_digit) & 1:
            combi += '+'
        combi += s[n_digit+1]  
    answer += eval(combi)

print(answer)

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

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

Solution (Python):

S=input()
def bubunwa(S):
    total=int(S)
    for i in range(1,len(S)):
        total=total+int(S[:i])*(2**(len(S[i:])-1))+bubunwa(S[i:]) 

    return total
print(bubunwa(S))

Solution (Python):
p=[]
s=input()
for i in range(2**(len(s)-1)):
    k=s[:]
    d=bin(i)[2:]
    d="0"*(len(s)-len(d)-1)+d
    c=s[0]
    for i in range(len(s)-1):
        if d[i]!="0":
            c+="+"+s[i+1]
        else:
            c+=s[i+1]
    else:
        p.append(eval(c))
print(sum(p))

Solution (Python):
S = input()

ans = 0

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

print(ans)

Solution (Python):
S = input()

ans = 0

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

print(ans)

Solution (Python):
S = input()

ans = 0

for i in range(1 << len(S) - 1):
    op = []
    for j in range(len(S) - 1):
        if i >> j & 1:
            op.append('+')
        else:
            op.append('')
    op.append('')
    exp = ''
    for e in zip(S, op):
        exp += ''.join(e)
    ans += eval(exp)

print(ans)

Solution (Python):
S = input()
power = len(S)-1
loop = 2**power

revS = list(reversed(S))
ans = 0

for i in range(loop):
    ans += int(revS[0])
    multi_ten = 10
    for j in range(power):
        digit = bin(i>>j)[-1]
        if digit == "0":
            ans += int(revS[j+1])*multi_ten
            multi_ten *= 10
        else:
            ans += int(revS[j+1])
            multi_ten = 10
print(ans)

Solution (Python):
S = input()
power = len(S)-1
loop = 2**power

revS = list(reversed(S))
ans = 0

for i in range(loop):
    ans += int(revS[0])
    multi_ten = 10
    for j in range(power):
        digit = bin(i>>j)[-1]
        if digit == "0":
            ans += int(revS[j+1])*multi_ten
            multi_ten *= 10
        else:
            ans += int(revS[j+1])
            multi_ten = 10
print(ans)

Solution (Python):
s=input()

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

Solution (Python):

s=input()
lenth=len(s)
kugiri=set()
def roop(before,now,kugiri):
    if now==lenth:
        kugiri|={before,}
        return kugiri
    kugiri = roop(before+(0,),now+1,kugiri)
    kugiri = roop(before+(1,),now+1,kugiri)
    return kugiri


def calc(ans,kugiri,s):
    test=s
    now=test[0]
    test=test[1:]
    for i in range(len(s)-1):
        k=kugiri[i]
        if k==0:
            now+=test[0]
        elif k==1:
            ans+=int(now)
            now=test[0]
        test=test[1:]
        if i==len(s)-2:ans+=int(now)
    return ans
            
ans=0
if len(s)!=1:
    kugiri = roop((0,),2,kugiri)
    kugiri = roop((1,),2,kugiri)
    for i in kugiri:
        ans=calc(ans,i,s)
    print(ans)
elif len(s)==1:print(int(s))

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

def bit_search(s):
    
    if len(s)==1:
        
        return int(s[0]),1 
    else:
        
        sum1, cases1 = bit_search(s[1:])
        tmp1 = int(s[0])*cases1+sum1
        tmp = [s[0]+s[1]]+s[2:]
        
        tmp2, cases2 = bit_search(tmp)
        return tmp1+tmp2, cases1+cases2


print(bit_search(S)[0])

Solution (Python):


S = list(input())


answer = 0
for i in range(1 << (len(S)-1)):
    expression = []
    for j in range(len(S)):
        if ((i >> j) & 1) == 1:
            expression.append("{}+".format(S[j]))
        else:
            expression.append(S[j])
    
    answer += eval("".join(expression))

print(answer)

Solution (Python):
s=input()
l=list(s)
lst=[]

for i in range(1<<(len(s)-1)):
    st=l[0]
    for j in range(len(s)-1):
        if (i>>j)&1:
            st+=l[j+1]
        else:
            st+='+'+l[j+1]
    lst.append(eval(st))
print(sum(lst))

Solution (Python):
S = input()
power = 0
answer = 0
temps = int(S)
while True:
    if temps < 10:
        break
    temps = temps/10
    power += 1

SS = list(S)

for i in range(1 << power):
    output = []
    for j in range(power):
        if (i>>j)&1 == 1:
            output.append(SS[j])
            output.append('+')
        else:
            output.append(SS[j])
    output.append(SS[power])
    temp_string = ''.join(output)
    answer += eval(temp_string)
    
print(answer)

Solution (Python):


import itertools

S = input()
l = len(S)

cs = itertools.product(['+', ''], repeat=l-1)

ans = 0
for c in cs:
    ex = ''.join([S[i] + c[i] for i in range(l-1)] + [S[-1]])
    exec("ans += {}".format(ex))

print(ans)

Solution (Python):
s = input()

def split_by_num(s, bits):
    i, j = 0, 0
    res = 0
    while j < len(bits):
        if bits[j] == "1":
            res += int(s[i:min(len(s), j+1)])
            j += 1
            i = j
        else:
            j += 1

    res +=  int(s[i:])
    return res


res = 0
for i in range(0, 1 << (len(s) - 1)):
    tar_bin = format(i, 'b')
    if len(tar_bin) != len(s) - 1:
        tar_bin = "0" * (len(s) - 1 - len(tar_bin)) + tar_bin
    
    res += split_by_num(s, tar_bin)
print(res)

Solution (Python):
s = input()
nums = [int(v) for v in s]

l = len(s)

ans = 0
for i in range(1 << (l-1)):
    tmp = s[0]
    for j in range(l-1):
        if i & 1 << j:
            tmp += '+'+s[j+1]
        else:
            tmp += s[j+1]
    ans += eval(tmp)
print(ans)

Solution (Python):
s = input()
nums = [int(v) for v in s]

l = len(s)

ans = 0
for i in range(1 << (l-1)):
    tmp = s[0]
    for j in range(l-1):
        if i & 1 << j:
            tmp += '+'+s[j+1]
        else:
            tmp += s[j+1]
    ans += eval(tmp)
print(ans)

Solution (Python):
inputs = list(map(int, list('125')))


def prepare():
    global inputs
    inputs = list(map(int, list(input())))


def solve():
    total = 0
    slot = len(inputs) - 1
    cases = range(1 << slot)
    for case in cases:
        sum = inputs[slot]
        power = 0
        for i in range(slot):
            if case & (1 << i):
                power = 0
            else:
                power += 1
            sum += inputs[slot - (i + 1)] * 10**power
        total += sum
    return total


prepare()
output = solve()
print(output)

Solution (Python):

import sys





"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: 数
        """
        return int(self.input())

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        
        
        
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)


"""ここからメインコード"""


def main():
    
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    s = str(ip.I())
    ans = 0
    
    
    for i in r(1 << len(s) - 1):
        
        p = ""
        for j, d in e(s):
            p += d
            if id.bit_n(i, j):
                p += "+"
            if j == len(s) - 1:
                break
        ans += eval(p)
    print(ans)


main()

Solution (Python):

import sys





"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: 数
        """
        return int(self.input())

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        
        
        
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)


"""ここからメインコード"""


def main():
    
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    s = str(ip.I())
    ans = 0
    
    n = len(s) - 1

    
    for i in r(1 << n):
        
        p = ""
        for j, d in e(s):
            p += d
            if id.bit_n(i, j):
                p += "+"
            if j == n:
                break
        
        ans += eval(p)
    print(ans)


main()

Solution (Python):

import sys





"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: 数
        """
        return int(self.input())

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        
        
        
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if ((i >> j) & 1) == 1:
                    """右からj+1番目のiが1かどうか判定"""
                    
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val


"""ここからメインコード"""


def main():
    
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    s = str(ip.I())
    ans = 0
    
    n = len(s) - 1

    
    for i in r(1 << n):
        
        p = ""
        for j, d in e(s):
            p += d
            if (i >> j & 1) > 0:
                p += "+"
            if j == n:
                break
        
        ans += eval(p)
    print(ans)


main()