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()
s = list(S)
exp = ""
total = 0

for i in range(2**(len(S)-1)):
    a = list(bin(i)[2:])

    a = ["0"] * (len(s) - len(a)-1) + a
    for j in range(len(s)-1):
        if (a[j] == "1"):
            exp += s[j] + "+"
        else:
            exp += s[j]

    exp += s[-1]
    total += sum(map(int, exp.split("+")))
    exp = ""

print(total)

Solution (Python):
class Formula():
    def __init__(self, S):
        self.input = S
        self.sum = 0
        self.input_len = len(S)

        self.input_split_pos = self.input_len - 1
        self.mask = 2**self.input_split_pos - 1

    def calc_sum(self, S: str, split_pos: int) -> int:
        stack = []
        split_pos = [i for i, x in enumerate(
            [int(x) for x in bin(split_pos)[2:].zfill(self.input_split_pos)]) if x == 1]

        start = 0
        if split_pos == []:
            stack.append(int(self.input))
        else:
            for i in split_pos:
                stack.append(int(self.input[start:i + 1]))
                start = i + 1
            stack.append(int(self.input[start:self.input_len]))
        self.sum += sum(stack)
        return self.sum


def main():
    S = input()
    formula = Formula(S)

    bits = 0b0

    while bits <= formula.mask:
        formula.calc_sum(S, bits & formula.mask)
        bits += 1
    print(formula.sum)


main()

Solution (Python):
s = str(input())
s_list = []
for i in range(len(s)):
  s_list.append(s[i])


L = len(s_list)

sum_a = 0
if L == 1:
  print(int(s))
else:
  for k in range(2**(L-1)):
    plus_list = [0]*(L-1)
    p = list(bin(k)[2:])
    for l in range(len(p)):
      plus_list[L-len(p)+l-1] = int(p[l])

    
    
    num_list = []
    start = 0
    for i in range(len(plus_list)):
      if plus_list[i]:
        num_list.append(s_list[start:i+1])
        start = i+1
    num_list.append(s_list[start:])
    ans = 0
    for i in num_list:
      s = ''
      for j in i:
        s = s+j
      ans += int(s)
    sum_a += ans
    
    
  print(sum_a)

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

def sum_s(s):
    return sum(list(map(int,s.split("+"))))

def dfs(i,s,m): 
    
    
    
    ans = 0
    if i==n:
        return sum_s(s)

    ans += dfs(i+1,s,m) 
    ans += dfs(i+1,s[:i+1+m]+"+"+s[i+1+m:],m+1) 

    return ans


print(dfs(0,S,0))

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

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




ans = 0
for p in itertools.product([0, 1], repeat=len(s) - 1):
    div = int(s[0])
    for idx, flg in enumerate(p, 1):
        if flg == 0:
            div *= 10
            div += int(s[idx])
        else:
            ans += div
            div = 0
            div += int(s[idx])
    ans += div
print(ans)

Solution (Python):
S = input()

n = len(S)-1

def calc(s):
    return sum(list(map(int, s.split("+"))))

def dfs(i, S, k):
    ans = 0
    if i==n:
        return calc(S)

    ans += dfs(i+1, S, k)
    ans += dfs(i+1, S[:i+1+k] + "+" + S[i+1+k:], k+1)

    return ans

if n==0:
    print(S)
else:
    print(dfs(0, S, 0))

Solution (Python):
S = input()

def F(S):
  yield int(S)
  for i in range(len(S) - 1):
    left = S[: i + 1]
    right = S[i + 1 :]
    x = int(left)
    for y in F(right):
      yield x + y
print(sum(F(S)))

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

ans = 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_n, p_o in zip(S, op + [""]):
        if p_o == "+":
            formula += (p_n + p_o)
        else:
            formula += p_n
    ans += eval(formula)

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
s = input().strip()
ans = 0
n = len(s)-1

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

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
s = input().strip()
n = len(s)
ans = 0
for i in range(1<<(n-1)):
    t = ''
    for j in range(n-1):
        t += s[j]
        if (i >> j) & 1:
            t += '+'
    else:
        t += s[n-1]
    ans += eval(t)
