Problem:
 Score : 300 points    Problem Statement You are given a string S consisting of digits between 1 and 9 , inclusive.
You can insert the letter + into some of the positions (possibly none) between two letters in this string.
Here, + must not occur consecutively after insertion.  All strings that can be obtained in this way can be evaluated as formulas.  Evaluate all possible formulas, and print the sum of the results.      Constraints  1 \leq |S| \leq 10  All letters in S are digits between 1 and 9 , inclusive.         Input The input is given from Standard Input in the following format:  S       Output Print the sum of the evaluated value over all possible formulas.        Sample Input 1 125      Sample Output 1 176  There are 4 formulas that can be obtained: 125 , 1+25 , 12+5 and 1+2+5 . When each formula is evaluated,   125  1+25=26  12+5=17  1+2+5=8   Thus, the sum is 125+26+17+8=176 .       Sample Input 2 9999999999      Sample Output 2 12656242944

Solution (Python):
s = input()
n = len(s)-1
N = []
total = 0
for i in range(2**n):
  nums = ""
  for j in range(n+1):
    nums+=s[j]
    if ((i>>j)&1):
      nums+="+"
  nums = nums.split("+")
  
  N.append([int(i) for i in nums])

for _ in N:
  total +=sum(_)
  
print(total)

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

def dfs(i, s, ans):
    if i==n:
        
        ans += sum([int(i) for i in s.split('+')])
        return False, ans
    else:
        
        tf, ans = dfs(i+1, s, ans)
        if tf:
            return True, ans
        else:
            
            p = i + s.count('+')
            s = s[:p]+'+'+s[p:]
            tf, ans = dfs(i+1,  s, ans)
            return tf, ans

_, a = dfs(i, s, ans)
print(a)

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

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

  
  return dfs(i+1, t+s[i+1]) + dfs(i+1, t + '+' + s[i+1])


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

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

for i in range(2**n):
    tmp=0
    for j in range(n):
        if ((i << j) & 2**(n-1)):  
            tot+=int(s[tmp:j+1])
            tmp=j+1
        if j==n-1:
            tot+=int(s[tmp:])
if n==0:
    tot=int(s)
print(tot)

Solution (Python):
s=input()
n=len(s)-1
sum=0
List=[s[0]]
for i in range(2**n):
    for j in range(n):
        if (i>>j)&1:
            List+=["+"]+[s[j+1]]
        else:
            List+=[s[j+1]]
    m=0
    for h in List:
        if h=="+":
            sum+=m
            m=0
        else:
            m*=10
            m+=int(h)
    sum+=m
    List=[s[0]]
print(sum)

Solution (Python):
S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if (i >> j) & 1:
            s += int(''.join(S[t:j+1]))
            t = j+1
    s += int(''.join(S[t:]))
print(s)

Solution (Python):
S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if i & (1 << j):
            s += int(''.join(S[t:j+1]))
            t = j+1
    s += int(''.join(S[t:]))
print(s)

Solution (Python):
S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if ((i >> j) & 1 == 1):
            s += int(''.join(S[t:j+1]))
            t = j+1
    s += int(''.join(S[t:]))
print(s)

Solution (Python):
s = [int(i) for i in input()]
n = len(s) - 1
ans = 0
def cnt(bit):
  plus = [False]*n + [True]
  i = n-1
  while bit > 0:
    if bit&1:
      plus[i] = True
    bit = bit >> 1
    i -= 1
  ret = 0
  tmp = 0
  for i in range(n+1):
    tmp = tmp*10+s[i]
    if plus[i]:
      ret += tmp
      tmp = 0
  return ret
for i in range(2**n):
  ans += cnt(i)
print(ans)

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

Solution (Python):
from sys import stdin
from math import factorial


def make_bit_line(N):
    output=[]
    for i in range(0, 2**N):
        temp_list = []
        bin_num = bin(i)[2:]
        for k in range(N-len(bin_num)):
            temp_list.append(0)
        for i in range(len(bin_num)):
            temp_list.append(int(bin_num[i]))

        output.append(temp_list)
    return output

