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 sys
import copy

sys.setrecursionlimit(10**6)

def solve():
    S = input()
    lst = [int(S)]
    print(sum(func(S, 1, lst)))
    
def func(s, insertInd, lst):
    if insertInd == len(s):
        return lst
    
    else:
        copied = s
        inserted = copied[:insertInd] + '+' + copied[insertInd:]
        lst.append(evalsum(inserted))
        a = func(inserted, insertInd + 2, lst) 

        inserted = copied[:insertInd] + ' ' + copied[insertInd:]
        if inserted in '+':
            lst.append(evalsum(inserted))
        func(inserted, insertInd + 2, lst)
        
        return a

def evalsum(s):
    s = s.replace(' ', '')
    return sum(list(map(int, s.split('+'))))

if __name__ == '__main__':
    solve()

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())
l = len(S)
ans = 0
for i in range(1 << (l-1)):
    A = str(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):
s = input()
n = len(s)

def dfs(tmp, s):
    if len(s) == 1:
        return int(tmp)+int(s)+int(tmp+s)
    
    return int(tmp)*2**(len(s)-1)+dfs(s[0], s[1:]) + dfs(tmp+s[0], s[1:])

if n > 1:
    print(dfs(s[0], s[1:]))
else:
    print(int(s))

Solution (Python):
import numpy as np
s = input()

n = len(s)
iters = 2 ** (n - 1)
count = 0
for i in range(iters):
    buf = s[0]
    for j in range(n - 1):
        if i & (2**j):
            count += int(buf)
            buf = s[j + 1]
        else:
            buf += s[j + 1]
    count += int(buf)
print(count)

Solution (Python):
import numpy as np
s = input()

item = np.arange(len(s) - 1) + 1
n = len(item)
count = 0
for i in range(2 ** n):
    sidx = 0
    for j in range(n):  
        if ((i >> j) & 1):  
            eidx = item[j]
            count += int(s[sidx:eidx])
            sidx = eidx
    count += int(s[sidx:])
print(count)

Solution (Python):

S = input()
N= len(S)
ans = 0


for i in range(2 ** (N - 1)):
    
    now_sum = 0                 
    reg = int(S[0])
    for j in range(N - 1):      
        if i & (1 << j):        
      
            now_sum += reg      
            reg = 0
        reg *= 10               
        reg += int(S[j + 1])    
    now_sum += reg
    ans += now_sum
 
print(ans)

Solution (Python):
from itertools import zip_longest

N = input()
len_N = len(str(N))
sum =0

for i in range(2**(len_N-1)):
  hugo = [""]*(len_N-1)
  for j in range(len_N-1):
    if (i>>j)& 1:
      hugo[j]="+"
  
  formula=""
  for aaa,bbb in zip_longest(N,hugo+[""]):
    formula +=(aaa+bbb)
  sum += eval(formula)

print(sum)

Solution (Python):
S = input()
l = len(S)
toal = 0
for i in range(1 << (l-1)):
    a = int(S[0])
    sum_t = 0
    for j in range(l-1):
        if ((i >> j) & 1):
            sum_t += a
            a = 0
        a *= 10
        a += int(S[j+1])
    sum_t += a 
    toal += sum_t
    
print(toal)

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

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

print(ans)

Solution (Python):
from itertools import product

s = input()

ans = 0
for pat in product(["+", ""], repeat=len(s)-1):
    eq = ""
    for i in range(len(s)-1):
        eq += s[i] + pat[i]
    eq += s[-1]
    ans += eval(eq)

print(ans)

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

def num2bin(x, y):
  return format(x, '0'+str(y)+'b')

def f(a):
  out=0
  a=a+'+'
  l=len(a)
  i=0
  while i<l-1:
    j=i+1
    while j<l and a[j]!='+':
      j+=1
      
    out+=int(a[i:j])
    i=j
    
  return out
      

out=0
temp=pow(2, nn)
for i in range(temp):
  p=num2bin(i, nn)
  a=''
  for j in range(nn):
    a=a+S[j]
    if p[j]=='1':
      a=a+'+'
      
  a=a+S[-1]
  
  out+=f(a)
  
print(out)

Solution (Python):

from itertools import product


def main():
    S = input()
    if "\n" in S:
	    return
    ans = 0
    for ops in tuple(product(("", "+"), repeat=len(S) - 1)):
        ops = ops + ("",)  
        exp = "".join(i + j for i, j in zip(S, ops))  
        ans += eval(exp)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys


def input():
    return sys.stdin.readline().strip()