print(ans)

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

for bit in range(1 << n):
    eval_str = ''
    eval_str += s[0]
    for i in range(n):
        if bit & (1 << i):
            eval_str += '+'
        eval_str += s[i + 1]
    sum += eval(eval_str)

print(sum)

Solution (Python):
*s, = map(str, input())

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

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

    a[i] = ""
    rec(i+1, a)
    a[i] = "+"
    rec(i+1, a)

rec(0, a)
print(ans)

Solution (Python):
S = [int(s) for s in list(input())]
n = len(S)
ans = 0
for bit in range(1 << (n-1)):
    total = 0
    tmp = S[0]
    for i in range(n-1):
        if (bit >> i) & 1:
            total += tmp
            tmp = S[i+1]
        else:
            tmp = tmp*10 + S[i+1]
    total += tmp
    ans += total
print(ans)

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

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


count = 0
for i in range(pow(2,n-1)):
    k = 0
    buf = 0
    for j in range(n):
        if((i & (1<<j))):
            buf +=pow(10,k)*int(s[n-1-j])
            
            count += buf
            buf = 0
            k = 0
        else:
            buf +=pow(10,k)*int(s[n-1-j])
            k += 1
    count += buf
print(count)

Solution (Python):



s = int(input())
x = [ int(i) for i in list(str(s)) ]
length = len(x)

ans = 0
for bit in range(1<<(length-1)):
    cur = int(x[0])
    for i in range(length-1):
        
        if (bit>>i)&1:
            ans += cur
            cur = int(x[i+1])
        
        else:
            cur *= 10
            cur += int(x[i+1])
    ans += cur

print(ans)

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

Solution (Python):
from itertools import product 
S = input()
N = len(S)

cand = ["","+"]

ans = 0
for i in product(cand,repeat=(N-1)):
    i = list(i)
    i.append("")
    e = "".join([a+b for a,b in zip(S,i)])
    ans += eval(e)
print(ans)

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

total_result = 0
for bit in range(1<<plus_number):
  buffer = s[0]
  for i in range(plus_number):
    if bit & (1 << i):
      
      buffer += "+"
    buffer += s[i+1]
  total_result += sum(map(int, buffer.split('+')))
print(total_result)

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

for i in range(2**(len(s)-1)):
    x = s[0]

    for j in range(len(s)-1):
        if (i>>j) & 1:
            x += '+'
        x += s[j+1]
        
    ans += sum(map(int,x.split('+')))
print(ans)

Solution (Python):

import itertools

S = input()

ans = 0

ans += int(S)

for i in range(1, len(S)):
    for j in itertools.combinations(range(1,len(S)),i):
        aa = 0
        for k in j:
            ans += int(S[aa:k])
            aa = k
        ans += int(S[aa:len(S)])
print(ans)

Solution (Python):

import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache
import heapq

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3,d + 1,2):
            if n % i == 0:
                return False
        return True


MOD = int(1e09) + 7

def main():
    S = cin.string()
    ans = 0
    N = len(S) - 1
    for i in range(1 << N):
        t = ["."] * N
        for j in range(N):
            if i >> j & 1:
                t[j] = "+"
        tmp = int(S[0])
        for j in range(N):
            if t[j] == "+":
                ans += tmp
                tmp = int(S[j + 1])
            else:
                tmp *= 10
                tmp += int(S[j + 1])
        ans += tmp
    print(ans)
    return

if __name__ == "__main__":
    main()

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

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

if l == 1:
    print(S)
else:
    patterns = []
    for i in range(2 ** (l-1)):
        b = format(i, 'b').zfill(l-1)
        patterns.append(b)

    ans = 0
    for pi in patterns:
        s = S[0]
        for i, bi in enumerate(pi):
            if bi == '1':
                s += '+'
            s += S[i+1]
        v = eval(s)
        ans += v
    print(ans)

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

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