def calc_val(S,bianry):
    total_num = 0
    last_pos = 0
    for i in range(len(binary)):
        if(binary[i]==1):
            total_num += int(S[last_pos:i+1])
            last_pos = i+1
    total_num+=int(S[last_pos:])
    return total_num




S = str(stdin.readline().rstrip())

N = len(S)

total_sum = 0
bit_line = make_bit_line(N-1)

for binary in bit_line:
    total_sum += calc_val(S, binary)

print(total_sum)

Solution (Python):
from sys import stdin
from math import factorial


def make_combinations(N, K):
    output=[]
    while(True):
        length = len(output)
        if length==0:
            output.append([i+1 for i in range(K)])
        else:
            previous = output[length-1].copy()
            for i in range(K):
                if previous[K-i-1]!=N-1-i:
                    newone = previous
                    newone[K-i-1] = previous[K-i-1]+1
                    for j in range(i):
                        newone[K-i-1+j+1] = newone[K-i-1+j]+1
                    output.append(newone)
                    break
                else:
                    continue
            if len(output) == length:
                break

    return output

def calc_sum(S, combinations):
    total_sum=0
    for combi in combinations:
        for i in range(len(combi)):
            if i==0:
                total_sum += int(S[:combi[i]])
            else:
                total_sum += int(S[combi[i-1]:combi[i]])
        total_sum += int(S[combi[len(combi)-1]:])
    return total_sum




S = str(stdin.readline().rstrip())

length = len(S)
total_number = int(S)


for i in range(length): 
    if i==0: continue
    combinations = make_combinations(length,i)
    total_number += calc_sum(S, combinations)


print(total_number)

Solution (Python):
s = input()
n = len(s)
cnt= 0
for i in range(2**(n-1)):
    done = 0
    for j in range(n-1):
        if bin(i)[2:].zfill(n-1)[j] == '1':
            cnt += int(s[done:j+1])
            done = j+1
    cnt += int(s[done:n])
print(cnt)

Solution (Python):
s = input()
ans = []
l = len(s)

def rec(tmp, n):
    if n == l-1:
        ans.append(eval(tmp))
        return
    rec(tmp + "+" + s[n+1], n+1)
    rec(tmp + s[n+1], n+1)

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

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

Solution (Python):
def dfs(i,val):
    global s,n,sum
    val+=s[i-1]
    if i==n:
        sum+=eval(val)
        return
    dfs(i+1,val+"+")
    dfs(i+1,val)
s=input()
n=len(s)
val = ""
sum=0
dfs(1,val)
print(sum)

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

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

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

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

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

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

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

def pm(i,j,k):
  global ans
  if i == n-1:
    k += int(s[j+1:])
    ans += k
  else:
    pm(i+1,i,k+int(s[j+1:i+1]))
    pm(i+1,j,k)
pm(0,-1,0)
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    S = input().rstrip("\r\n")
    ans = 0
    for i in range(2**(len(S)-1)):
        nums = []
        num_str = S[0]
        for j in range(len(S)-1):
            if (i >> j) & 1:
                nums.append(int(num_str))
                num_str = S[j+1]
            else:
                num_str += S[j+1]
        if num_str != "":nums.append(int(num_str))
        ans += sum(nums)
    print(ans)
if __name__ == "__main__":
    main()

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

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

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

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

Solution (Python):
S=[]
ans=0
l=0

def bc(i,las,sum):
    global ans
    if i==l:
        ans+=int(S[las:])+sum
        return False
    if bc(i+1,las,sum):
        return True
    if bc(i+1,i+1,sum+int(S[las:i+1])):
        return True
    return False

S=input()
l=len(S)-1
bc(0,0,0)
print(ans)

Solution (Python):


int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def calc(s, bag):
    for i, idx in enumerate(bag):
        s.insert(idx+i+1, '+')

    
    
    c = 0
    for n in ''.join(s).split('+'):
        if n == '+':
            continue
        c = c + int(n)
    return c