s = input()
n = len(s)

total_sum = 0


for i in range(2 ** (n - 1)):
    
    
    now_sum = 0
    reg = int(s[0])
    for j in range(n - 1):
        if i & 1 << j:
            now_sum += reg
            reg = 0
        reg *= 10
        reg += int(s[j + 1])
    now_sum += reg

    total_sum += now_sum

print(total_sum)

Solution (Python):
s = input()
n = len(s)-1
comb = 2**n-1 
S = 0
for i in range(comb+1):
    
    sep =[]
    j0 = 0
    for j in range(n):
        
        if (i>>j & 1):
            sep.append(s[j0:j+1])
            j0 = j+1
    sep.append(s[j0:])
    
    x = list(map(int, sep))
    S += sum(x)

print(S)

Solution (Python):
import itertools
a=input()
n=len(a)
l=list(itertools.product(range(2),repeat=n-1))
wl=[]
for i in range(len(l)):
    w=a[0]
    for j in range(n-1):
        if l[i][j]==1:
            w+="+"
        w+=a[j+1]
    wl.append(w)
print(sum(map(eval,wl)))

Solution (Python):
s=list(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):
import sys
from collections import defaultdict, Counter, deque
from itertools import accumulate, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right, bisect
from heapq import heappop, heappush
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi
from copy import deepcopy




def parse():

    return 

def main():
    S = input()
    ans = 0
    nn = len(S)-1
    for i in range(1<<nn): 
        
        end = len(S)
        for j in range(nn):
            if 1<<j & i:
                start = len(S)-1-j
                s = S[start:end]
                
                
                try:
                    ans += int(s)
                except:
                    pass
                end = start
        s = S[:end]
        
        try:
            ans += int(s)
        except:
            pass
        
    print(ans)



if __name__ == '__main__':
    main()

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

ans = 0


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

print(ans)

Solution (Python):
S = input()
num = []
ans = 0
length = 0


def calc(x, i, j):
    if i == length-1:
        x += j
        global ans
        ans += x
    else:
        calc(x+j, i+1, num[i+1])
        calc(x, i+1, 10*j+num[i+1])


def solve():
    for s in S:
        num.append(int(s))
    global length
    length = len(num)
    calc(0, 0, num[0])
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
import itertools
s=input()
n=len(s)
l=list(itertools.product(range(2),repeat=n-1))
tl=[]
for i in range(len(l)):
    t=s[0]
    for j in range(n-1):
        if l[i][j]==1:
            t+='+'
        t+=s[j+1]
    tl.append(t)
print(sum(map(eval,tl)))

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

n = len(S)

def getMax(fml, i):
    if i == n:
        return eval(fml)
    else:
        return getMax(fml + S[i], i+1) + getMax(fml + "+" + S[i], i+1)

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

Solution (Python):
s = input()

n = len(s)

def formula(fml, i):
  if i == n:
    return eval(fml)
  else:
    return formula(fml + s[i], i+1) + formula(fml + '+' + s[i], i+1)
    
print(formula(s[0], 1))

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

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

Solution (Python):
S = input()

def DFSCalculation(plus_list):
    """return: 合計値"""

    if len(plus_list) == len(S) - 1:
        cand_list = []
        pre_i = 0
        for i in range(len(plus_list)):
            if plus_list[i] == 0:
                pass
            else:
                cand_list.append(S[pre_i : i + 1])
                pre_i = i + 1
        cand_list.append(S[pre_i :])
    
        sum_value = 0
        for x in cand_list:
            sum_value += int(x)
        return sum_value

    else:
        in_plus = DFSCalculation(plus_list + [1])
        not_in_plus = DFSCalculation(plus_list + [0])
        return in_plus + not_in_plus

sum_value = DFSCalculation([])

print(sum_value)

Solution (Python):
s = input()
r = 0
for i in range(2**(len(s)-1)):
  fml = ""
  for j in range(len(s)-1):
    fml += s[j]
    if((i>>j)%2): fml += "+"
  fml += s[-1]
  r += eval(fml)
print(r)

Solution (Python):
n = list(input())
gaps = len(n) - 1
import copy
ans = 0
for i in range(2 ** gaps):
    formula = copy.deepcopy(n)
    ops = [""] * gaps
    for j in range(gaps):
        if (i >> j) & 1:
            ops[gaps-j-1] = "+"
    formula1 = ""
    for f,op in zip(formula,ops + [""]):
        formula1 += (str(f) + op)
    ans += eval(formula1)