ans = 0

for i in range(2 ** (n-1)):

    formula = ''
    formula += a[0]

    for j in range(n-1):

        if (i >> j) & 1:
            formula += '+'

        formula += a[j+1]
    
    ans += sum(map(int, formula.split('+')))

print(ans)

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

s=0
for i in range(2**l):
    t=format(i,"b")
    t=t.zfill(l)
    k=S[0]
    for j in range(l):
        if(t[j]=="0"):
            k=k+S[j+1]
        else:
            s+=int(k)
            k=S[j+1]
    s+=int(k)
 
print(s)

Solution (Python):
s = input()
len_s = len(s)
total_sum = 0
for i in range(2 ** (len_s - 1)):
    sum_array = []
    prev_place = 0
    for j in range(len_s - 1):
        if (i >> j) & 1:
            sum_array.append(int(s[prev_place:j+1]))
            prev_place = j+1
    if prev_place != len_s:
        sum_array.append(int(s[prev_place:len_s]))
    total_sum += sum(sum_array)
print(total_sum)

Solution (Python):
def generate_permutations(trunk, size, current=[]):
    if len(current) == size:
        trunk.append(current)
        return

    generate_permutations(trunk, size, current + [True])
    generate_permutations(trunk, size, current + [False])


S = input()
perms = []
generate_permutations(perms, len(S) - 1)
ANS = 0
for perm in perms:
    A = [int(c) for c in S]
    ans = 0
    tmp = A.pop(0)
    for i in range(len(A)):
        if perm[i]:
            ans += tmp
            tmp = A[i]
        else:
            tmp *= 10
            tmp += A[i]
    else:
        ans += tmp
    ANS += ans
print(ANS)

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

ans = 0

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

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

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

print(ans)

Solution (Python):
s = input()
n = len(s) - 1
answers = []
sl = [s[i] for i in range(len(s))]
for i in range(2 ** n):
    tmp = []
    for j in range(n):
        if ((i >> j) & 1):
            tmp.append(j)
    ll = ['*']*len(s)
    for k in tmp:
        ll[k] = '+'
    ans = []
    for k, _ in zip(sl, ll):
        ans.append(k)
        ans.append(_)
    ans = [_ for _ in ans if _ != '*']
    ans = ''.join(ans)
    ans = ans.split('+')
    ans = [int(_) for _ in ans if _ != '+']
    ans = sum(ans)
    answers.append(ans)
print(sum(answers))

Solution (Python):
class Number:
    value = ''
    plus = False
    
    def __init__(self, value, plus = False):
      self.value = value
      self.plus = plus

    def __str__(self) -> str:
        return '+' + str(self.value) if self.plus else str(self.value)


count = 0


def solve(numbers, k):
    global count
    if k >= len(numbers):
        x = ''.join([str(n) for n in numbers])
        count += sum(int(x) for x in x.split('+'))
        return

    b = []

    for i, n in enumerate(numbers):
        if i == k:
            b.append(Number(n.value, True))
        else:
            b.append(n)

    solve(numbers, k + 1)
    solve(b, k + 1)


s = input()

numbers = [Number(x) for x in s]

solve(numbers, 1)

print(count)

Solution (Python):
def solution(x,N,ans):
  return ans + int(N) if x == len(N)-1 else solution(x+1,N,ans) + solution(0,N[x+1:],ans+int(N[:x+1]))
 
print(solution(0,input(),0))

Solution (Python):
def solution(x,N,ans):
  if x == len(N)-1:
    return ans + int(N)
  res=solution(x+1,N,ans) + solution(0,N[x+1:],ans+int(N[:x+1]))
  return res

print(solution(0,input(),0))

Solution (Python):
s=input()
n=len(s)-1
l=[]
for i in range(n):
    l.append("+")
sum = 0

if len(s) < 2:
    sum = s