def solve():
    s = list(input())
    n = len(s) - 1
    
    
    ans = 0
    for i in range(pow(2, n)):
        bag = []
        for j in range(n):
            if (i >> j) & 1:
                bag.append(j)
        
        ans = ans + calc(s.copy(), bag)
    print(ans)


if __name__ == '__main__':
    solve()

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

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

print(ans)

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

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

print(ans)

Solution (Python):

s = input()

n = len(s) - 1
wa = []

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

print(sum(wa))

Solution (Python):
n = input()

def bitlist(n, a, b):
  res = []
  for i in range(2**n):
    pattern = []
    for j in range(n):
      if (i >> j) & 1:
        pattern.insert(0, a)
      else:
        pattern.insert(0, b)
    res.append(pattern)
  return res

m = len(n)
lst = bitlist(m-1, "+", "")
SUM = 0
for i in range(2**(m-1)):
  calc = ""
  for j in range(m-1):
    calc += n[j] + lst[i][j]
  calc += n[-1]
  spl = calc.split('+')
  for c in spl:
    SUM += int(c)
print(SUM)

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

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

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
S=input()
n=len(S)
total=0
for i in range(2**(n-1)):
  t=0
  for j in range(n):
    t*=10
    t+=int(S[j])
    if ((i>>j)&1):
      total+=t
      t=0
  total+=t
  
print(total)

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

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

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

Solution (Python):
s = input()


ans = 0
t = []
for bit in range(1<<(len(s))):
  for i in range(len(s)):
    if bit & 1<<i and bit & 1<<(len(s)-1):
      t.append([bin(bit)[3:]])
      

p = [p[0] for p in set(map(tuple,t))]
for q in p:
  t = ''
  for i in range(len(q)):
    if q[i] == '1':
      t += s[i] + '+'
    else:
      t += s[i]
  t += s[-1]
  ans += sum(list(map(int,t.split('+'))))
  
print(ans)

Solution (Python):
n = input()
total=0
op_cnt = len(n) - 1 
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(n, op + [""]):  
        formula += (p_n + p_o)
    
    total+=eval(formula)
print(total)

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

for i in range(2 ** (ls-1)):
    susiki = ""
    shiki = []  
    for j in range(ls-1):
        if (i >> j) & 1:
            shiki.append("+")
        else:
            shiki.append("")
    
    for k in range(ls):
        if k == ls - 1:
            susiki = susiki + S[k]
        else:
            susiki = susiki + S[k] + shiki[k]
    ans += eval(susiki)

print(ans)

Solution (Python):
S = list(input())
ans = []
def f(i,tmp,carry):
  s = int(S[i])
  if i == len(S)-1:
    ans.append(tmp+carry+s)
  else:
    
    f(i+1,tmp+carry+s,0)
    
    f(i+1,tmp,(carry+s)*10)
f(0,0,0)
print(sum(ans))

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

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

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

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

Solution (Python):

def resolve():
	s = input()
	k = 0
	for i in range(1 << len(s) - 1):
		ts = s
		seq = 1
		for j in range(len(s) - 1):
			if (i >> j) & 1:
				k += int(ts[:seq])
				ts = ts[seq:]
				seq = 1
			else:
				seq += 1
		k += int(ts or 0)
	print(k)
resolve()

Solution (Python):
S=input()
ans=0
if len(S)==1:
    print(S)
else:
    for i in range(2**(len(S)-1)):
        done=0
        b=bin(i)[2:].zfill(len(S)-1)
        for j in range(len(S)-1):
            if b[j]=="1":
                ans+=int(S[done:j+1])
                done=j+1
        ans+=int(S[done:])
    print(ans)

Solution (Python):
def resolve():
	s = input()
	k = 0
	for i in range(1 << len(s)-1):
		ts = s
		a = 1
		for j in range(len(s)):
			if ((i >> j) & 1):
				k += int(ts[:a] or 0)
				ts = ts[a:]
				a = 1
			else:
				a += 1
		k += int(ts or 0)
	print(k)