print(ans)

Solution (Python):
S = input()

l = len(S)
S_list = list(map(int, S))

ans = 0

for i in range(l):
    num = int(S_list[-i-1])

    for j in range(i+1):
        ans += num * (10 ** (j)) * (2 ** (max(l-1-j-1, l-1-i)))

print(ans)

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

result = 0
L = []





def recur(i, buf, current, S):
  global result
  if i == len(S) - 1:
    total = [current + buf * 10 + S[i],current,buf * 10,S[i]]
    L.append(total)
    result += current + buf * 10 + S[i]
    return
  
  
  
  
  
  
  
  recur(i + 1, 0, current + buf * 10 + S[i], S)

  
  
  
  
  
  
  recur(i + 1, buf * 10 + S[i], current, S)

recur(0, 0, 0, S)
print(result)

Solution (Python):
s = input()
l = len(s)
ans = 0
for i in range(2**(l-1)):
  cur = bin(i)[2:]
  cur = '0' * (l-1-len(cur)) + cur
  d = s[0]
  for j in range(l-1):
    if cur[j] == '1':
      ans += int(d)
      d = s[j+1]
    else:
      d += s[j+1]
  ans += int(d)
print(ans)

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

r = [""]*len(s)
ans = 0

def rec(i: int) -> None:
    if i == len(s)-1:
        global ans
        ans += eval("".join(i+j for i, j in zip(s, r)))
        return

    rec(i + 1)
    r[i] = "+"
    rec(i + 1)
    r[i] = ""

rec(0)
print(ans)

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

Solution (Python):
S = input()
n = len(S) - 1
bool_list = [False] * n

state_list = []

def dfs(i, n, bool_list):
    bool_list = bool_list.copy()
    if i == n:
        state_list.append(bool_list)
    else:
        dfs(i + 1, n, bool_list)
        bool_list[i] = True
        dfs(i + 1, n, bool_list)

dfs(0, n, bool_list)

ans = 0
for state in state_list:
    res_str = ''
    for i in range(n):
        res_str += S[i]
        if state[i]:
            res_str += '+'
    else:
        res_str += S[-1]
    ans += eval(res_str)

print(ans)

Solution (Python):
def sumd(S,n,k):
    res=0
    temp=int(S[0])
    for i in range(n-1):        
        if k&(1<<i):
            res+=temp
            temp=int(S[i+1])
        else:
            temp=temp*10+int(S[i+1])
    res+=temp
    return res

S=input()
n=len(S)
ans=0
for k in range(1<<(n-1)):
    ans+=sumd(S,n,k)
print(ans)

Solution (Python):
s = list(input())
n = len(s)
ans = 0
for i in range(2**(n-1)):
  t = s[:]
  bag = []
  for j in range(n-1):
    if (i >> j) & 1:
      bag += [j]
  for idx in bag[::-1]:
    t.insert(idx+1, "+")
  ans += eval(''.join(t))

print(ans)

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

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

Solution (Python):

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

Solution (Python):
S = input()
s = S[0]
ans = 0
def dfs(n,S,s):
    global ans
    s_0 = s + "+" + S[n]
    s_1 = s + S[n]
    if n == len(S) - 1:
        ans += eval(s_0) + eval(s_1)
    else:
        dfs(n+1,S,s_0)
        dfs(n+1,S,s_1)
if len(S) == 1:
    print(int(S))
else:
    dfs(1,S,s)
    print(ans)

Solution (Python):
import copy
S = input()

'''
bit探索
2 進数表記した場合の下から数えて n 桁目（一番下の桁を 0 とします）が 1 であるかどうかをチェックするためのコードは、(i >> n) & 1 
'''
def bit_cal2(n):
    return_list = ['']* (2 ** n)
    for i in range(2 ** n):
        for j in range(n):
            if ((i >> j) & 1):
                return_list[i] = return_list[i] + '1'
            else:
                return_list[i] = return_list[i] + '0'
    return return_list


'''
def bit_cal(max_num,cal_list=[],current_cnt=0):
    new_list = []
    if len(cal_list) == 0:
        for i in range(2):
            new_list.append([i])
    else:
        for cal_val in cal_list:
            for i in range(2):
                tmp = copy.deepcopy(cal_val)
                tmp.append(i)
                new_list.append(tmp)
    current_cnt += 1
    if max_num == current_cnt:
        return new_list
    return bit_cal(max_num,new_list,current_cnt)

'''
all_plus_combination = bit_cal2(len(S)-1)
ans = 0
for plus_combination in all_plus_combination:
    start_idx = 0
    for i in range(len(S)-1):
        if plus_combination[i] == '1':
            ans += int(S[start_idx:i+1])
            start_idx = i+1
    ans +=int(S[start_idx:100])