else:
    for i in range(2 ** n):
        plus = []
        tmp = ""
        ans = 0
        for j in range(n):
            if ((i>>j) & 1):
                plus.append(l[j])
            else:
                plus.append("")
        for i in range(n):
            tmp += s[i]+plus[i]
            if i == n-1:
                tmp+=s[i+1]
        tmp2 = tmp.split("+")
        for i in range(len(tmp2)):
            ans += int(tmp2[i])
        sum+=ans

print(sum)

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

S = readline().rstrip().decode('utf_8')

def F(S):
	yield int(S)
	for i in range(len(S)-1):
		left = S[:i+1]
		right = S[i+1:]
		x = int(left)
		for y in F(right):
			yield x+y

print(sum(F(S)))

Solution (Python):
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

S = input()
N = len(S)-1
ans = 0
for n in range(2**N):
	b = Base_10_to_n(n,2).rjust(N,'0')
	tmp = []
	ind = 0
	for i in range(N):
		if b[i] == '1':
			tmp.append(int(S[ind:i+1]))
			ind = i+1
	tmp.append(int(S[ind:]))
	ans += sum(tmp)

print(ans)

Solution (Python):
s = input()
N = 1<<(len(s)-1)
c = 0
for one in range(N):
    tmp = ''
    for i in range(len(s)-1):
        tmp+=s[i]
        if one>>i & 1==1:
            tmp+='+'
    tmp+=s[len(s)-1]
    c+=sum([int(o) for o in tmp.split('+')])
print(c)

Solution (Python):
from itertools import product
s=input()
n=len(s)
ans=0
for p in product(['+',''],repeat=n-1):
    r=''
    for u,t in zip(s,p):
        r+=u+t
    r+=s[-1]
    ans+=eval(r)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input()[:-1]  
n = len(S) - 1  


P = []
for bit in range(0, 1<<n):  
    plus = [""] * n
    for j in range(n):
        if bit>>j & 1:
            plus[j] = "+"
    P.append(plus)



ans = 0
if n == 0:
    print(int(S))
else:
    for plus in P:
        nums = []
        tmp = S
        pre = 0
        for i in range(n):
            if plus[i] == "+":
                nums.append(int(tmp[pre:i+1]))
                pre = i+1
            if i == n-1:
                nums.append(int(tmp[pre:]))
        ans += sum(nums)
    print(ans)

Solution (Python):

import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S = read().rstrip().decode('utf-8')

def F(S):
    for i in range(2 ** (len(S) - 1)):
        operator_list = format(i, 'b').zfill(len(S)) 
        sum_ = 0
        num = 0
        for j, operator in zip(S, operator_list):
            if operator == "0":
                num = num * 10 + int(j)
            else:
                sum_ += num
                num = int(j)
        sum_ += num

        yield sum_

ans = sum(F(S))
print(ans)

Solution (Python):

import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S = read().rstrip().decode('utf-8')

def F(S):
    total = 0
    for i in range(2 ** (len(S) - 1)):
        operator_list = format(i, 'b').zfill(len(S)) 
        sum_ = 0
        num = 0
        for j, operator in zip(S, operator_list):
            if operator == "0":
                num = num * 10 + int(j)
            else:
                sum_ += num
                num = int(j)
        sum_ += num

        total += sum_
    return total

ans = F(S)
print(ans)

Solution (Python):
S = input()

n=len(S)
sm=0

for i in range(2**(n-1)):
    tmp = [False]*(n-1)

    for j in range(n-1):
        if i >> j &1:
            tmp[j]=True

    result_list = []
    for s_n in range(len(S)):
        result_list.append(S[s_n])
        if s_n < len(tmp) and tmp[s_n]:
            result_list.append("+")

    res=""
    for x in result_list:
        res+=x
    sm+=eval(res)

print(sm)