resolve()

Solution (Python):
import itertools

s = str(input())
length = len(s)

bins = []
for i in range(2**(length-1)):
    bins.append(list(str(format(i,'b')).zfill(length-1)))

ans = 0
for i in range(2**(length-1)):
    tmp_str=s[0]
    for j in range(length-1):
        if(bins[i][j]=='0'):
            tmp_str += s[j+1]
        else:
            ans += int(tmp_str)
            tmp_str = s[j+1]
    ans+=int(tmp_str)
print(ans)

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

if N == 1:
    print(S)
    exit()

ans = 0
for i in range(2 ** (N - 1)):
    signs = bin(i)[2:].zfill(N - 1).replace('0', '+').replace('1', ' ')

    tmp_s = S[0]
    for j, sign in enumerate(signs):
        tmp_s += sign + S[j + 1]

    ans += eval(tmp_s.replace(' ', ''))

print(ans)

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


def test(array: list, index: int, calc: str, result: list):
    
    
    
    if index == len(array) - 1:
        
        result[0] += sum(calc + array[index])
        return
    test(array, index + 1, calc + array[index], result)
    test(array, index + 1, calc + array[index] + "+", result)


def sum(calc: str):
    nums = [int(item) for item in calc.split("+")]
    return reduce(add, nums)


array = list(input())
result = [0]
test(array, 0, "", result)
print(result[0])

Solution (Python):
S=int(input())
S_=list(map(str,str(S))) 
l=len(str(S))-1 
l_=len(S_)-1 
n=list(range(1,l_,2)) 

ans_2=[]
ans_3=[]
for i in range(2**l):
    listA=[]
    listB=[None]*(l+1) 
    for j in range(l):
        if ((i>>j)&1):
            listB[j]='+'
    ans_1=[]
    for o,p in zip(S_,listB):
        ans_1.append(o)
        ans_1.append(p)
    ans_2=[f for f in ans_1 if not f==None]
    ans_2=''.join(ans_2)
    ans_2=ans_2.split('+')
    ans_3.append(sum(list(map(int,ans_2))))
print(sum(ans_3))

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

Solution (Python):
S = input()
keta = len(S)
ans=0
for bit in range(1 << keta-1):
    f = S[0]

    for i in range(keta-1):
        if bit & (1<<i):
            f += "+"
        f += S[i+1]
    ans += sum(map(int,f.split("+")))
print(ans)

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

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

bins= []

for i in range(2**n):
    bins.append(list(str(format(i,'b')).zfill(n)))

ans = 0
for i in range(2**n):
    sum = 0
    temp = str(s[0])
    for j in range(n):
        if bins[i][j] == '0':
            sum += int(temp)
            temp = ''
            temp += str(s[j+1])
        
        else:
            temp += str(s[j+1])
    sum += int(temp)
    

    ans += sum

print(ans)

Solution (Python):
S = input()
all_sum = 0
for pattern in range(1 << (len(S)-1)):
  this_sum = 0
  cut = 0
  for i in range(1,len(S)):
    if pattern & 1 << i-1:
      this_sum += int(S[cut:i])
      cut = i

  this_sum += int(S[cut:])
  all_sum += this_sum

print(all_sum)

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


ptn = []
for bit in range(2**(N-1)):
    tmp = [False]*(N-1)
    for i in range(N-1):
        if ((bit>>i) & 1):
            tmp[i] = True
    ptn.append(tmp)


tot = []
for p in ptn:
    a = []
    for i, s in enumerate(S):
        if i==0:
            now = int(s)
            continue
        if p[i-1]==False:
            now *= 10
            now += int(s)
        else:
            a.append(now)
            now = int(s)
    a.append(now)
    tot.append(sum(a))
print(sum(tot))

Solution (Python):
S = input()