print(ans)

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

ans = 0

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

print(ans)

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

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

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

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

    ans += eval(t)

print(ans)

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

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

print(ans)

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

sum = 0
for i in range(2 ** n):
    s = S[0]
    for j in range(n):
        if (i >> j) & 1:
           s += "+"
        s += S[j+1]
    sum += eval(s)
print(sum)

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

bitlist = []
def allbit(string, n):
    if n ==0:
        bitlist.append(string)
        return
    allbit(string + "0", n-1);
    allbit(string + "1", n-1);
    
allbit("", sl-1)

ans = 0
for bit in bitlist:
    before_idx = 0
    for idx, b in enumerate(bit):
        if b == "1":
            if s[before_idx:idx+1] != "":
                ans += int(s[before_idx:idx+1])
                before_idx = idx+1
    if int(s[before_idx:]) != "":
        ans += int(s[before_idx:])
print(ans)

Solution (Python):
s = input()

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

Solution (Python):
import copy
s = list(input())
formula_list = []

def insert_(formula, count):
    global formula_list
    if len(formula) == 1:
        formula_list.append(formula)
        return 0
    no = copy.deepcopy(formula)
    yes = copy.deepcopy(formula)
    yes.insert(count, "+")

    count += 1

    if count < len(yes)-1:
        insert_(yes, count+1)
        insert_(no, count)
    else:
        formula_list.append(no)
        formula_list.append(yes)

def sum_list(for_list):
    s = 0
    for i in for_list:
        num = "".join(i)
        num = map(int, num.split("+"))
        s += sum(num)
    return s


insert_(s, 1)
print(sum_list(formula_list))