Solution (Python):
import itertools
S = input()
L = [i for i in range(2*len(S)-1)]
i = 0
res = []
for j in range(len(L)):
    if j%2 == 0:
        L[j] = S[j//2]
    else:
        L[j] = ''
res.append(L)
def procedure(L,i,res):
    
    
    
    Search_base = list(itertools.combinations([i for i in range(len(L)-1) if i%2 !=0], i))
    
    temp = []
    for element in L:
        temp.append(element)
    for j in range(len(Search_base)):
        for number in Search_base[j]:
            
            temp[number] = '+'
        res.append(temp)
        
        temp = [element for element in L]
        
    return res
Formulas = [procedure(L,i,[]) for i in range(len(S))]






for liste in Formulas: 
    
    for sous_liste in liste:
        while '' in sous_liste:
            sous_liste.remove('')

res = 0
composant = ''
Found = []
for liste in Formulas:
    for sous_liste in liste:
        for i in range(len(sous_liste)):
            if sous_liste[i] != '+':
                composant += sous_liste[i] 
            elif sous_liste[i] == '+':
                res += int(composant)
                composant = '' 
        if composant != '':
            Found.append(res+int(composant)) 
        else:
            Found.append(res)
        composant = ''
        res = 0
for element in Found:
    res += element
print(res)

Solution (Python):
def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    
    
    return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[depth], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

Solution (Python):
def calc(s):
    yield int(s)
    for i in range(1, len(s)):
        a = int(s[:i])
        for b in calc(s[i:]):
            yield a + b
S = input()
result = sum(calc(S))
print(result)

Solution (Python):
s = input()
result_sum = 0 
plus_count = len(s) - 1 

for bit in range(1 << plus_count): 
  splitted_string = s[0] 
  for iter_plus in range(plus_count):
    if bit & (1 << iter_plus): 
      splitted_string += '+'
    splitted_string += s[iter_plus+1] 
    
  
  splitted_integer = [int(x) for x in splitted_string.split('+')]
  result_sum += sum(splitted_integer)
print(result_sum)

Solution (Python):
s = input()
result_sum = 0
plus_count = len(s) - 1

for bit in range(1 << plus_count):
  splitted_string = s[0]
  for iter_plus in range(plus_count):
    if bit & (1 << iter_plus):
      splitted_string += '+'
    splitted_string += s[iter_plus+1]
  result_sum += eval(splitted_string)

print(result_sum)

Solution (Python):
s = input()
max_plus = len(s)-1
plus = [reversed(bin(i)[2:]) for i in range(2**max_plus)]
value_sum = 0
for i in plus:
    value = 0
    prov_s = s
    end_plus = 0
    for index, j in enumerate(i):
        if j == "1":
            cut_index = (1+index)*(-1)+end_plus
            value += int(prov_s[cut_index:])
            prov_s = prov_s[0:cut_index]
            end_plus += -1 * cut_index
    value_sum += value + int(prov_s)
print(value_sum)

Solution (Python):
s = input()
max_plus = len(s)-1
plus = [reversed(bin(i)[2:]) for i in range(2**max_plus)]
value_sum = 0
for i in plus:
    value = 0
    prov_s = s
    end_plus = 0
    for index, j in enumerate(i):
        if j == "1":
            cut_index = (1+index)*(-1)+end_plus
            value += int(prov_s[cut_index:])
            prov_s = prov_s[0:cut_index]
            end_plus += -1 * cut_index
    value_sum += value + int(prov_s)
print(value_sum)

Solution (Python):
s = input()
max_plus = len(s)-1
plus = [reversed(bin(i)[2:]) for i in range(2**max_plus)]
value_sum = 0

for i in plus:
    value = 0
    prov_s = s
    end_plus = 0
    for index, j in enumerate(i):
        if j == "1":
            cut_index = (1+index)*(-1)+end_plus
            value += int(prov_s[cut_index:])
            prov_s = prov_s[0:cut_index]
            end_plus += -1 * cut_index
    value_sum += value + (int(prov_s) if prov_s else 0)
print(value_sum)

Solution (Python):
s = 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[j] = "+"
    formula = ""
    for p_n, p_o in zip(s, op + [""]):  
        formula += (p_n + p_o)
    ans += eval(formula)
print(ans)

Solution (Python):































S = str(input())
N = len(S) - 1
 
res = 0
 
for i in range(1<<N):
    t = ''
    for j in range(N):
        t += S[j]
        if((i>>j&1) > 0): t += '+'
    t += S[-1]
    res += eval(t)
print(res)

Solution (Python):
s = input()
n=len(s)
ans=0
for i in range(2**(n-1)):
    bit=i
    a = []
    for k in range(n-1):
        a.append(bit % 2)
        bit //= 2
    t = ""
    for j in range(n-1):
        t += s[j]
        if (a[j]):
            t += "+"
    t+=s[-1]
    
    ans += eval(t)
print(ans)

Solution (Python):
N = input()
n=len(N)-1
S = [0 for _ in range(n)]
combi = []

def makeCombination():
    rec(0)
    
def rec(i):
    if i == n:
        combi.append(S[:])
        return
    rec(i + 1)
    S[i] = 1
    rec(i + 1)
    S[i] = 0
    
makeCombination()

sum_N = 0
for l in combi:
    pre = 0
    for i in range(n):
        if l[i] == 1:
            sum_N += int(N[pre:i+1])
            pre = i+1
    
    sum_N += int(N[pre:])

print(sum_N)

Solution (Python):
s = input()
l = len(s)
ans = 0
for i in range(2**(l-1)):
    formula = s[0]
    for j in range(l-1):
        if (i >> j) & 1: formula += '+'
        formula += s[j+1]
    ans += sum(map(int, formula.split('+')))
print(ans)

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

ans = 0

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

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

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

print(ans)

Solution (Python):
from itertools import product
s = input()
ans = 0

for op in product(["", "+"], repeat=len(s)-1):
    
    op = list(op)
    op.append("")
    
    ans += eval(''.join( a + b for a, b in zip(s, op)))
print(ans)

Solution (Python):

from itertools import combinations

s = input()
n = len(s)

def gen():
    l = []
    for i in range(n):
        l.append(s[i])
        l.append("")
    return l

res = 0
for r in range(n):
    for p in combinations(range(n-1),r):
        e = gen()
        for i in p:
            e[2*i+1] = "+"
        res += eval("".join(e))

print(res)

Solution (Python):
S = list(input())
def dfs(S, i, bind, ans): 
  if i == len(S):
    return ans + int(bind)
  return dfs(S, i + 1, S[i], int(bind) + ans) + dfs(S, i + 1, bind + S[i], ans)
print(dfs(S, 1, S[0], 0))

Solution (Python):
from itertools import product
 
S = input()
n = len(S)
 
ans = 0
for P in product(["+",""],repeat=n-1):
    res = ""
    for s,p in zip(S,P):
        res += s+p
    res += S[-1]
    ans += eval(res)
print(ans)

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

for i in range(2 ** n):
    tmp = s[:]
    for j in range(n):
        if (i >> j) & 1:
            tmp[j] += '+'
    sum += eval(''.join(tmp))

print(sum)

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

for i in range(2 ** n):
    op = [''] * n
    for j in range(n):
        if (i >> j) & 1:
            op[j] = '+'
    t = ""
    for st, nOp in zip(s, op + ['']):
        t += (st + nOp)
    sum += eval(t)

print(sum)

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


for bit in range(2 ** N):
    k = 0
    for j in range(N):
        if (bit >> j) & 1:
            ans += int(S[k:j + 1])
            k = j + 1
    ans += int(S[k:])
print(ans)

Solution (Python):
import itertools
s = input()
n = len(s) -1
result = 0
comb = list(itertools.product(["+", ""], repeat = n))
for b in comb:
    temp = ""
    for i in range(n):
        temp += s[i] + b[i]
    temp += s[-1]
    result += eval(temp)

print(result)

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

ans = 0
for i in range(2**(n-1)):
    
    add_place = [""] * n
    for j in range(n-1):
        
        if ((i>>j)&1):
            add_place[j] = "+"
        
    fomula = ""
    for num, add in zip(s,add_place):
        fomula += num + add
    
    ans += eval(fomula)
print(ans)

Solution (Python):
from itertools import product
s=input()
n=len(s)-1
ans=0
for b in list(product(['+',''],repeat=n)):
    a=s[0]
    for i in range(n):
        a=a+b[i]+s[i+1]
    ans+=eval(a)
print(ans)

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


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

    return dfs(i+1, f+S[i+1]) + dfs(i+1, f+'+'+S[i+1])

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

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

dp = [None] * (N + 1)
dp[0] = (0, 1)
for i in range(1, N + 1):
    summation = 0
    cnt = 0
    for j in range(i):
        summation += int(S[j:i]) * dp[j][1] + dp[j][0]
        cnt += dp[j][1]
    dp[i] = (summation, cnt)

print(dp[N][0])

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

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

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

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

    ans = 0

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

        fomula = ""
        for num, op in zip(S, ops):
            fomula += num + op

        ans += eval(fomula)

    print(ans)


if __name__ == "__main__":
    main()

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

    ans = 0

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

        fomula = ""
        for k in range(n + 1):
            fomula += S[k] + ops[k]

        ans += eval(fomula)

    print(ans)


if __name__ == "__main__":
    main()

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

def dfs(i, f):
    
    
    if i == n-1: 
        l = list(map(int, f.split('+')))
        return sum(l)

    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())