ans = 0
for i in range(2**(len(S)-1)):
    tmp = S
    for j in range(len(S)-1):
        if((i >> j) & 1):
            tmp = tmp[:(len(S)-1-j)] + "+" + tmp[(len(S)-1-j):]
    ans += sum([int(k) for k in tmp.split("+")])       
print(ans)

Solution (Python):
def saiki_wa(S,l,ls,n):
	ret = 0
	if n == l-1:
		s = S[0]
		for i in range(l-1):
			s = s + ls[i] + S[i+1]
		ret = sum([int(i) for i in s.split('+')])
	else:
		ret += saiki_wa(S,l,ls[:],n+1)
		ls[n] = '+'
		ret += saiki_wa(S,l,ls[:],n+1)

	return ret

if __name__ == '__main__':
	S = input()
	l = len(S)

	if l == 1:
		ans = int(S)
	else:
		ls = [''] * (l-1)

		ans = saiki_wa(S,l,ls,0)

	print(ans)

Solution (Python):
s = input()

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

print(ans)

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

ans = 0
for i in range(2**(n-1)) :
  bit = i
  index = 0
  for j in range(n-1) :
    c = bit%2
    bit = bit//2
    if c == 1 :
      ans += int(s[index:j+1])
      index = j+1
    elif j == n - 2 :
      ans += int(s[index:j+1])*10
  ans += int(s[n-1])

print(ans)

Solution (Python):
s = input()

n = len(s) - 1
ans = 0
for bit in range(2**n):
  a = s[0]
  for j in range(n):
    if (bit >> j) & 1:
      a += "+"
    a += s[j+1]
  ans += sum(map(int,a.split("+")))

print(ans)

Solution (Python):
s = input()

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

print(ans)

Solution (Python):
s = input()

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

print(ans)

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

ans = 0
for i in range(2**(n-1)) :
  bit = i
  v = 0
  vt = 0
  for j in range(n-1) :
    vt += int(s[j])
    c = bit%2
    bit = bit//2
    if c == 0 :
      vt *= 10
    else :
      v += vt
      vt = 0
  v += vt + int(s[n-1])
  ans += v

print(ans)

Solution (Python):
s=input()

outsum=0

for i in range(2**(len(s)-1)):
	temps = s
	mojisum = 0
    
	for j in range(len(s)-1):
		mojisum += 1
		if (i >> j) & 1 :
			outsum += int(temps[-mojisum:])
			temps = temps[:-mojisum]
			mojisum = 0
	outsum += int(temps)

print(outsum)

Solution (Python):
s = input()

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

print(ans)

Solution (Python):

s = input()
n = len(s) - 1
ans = 0
for bit in range(2**n):
  a =s[0]
  for i in range(n):
    if (bit >> i) & 1:
      a += "+"
    a += s[i+1]
    
  ans += sum(map(int,a.split("+")))

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_int = int(readline())
S_str = str(S_int)

if len(S_str) == 1:
    print(S_int)
    quit()

pattern = []
fmt = '0' + str(len(S_str)-1) + 'b'
for i in range(2**(len(S_str)-1)):
    pattern.append(format(i, fmt))

answer = 0
for plus_flags in pattern:
    tmp = []
    tmp_str = S_str[0]
    for i, is_plus in enumerate(plus_flags, start=1):
        if is_plus == "1":
            tmp.append(int(tmp_str))
            tmp_str = ""
        tmp_str += S_str[i]
    if tmp_str:
        tmp.append(int(tmp_str))
    answer += sum(tmp)
print(answer)

Solution (Python):
s = input()
def allsum(x):
    ans = int(x)
    if len(x) < 2:
        ans += 0
    else:
        for i in range(1, len(x)):
            ans += int(x[:i])*2**(len(x)-i-1) + allsum(x[i:])
    return ans
print(allsum(s))

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

def calc(S, i, stack):
    if i == len(S):
        l.append(stack) 
    elif i == 0:
        calc(S, 1, str(S[0]))
    else:
        
        calc(S, i + 1, stack + str(S[i]))

        
        calc(S, i + 1, stack + '+' + str(S[i]))