Solution (Python):
def test():
    s = list(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[j] = "+"
        res = ""
        for n,k in zip(s,op+[""]):
            if len(k) == 1:
                res += n+k
            else:
                res += n + ""
        ans += eval(res)
    print(ans)


if __name__ == "__main__":
    test()

Solution (Python):
s=input()
n=len(s)
a=2**(n-1)
t = [bin(i)[2:] for i in range(a)]
for i in range(a):
    t[i]='0'*(n-1-len(t[i]))+t[i]
    t[i]=t[i][::-1]
ans=0


for i in range(a):
    k=0
    for j  in range(n-1):
        if t[i][j]=="1":
            ans+=int(s[k:j+1])
            
            k=j+1
            
    
    ans+=int(s[k:n])
print(ans)

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

Solution (Python):



def saiki(n,temp,start,ans):
    if n==len(S):
        if start==n:
            ans+=temp
            return ans
        else:
            return ans
    
    ans=saiki(n+1,temp+int(S[start:n+1]),n+1,ans)
    ans=saiki(n+1,temp,start,ans)
    
    return ans


S=input()


print(saiki(0,0,0,0))

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

ans = 0

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

print(ans)

Solution (Python):
import sys
import math

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

    ans += eval(s)

print(ans)

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

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

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

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

Solution (Python):
_='_'
r=lambda f: int(r(f.replace(_,'+',1))+int(r(f.replace(_,'',1)))) if _ in f else eval(f)
print(r(_.join(list(input()))))

Solution (Python):
a="*"
def r(f): return int(r(f.replace(a,"+",1))+int(r(f.replace(a, "", 1)))) if a in f else eval(f)
print(r(a.join(list(input()))))

Solution (Python):
S = input()
K = len(S) - 1
A = 0

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

Solution (Python):
def r(f):
    if "*" in f:
        return int(r(f.replace('*',"+",1))+int(r(f.replace('*','',1))))
    return eval(f)
print(r("*".join(list(input()))))

Solution (Python):
def r(f):
    if not "*" in f:
        return eval(f)
    return int(r(f.replace('*',"+",1)) + int(r(f.replace('*',"",1))))
print(r("*".join(list(input()))))

Solution (Python):
def rec(formula):
    if not "*" in formula:
        return eval(formula)
    return int(rec(formula.replace('*', "+", 1)) + int(rec(formula.replace('*', "", 1))))
print(rec("*".join(list(input()))))

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

import itertools
li = list(itertools.product({0, 1}, repeat=n))
for i in range(len(li)):
    start = 0
    for j in range(n+1):
        if j == n:
            total += int(s[start:n+1])
        elif li[i][j] == 1:
            total += int(s[start:j+1])
            start = j+1

        else:
            pass

print(total)

Solution (Python):
s = input()
n = len(s) - 1  
sum_ = 0
keep = 0
for i in range(2**n):  
    p_or_no = [""] * n
    for j in range(n):
        if ((i >> j) & 1) == 1:
            p_or_no[n-1-j] = "+"

    for k in range(n):
        if p_or_no[k] == "+":
            sum_ += int(s[k]) + keep
            keep = 0
        else:
            keep = int(s[k]) * 10 + keep * 10
        if k == n-1:
            sum_ += int(s[-1]) + keep
            keep = 0
if len(s) == 1:
    sum_ = int(s)
print(sum_)

Solution (Python):
s=input()
n=len(s)
ans=0
for i in range(2**(n-1)):
    binary=bin(i)[2:].zfill(n-1)
    m=[0]+[j+1 for j in range(n-1) if binary[j]=="1"]+[n]
    ans+=sum( int(s[m[j-1]:m[j]]) for j in range(1,len(m)) )
print(ans)

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

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

Solution (Python):
import numpy as np
S = str(input())
S_list =[S]
total = 0

def X(li,X):
	for j in range(len(li)):
		dis = -len(S)+len(li[j])
		li.append(li[j][:X+1+dis]+ '!' + li[j][-len(li[j])+X+1+dis:])

	return li
			
for i in range(len(S)-1):
	S_list = X(S_list,i)
	
for i in range(len(S_list)):
	temp = S_list[i].split('!')
	for j in range(len(temp)):
		total = total + int(temp[j])
		
print(total)

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

for bit in range(2**n):
    s_calc = s
    for i in reversed(range(n)):
        if (1 << i) & bit:
            ls.append(int(s_calc[i+1:]))
            s_calc = s_calc[:i+1]
    if s_calc:
        ls.append(int(s_calc))
print(sum(ls))

Solution (Python):
S = input()
n = len(S)
res = 0
for i in range(1 << (n-1)):
	l = []
	for j in range(n-1):
		if (i >> j) & 1:
			l.append(j+1)	
	l.insert(0,0)
	l.append(n)	
	for i in range(len(l)-1):
		res += int(S[l[i]:l[i+1]])
print(res)

Solution (Python):
s=input()
length=len(s)
ans=0
for i in range(2**(length-1)):
  bi=bin(i)[2:].zfill(length-1) 
  temp=0
  for index,j in enumerate(bi):
    if j=="1":
      ans+=int(s[temp:index+1])
      temp=index+1
  ans+=int(s[temp:]) 
print(ans)

Solution (Python):
s = input()
n = len(s)
res = 0
l = []
for i in range(1 << (n-1)):
    cnt = 1
    l = [0]
    for j in range(n-1):
        if (i >> j) & 1:
            l.append(j+1)
    l.append(n)
    for k in range(len(l) - 1):
        res += int(s[l[k]:l[k+1]])  

print(res)

Solution (Python):
s = str(input())
l = len(s)
ans = 0

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

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

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

print(ans)

Solution (Python):
s=input()
ans=0
def two(x):
	p=bin(x)
	return "0"*(len(s)-len(p)+1)+p[2:]
for i in range(2**(len(s)-1)):
	p=two(i)
	q=s[0]
	k=0
	for j in range(len(s)-1):
		if p[j]=="1":
			q+=s[j+1]
		else:
			k+=int(q)
			q=s[j+1]
	if len(q)>0:
		k+=int(q)
	ans+=k
print(ans)

Solution (Python):
numbers = input()
numbers

def dfs(i, indices):
    total = 0

    if i == len(numbers) - 1:
        indices = [0] + indices + [None]
        for n in range(len(indices) - 1):
            total += int(numbers[indices[n]:indices[n+1]])
        return total

    total += dfs(i+1, indices)
    total += dfs(i+1, indices + [i+1])

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

Solution (Python):
s = input()
n = len(s)
res = 0
l =[]

for i in range(1 << (n-1)):
    cnt = 1
    l = [0]
    for j in range(n-1):
        if (i >> j) & 1:
            l.append(j+1)
    l.append(n)
    for k in range(len(l)-1):
        res += int(s[l[k]:l[k+1]])

print(res)

Solution (Python):
S = input()

def func(num, code):
    total = 0
    start = 0
    length = len(num)

    for i in range(1, length):
        if code & 1 == 1: 
            total = total + int(num[start:i])
            start = i
        code = code >> 1

    total = total + int(num[start:length])

    return total

total_of_all = 0

for i in range(2 ** (len(S) - 1)):
    total_of_all = total_of_all + func(S, i)

print(total_of_all)

Solution (Python):
S = input()
l = len(S)
ans = 0
for i in range(1<<(l-1)):
  l1 = l
  for j in range(l):
    if j ==l-1:
      ans += int(S[0:l1])
    elif (i>>j)&1:
      ans+=int(S[l-j-1:l1])
      l1 =l - j-1
print(ans)

Solution (Python):
S=input()
ls=list(map(int,[S[i] for i in range(len(S))]))
l=len(S)
if l==1:
  print(S)
  exit()
su=0
sl=[]
a=0
for i in range(1<<l-1):
  ls=[]
  j=0
  x=0
  while j<l-1:
    if i&(1<<j):
      ls.append(S[x:j+1])
      x=j+1
    j+=1
    if j==l-1:
      ls.append(S[x:])
  su=sum(map(int,[ls[k] for k in range(len(ls))]))
  a+=su
print(a)

Solution (Python):
import itertools

S = list(input())
A = [0,1]
Comb = list(itertools.product(A, repeat=len(S)-1))

ans = 0
for i in range(len(Comb)):
  tmp = list(Comb[i])
  num1 = []
  num2 = S[0]
  for j in range(len(tmp)):
    if(tmp[j] == 0): num2 += S[j+1]
    else:
      if(num2 != ''): num1.append(int(num2))
      num2 = S[j+1]
  if(num2 != ''): num1.append(int(num2))
  num = sum(num1)
  ans += num
  
print(ans)

Solution (Python):


s = input()

def xxx(residue, l):
    if len(s)==1:
        return [[1]] 
    elif residue==len(s)-1:
        return [l + [residue, len(s)], l + [len(s)]]
    else:
        return xxx(residue+1, l + [residue]) + (xxx(residue+1, l))

flaglist = xxx(1, [])

sum = 0
for value in flaglist:
    for i in range(len(value)):
        if i==0:
            sum += int(s[:value[i]])
        else:
            sum += int(s[value[i-1]:value[i]])

print(sum)

Solution (Python):
def main():
    S = input()
    N = len(S)
    ans = 0
    for bit in range(1<<(N-1)):
        pre = 0
        for i in range(N-1):
            if bit&(1<<i):
                ans += int(S[pre:i+1])
                pre = i + 1
        else:
            ans += int(S[pre:])
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    S = input()
    N = len(S)
    ans = 0
    for bit in range(1<<(N-1)):
        cur = []
        for i in range(N-1):
            if bit&(1<<i):
                cur.append(i)
        else:
            cur.append(N-1)
        pre = 0
        for c in cur:
            num = int(S[pre:c+1])
            ans += num
            pre = c+1
    print(ans)

if __name__ == '__main__':
    main()

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

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

        tmp += s[j+1]

    list_tmp = tmp.split("+")

    for j in list_tmp:
        sum += int(j)

print(sum)

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

Solution (Python):
S=input()
T=len(S)-1
count=0

for i in range(2**T):
  op=['']*T
  for j in range(T):
    if((i>>j)&1):
      op[T-1-j]='+'
        
  formula=''
  for a,b in zip(S,op+['']):
    formula+= (a+b)
  count+= eval(formula)
    
print(count)

Solution (Python):
S = input()
n = len(S)-1
n_list = []
total = 0

for i in range(2**n):
    op = [""] * n
    for j in range(n):
        if((i >> j) & 1):
            op[n-1-j] = "+"
    formula=""
    for x,y in zip(S,op + [""]):
        formula += (x + y)
    total += eval(formula)
print(total)

Solution (Python):
from functools import lru_cache, reduce
import itertools
import math
import sys


sys.setrecursionlimit(10**6)

N = input()

def main():
    a = [list(i) for i in itertools.product(["", "+"], repeat=len(N)-1)]
    [i.append("") for i in a]
    b = list(map(lambda ops: [N[i]+ops[i] for i in range(len(N))], a))
    print(sum(list(map(lambda x: eval("".join(x)), b))))


if __name__ == "__main__":
    main()

Solution (Python):
S = input()
len_S = len(S)-1
ans = 0
for s in range(1<<len_S):
  now = ""  
  now += S[0]  
  for i in range(len_S):    
    if s & (1<<i): 
      now += "+"
    now += S[i+1]    
  ans += eval(now)
print(ans)