F = [0] * (len(S)-1)

ans = 0
def rec(i):
    global ans
    if i == len(F):
        string = S[0]
        tmp = []
        for i in range(len(F)):
            if F[i] == 0:
                string += S[i+1]
            else:
                tmp.append(string)
                string = S[i+1]
        
            if i == len(F) - 1:
                tmp.append(string)
        
        tmp = list(map(int, tmp))
        ans = ans + sum(tmp)
        return
        
    rec(i+1)
    F[i] = 1
    rec(i+1)
    F[i] = 0

if len(S) == 1:
    print(S[0])
else:
    rec(0)
    print(ans)

Solution (Python):
S = input()
def ans(i, formu):
    if i==len(S)-1:
        return sum(list(map(int,formu.split('+'))))
    return ans(i+1, formu+S[i+1]) + ans(i+1, formu+'+'+S[i+1])
print(ans(0,S[0]))

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

l=list(itertools.product(['+',''], repeat=len(S)-1))
str=[]
for i in l:
    str.append(''.join([z for sublist in [[x, y] for x, y in zip(S,i)] for z in sublist]))

for i in range(len(str)):
    str[i]+=S[-1]
summary=0
for i in str:
    summary+=eval(i)

print(summary)

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

Solution (Python):
def relu(num):
    if num < 0: num = 0
    return num

S = str(input())
S_len = len(S)
ans = 0
for i in range(S_len):
    for j in range(i, S_len):
        part_num = int(S[i:j+1])
        ans += part_num * 2 ** relu(i-1) * 2 ** relu(S_len - j - 2)
print(ans)

Solution (Python):
from operator import mul
from functools import reduce


def comb(n, r):
    r = min(r, n-r)
    if r == 0:
        return 1
    return reduce(mul, range(n, n-r, -1))//reduce(mul, range(1, r+1))


S = input()
ans = 0
for i in range(len(S)):
    for j in range(i, len(S)):
        s = 0
        s2 = 0
        for k in range(i):
            s += comb(i-1, k)
        for k in range(len(S)-j-1):
            s2 += comb(len(S)-j-2, k)
        ans += int(S[i:j+1])*max(s, 1)*max(s2, 1)
print(ans)

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

if len(s) == 1:
    ans = s
else:
    for i in range(n):
        t = ""
        a = str(bin(i))[2:].zfill(len(s)-1)
        for j in range(len(a)):
            if a[j] == "1":
                t += s[j] + "+"
            else:
                t += s[j]
        t += s[-1]
        ans += eval(t)
print(ans)