calc(S, 0, '')

for equation in l:
    ans += eval(equation)

print(ans)

Solution (Python):
s = input()

math_s_list = []

def plus_or_nothing(math_s, pos_s, s):
    if pos_s == len(s):
        math_s_list.append(eval(math_s))
        return
    
    plus_or_nothing(math_s+s[pos_s], pos_s+1, s)
    plus_or_nothing(math_s+'+'+s[pos_s], pos_s+1, s)
    return

plus_or_nothing(s[0], 1, s)

ans = 0
for i in math_s_list:
    ans += i

print(ans)

Solution (Python):








s = input()
l = len(s)
ans = 0

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

print(ans)

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

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

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

print(ans)

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

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

    ans += eval(op)

print(ans)

Solution (Python):
a=input()
len_a=len(a)
a=list(a)

c=0
for i in range(2**(len_a-1)): 
  s=a[0]
  for j in range(len_a-1):
      if ((i >> j) & 1) == 1: 
          s += "+"
      s += a[j+1]
  c += sum(map(int, s.split("+")))

print(c)

Solution (Python):
def insert_string_to_base(target_string, insert_point, insert_string):
    return target_string[:insert_point] + insert_string + target_string[insert_point:]

def main():
    N = str(input())
    l = len(N)-1

    result = 0
    for i in range(2 ** l):
        count = 1
        st = N
        for j in range(l):
            if ((i >> j) & 1):
                st = insert_string_to_base(st, j+count, "+")
                count+=1

        for v in st.split("+"):
            if(v != ''):
                result += int(v)
    print(result)


if __name__ == "__main__":
    main()

Solution (Python):
import copy

def splitAndPlus(s,len,cursor):

	if len - 1 > cursor :

		s2 = copy.copy(s)
		joined = ''.join([s2.pop(cursor),s2.pop(cursor)])
		nokori = s2
		nokori.insert(cursor,joined)

		return splitAndPlus(s,len,cursor+1) + splitAndPlus(nokori,len-1,cursor)

	else: 
		
		if s is None:
			return 0
		else:	
			numss = [ int(i) for i in s]
			return sum(numss)



inp = input()
s = [inp[i]  for i in range(len(inp))]

print(splitAndPlus(s,len(s),0))

Solution (Python):

s = input()


result = 0



for i in range(1 << len(s)-1):
    
    left_digit = 0

    
    
    for j in range(len(s)-1):
        
        if i & 1 << j:
            
            result += int(s[left_digit:j + 1])
            
            
            
            left_digit = j + 1

    
    result += int(s[left_digit:])
    
    


print(result)

Solution (Python):
s = input()

ans = 0
def dfs(s,f=0):
  global ans
  for i in range(len(s)):
    if i == 0:
      ans += int(s)
    else:
      ans += int(s[:i]) + f
      dfs(s[i:],int(s[:i])+f)
  return ans

print(dfs(s))

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

def main():
    s = input().strip()
    l = len(s) - 1
    ans = 0
    for i in range(2**l):
        ss = s
        tmp = 0
        for j in range(l):
            tmp += 1
            if i&1:
                ans += int(ss[:tmp])
                ss = ss[tmp:]
                tmp = 0
            i >>= 1
        ans += int(ss)
        
    print(ans)

if __name__ == "__main__":
    main()

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

def function(p, c, idx):
    n = c+int(S[idx])
    if idx == slen-1:
        return p+n
    else:
        return function(p+n, 0, idx+1) + function(p, n*10, idx+1)

print(function(0,0,0))

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

lenS = len(s)

def f(p,c,i):
  n = c+int(s[i])
  if i == lenS-1:
    return p+n
  else:
    return f(p+n,0,i+1)+f(p,n*10,i+1)
  
print(f(0,0,0))

Solution (Python):
inp = [x for x in input()]
cnt = len(inp)-1
sum_ = []

for c in range(2**cnt):
  inp_ = inp.copy()
  for j in range(cnt):
    if ((c >> j)&1):
      inp_[cnt-j-1]+='+'
      
  a = eval(''.join(inp_))
  sum_.append(a)
print(sum(sum_))

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

Solution (Python):
S = input()


slen = len(S)-1

ans = 0
for flag in range(1<<slen):
    j = 0
    for i in range(0,slen):
        if flag & 1<<i:
            ans += int(S[j:i+1])
            j = i + 1
    ans += int(S[j:])

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10000)
s=input()
ans=0
num=len(s)-1
def solve(moji,num):
    global ans
    if num==0:
        ans+=eval(moji)
    else:
        solve(moji,num-1)
        solve(moji[:-num]+"+"+moji[-num:],num-1)
solve(s,num)
print(ans)

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

for i in range(2**(len(S)-1)):
    bi = format(i,"b")
    bi = "0" * (len(S) - len(bi) - 1) + bi
    st = S[0]
    stsum = 0
    for k in range(len(S) - 1):
        if bi[k] == "0":
            stsum += int(st)
            st = S[k+1]
        else:
            st = st + S[k+1]
    stsum += int(st)
    allsum += stsum
print(allsum)

Solution (Python):
S = list(str(input()))
bit_flag = []
result_s = []
for i in range(1 << len(S)-1):
    tmp = []
    for j in range(len(S)-1):
        tmp.append((i >> j) & 1)
    bit_flag.append(tmp)

for bit in bit_flag:
    tmp = S[0]
    
    for i in range(len(S)-1):  
        if bit[i] == 1:
            tmp += "+"
        tmp += S[i+1]
    result_s.append(tmp)
ans = 0
for s in result_s:
    ans += eval(s)
print(ans)

Solution (Python):
S = str(input())
ans = []
N = len(S)  


def rec(tmp_s, n):
    if n == N-1:  
        ans.append(eval(tmp_s))
        return
    rec(tmp_s+"+"+S[n+1], n+1)
    rec(tmp_s+S[n+1], n+1)


rec(S[0], 0)
print(sum(ans))

Solution (Python):
from itertools import product
s = input()
ans = 0
for bit in product(['', '+'], repeat=len(s)-1):
    q = ''
    for i in range(len(s)*2-1):
        if i % 2 == 0:
            q += s[i//2]
        else:
            q += bit[(i-1)//2]
    ans += eval(q)
print(ans)

Solution (Python):
import sys

S=input()
N=len(S)
ans=0
for i in range(1<<N-1):
    start=0
    for j in range(N-1):
        if 1&(i>>j):
            ans += int(S[start:(j+1)])
            start = j + 1
    ans += int(S[start:])

print(ans)

Solution (Python):


s=''
aa=list(input())

for i in range(2**(len(aa)-1)):

    for j in range(len(aa)):

        s+=aa[j]

        if (i>>j) & 1:

            s += "+"

    s+="+"

s+="0"

print(eval(s))

Solution (Python):
S = input()

n = len(S)

ans_l = []

for i in range(2 ** (n-1)):
  l = []
  start = n - 1 
  end = n
  
  if i != 0:
    for j in range(n-1):
      if ((i >> j) & 1):
        
        l.append(int(S[start:end]))
        end = start
      start -= 1
    l.append(int(S[0:end]))
    ans_l.append(sum(l))
  else:
    ans_l.append(int(S))
  
        

  
print(sum(ans_l))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	S = IS()
	S=list(map(int,"".join(S)))
	def dfs(i, total, additional):
		if i==len(S)-1:
			return total+additional
		else:
			return dfs(i+1, total, additional*10+S[i+1]) + dfs(i+1, total+additional, S[i+1])
	print(dfs(0,0,S[0]))


if __name__ == '__main__':
	main()

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

total = 0
for i in range(2 ** (N - 1)):
    operation = ""
    for j in range(N - 1):
        operation += characters[j]
        if ((i >> j) & 1):
            operation += "+"
    operation += characters[N - 1]
    ans = eval(operation)
    total += ans
print(total)